mersenneforum.org  

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

Reply
 
Thread Tools
Old 2010-08-15, 23:59   #540
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

Code:
for(n=1,10,for(k=1,20,if(isprime(k*n!+1),print(k","n))))
is what I did.
science_man_88 is offline   Reply With Quote
Old 2010-08-16, 00:00   #541
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

Quote:
Originally Posted by CRGreathouse
I just wrote half of it -- can you complete it?

Sieving is a lot more efficient than trial division.
Show me the script. That will answer the question:

Also: How is sieving not wide-range trial-division?

Last fiddled with by 3.14159 on 2010-08-16 at 00:02
3.14159 is offline   Reply With Quote
Old 2010-08-16, 00:03   #542
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3·1,993 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
Show me the script.
I didn't write it, and don't intend on writing it.

Quote:
Originally Posted by 3.14159 View Post
How is sieving not wide-range trial-division?
I've tried to explain this to you twice, and I failed both times. I guess I'm not that good of a teacher.
CRGreathouse is offline   Reply With Quote
Old 2010-08-16, 00:04   #543
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24×3×5×7 Posts
Default

Quote:
Originally Posted by CRGreathouse
I've tried to explain this to you twice, and I failed both times. I guess I'm not that good of a teacher.
Nevermind, I get it now.

1. Establish the first number larger than p such that n%p = 0. (Ex: 311, 622%311 = 0.)
2. Count by p and cross off.

That it?

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

3×1,993 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
Code:
for(n=1,10,for(k=1,20,if(isprime(k*n!+1),print(k","n))))
is what I did.
Yes. The intent is to avoid as many isprime() calls as possible, though. When you're working with numbers that take a long time to test you don't want to run extra checks.

I wrote a quick siever today for a problem I'm working on, and it managed to remove about 200,000 candidates, saving what would have otherwise been a few months of work.
CRGreathouse is offline   Reply With Quote
Old 2010-08-16, 00:08   #545
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

597910 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
Nevermind, I get it now.

1. Establish the first number larger than p such that n%p = 0. (Ex: 311, 622%311 = 0.)
2. Count by p and cross off.
Yes, that's the basic idea. #2 has to be modified when you're working with numbers that aren't consecutive, like k * n! + 1 or k * 2^n + 1. I gave the relevant calculations (hopefully correct!) above.
CRGreathouse is offline   Reply With Quote
Old 2010-08-16, 00:12   #546
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24×3×5×7 Posts
Default

Quote:
Originally Posted by CRGreathouse
Yes, that's the basic idea. #2 has to be modified when you're working with numbers that aren't consecutive, like k * n! + 1 or k * 2^n + 1. I gave the relevant calculations (hopefully correct!) above.
You mean, these?:

Quote:
Originally Posted by CRGreathouse
So write one. Loop over the primes from n+1 to as high as you like, and for each start at k = lift(Mod(-1,p)/n!) and use a step size of lift(Mod(1,p)/n!) to mark off candidates. (Check what I said in case of mistakes of finger or mind.)
Quote:
Originally Posted by CRGreathouse
I didn't write it, and don't intend on writing it.
How in the world did you manage to contradict yourself so vividly?
This, to me, is a glaring red flag.

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

10111010110112 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
How in the world did you manage to contradict yourself so vividly?
I see no contradiction.
CRGreathouse is offline   Reply With Quote
Old 2010-08-16, 00:19   #548
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
I see no contradiction.
how is telling you to write something Pi a contradiction of I didn't write one I don't plan on such a thing. it's not.
science_man_88 is offline   Reply With Quote
Old 2010-08-16, 00:20   #549
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

69016 Posts
Default

Quote:
Originally Posted by science_man_88
how is telling you to write something Pi a contradiction of I didn't write one I don't plan on such a thing. it's not.
Doesn't "I wrote 1/2 of the script", and "I did not write it, nor do I intend to write it", sound a bit like 1 = 2 to you?

P.S: 816280180 * 2250! + 1 is prime. (≈6575 digits)

Last fiddled with by 3.14159 on 2010-08-16 at 00:24
3.14159 is offline   Reply With Quote
Old 2010-08-16, 00:23   #550
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3·1,993 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
Doesn't "I wrote 1/2 of the script", and "I did not write it, nor do I intend to write it", sound a bit like 1 = 2 to you?
No. I wrote the key calculations for the script, in the scripting language. I did not write the script that would contain those calculations. (If it's not worth your time to do it, why would it be worth mine?)
CRGreathouse 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:00.


Fri Aug 6 23:00:40 UTC 2021 up 14 days, 17:29, 1 user, load averages: 4.02, 4.11, 4.01

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.