mersenneforum.org  

Go Back   mersenneforum.org > Math Stuff > Computer Science & Computational Number Theory > PARI/GP

Reply
 
Thread Tools
Old 2010-08-17, 16:37   #617
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24×3×5×7 Posts
Default

In the long run, my idea fails, because nonmem fails to work as directed. I think I'm going to have to revert back to the TF switch on PFGW.

Last idea:
if(n=!p*a + lift(Mod(-1,p)/(m!)), print(n)))

Last fiddled with by 3.14159 on 2010-08-17 at 16:46
3.14159 is offline   Reply With Quote
Old 2010-08-17, 16:55   #618
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

Well, it works, but only for individual divisors. If I add more than one prime, it loops/repeats. I need to edit it to include the and condition a few hundred times.

Last fiddled with by 3.14159 on 2010-08-17 at 16:56
3.14159 is offline   Reply With Quote
Old 2010-08-17, 16:56   #619
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
In the long run, my idea fails, because nonmem fails to work as directed. I think I'm going to have to revert back to the TF switch on PFGW.
As you will. For my recent (ongoing, unfortunately) project I found a huge speedup with sieving vs. trial division: I could remove more composites (higher bounds) in less time with sieving. Actually I found it worthwhile to spend a good fraction of my time sieving because of the amount of effort saved by avoiding primality tests.
CRGreathouse is offline   Reply With Quote
Old 2010-08-17, 16:59   #620
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3·1,993 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
Well, it works, but only for individual divisors. If I add more than one prime, it loops/repeats. I need to edit it to include the and condition a few hundred times.
You need to store the results in a vector rather than printing, since your lists will get large. For my small project I had 2 million candidates and 100 million primes; yours may not be as small. (I hoped to finish this yesterday so as to free up cycles for my new project that I've talked about, but no such luck.)
CRGreathouse is offline   Reply With Quote
Old 2010-08-17, 17:03   #621
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

Quote:
Originally Posted by CRGreathouse
You need to store the results in a vector rather than printing, since your lists will get large. For my small project I had 2 million candidates and 100 million primes; yours may not be as small. (I hoped to finish this yesterday so as to free up cycles for my new project that I've talked about, but no such luck.)
Vectors? They can only store returns. That would mean I would be forced to sift through the file for every single prime, counting by p to remove a number every p numbers skipped. Dreadfully inefficient, at best.

Ex: Sieving out 509 for k * 360! + 1:
Liftmod(509, 360!) = 474.

Suppose the k-value range is n between 1 and 60k. That would be 117 values removed. Manual removal of values is dreadfully inefficient.

Last fiddled with by 3.14159 on 2010-08-17 at 17:08
3.14159 is offline   Reply With Quote
Old 2010-08-17, 17:07   #622
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3·1,993 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
Vectors? They can only store returns. That would mean I would be forced to sift through the file for every single prime, counting by p to remove a number every p numbers skipped. Dreadfully inefficient, at best.
I'm not sure exactly what you mean by "they can only store returns", but I'm pretty sure it's wrong.

There's no need to use an intermediate file, I don't know why you'd suggest that. You keep one vector that starts out all 0s, you sieve, and at the end of the process each remaining 0 corresponds to a candidate which is not divisible by any of the primes you sieved out.

Last fiddled with by CRGreathouse on 2010-08-17 at 17:10
CRGreathouse is offline   Reply With Quote
Old 2010-08-17, 17:09   #623
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

Quote:
Originally Posted by CRGreathouse
I'm not sure exactly what you mean by "they can only store returns", but I'm pretty sure it's wrong.
You can't make a vector out of print values (Well, the vector formed is 0, but you get the idea.). The vector is made of return values. I would have to store it in a file, and manually remove all the bad k-values.

Last fiddled with by 3.14159 on 2010-08-17 at 17:12
3.14159 is offline   Reply With Quote
Old 2010-08-17, 17:13   #624
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
You can't make a vector out of print values (Well, the vector formed is 0, but you get the idea.). The vector is made of return values. I would have to store it in a file, and manually remove all the bad k-values.
You can store strings (this is my best guess as to what you mean by "print values") in vectors if you like. But there's no need to do that -- you just need a 0 or a 1 in each entry.

And there's absolutely no reason to store the vector in a file (though Pari could certainly do that).

I still don't know what you mean by return values, or why you think printing has anything to do with any of this.

Last fiddled with by CRGreathouse on 2010-08-17 at 17:14
CRGreathouse is offline   Reply With Quote
Old 2010-08-17, 17:30   #625
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24×3×5×7 Posts
Default

Quote:
Originally Posted by CRGreathouse
You can store strings (this is my best guess as to what you mean by "print values") in vectors if you like. But there's no need to do that -- you just need a 0 or a 1 in each entry.
By that, I was referencing a list of printed b-values. A vector can't be formed of them.

Last fiddled with by 3.14159 on 2010-08-17 at 17:31
3.14159 is offline   Reply With Quote
Old 2010-08-17, 17:59   #626
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
By that, I was referencing a list of printed b-values. A vector can't be formed of them.
OK... so why print them in the first place? Replace print(foo" is bad") with v[foo] = "bad", or v[foo] = 1, or whatever you like.
CRGreathouse is offline   Reply With Quote
Old 2010-08-17, 18:16   #627
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24×3×5×7 Posts
Default

Quote:
Originally Posted by CRGreathouse
OK... so why print them in the first place? Replace print(foo" is bad") with v[foo] = "bad", or v[foo] = 1, or whatever you like.
It is unclear what you mean here.

em2 can't be made a vector.

I think there's simply no way to do it using vectors.

Last fiddled with by 3.14159 on 2010-08-17 at 18:17
3.14159 is offline   Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why do I sometimes see all the <> formatting commands when I quote or edit? cheesehead Forum Feedback 3 2013-05-25 12:56
Passing commands to PARI on Windows James Heinrich Software 2 2012-05-13 19:19
Ubiquity commands Mini-Geek Aliquot Sequences 1 2009-09-22 19:33
64-bit Pari? CRGreathouse Software 2 2009-03-13 04:22
Are these commands correct? jasong Linux 2 2007-10-18 23:40

All times are UTC. The time now is 23:02.


Fri Aug 6 23:02:34 UTC 2021 up 14 days, 17:31, 1 user, load averages: 3.38, 3.93, 3.95

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.