![]() |
[CODE]for(n=1,10,for(k=1,20,if(isprime(k*n!+1),print(k","n))))[/CODE]
is what I did. |
[QUOTE=CRGreathouse]I just wrote half of it -- can you complete it?
Sieving is a lot more efficient than trial division.[/QUOTE] Show me the script. That will answer the question: Also: How is sieving [B]not[/B] wide-range trial-division? |
[QUOTE=3.14159;225598]Show me the script.[/QUOTE]
I didn't write it, and don't intend on writing it. [QUOTE=3.14159;225598]How is sieving [B]not[/B] wide-range trial-division?[/QUOTE] I've tried to explain this to you twice, and I failed both times. I guess I'm not that good of a teacher. :no: |
[QUOTE=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.
[/QUOTE] 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? |
[QUOTE=science_man_88;225597][CODE]for(n=1,10,for(k=1,20,if(isprime(k*n!+1),print(k","n))))[/CODE]
is what I did.[/QUOTE] 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. :smile: |
[QUOTE=3.14159;225600]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.[/QUOTE] 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. |
[QUOTE=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.
[/QUOTE] You mean, these?: [QUOTE=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] [QUOTE=CRGreathouse]I didn't write it, and don't intend on writing it. [/QUOTE] How in the world did you manage to contradict yourself so vividly? This, to me, is a glaring red flag. |
[QUOTE=3.14159;225605]How in the world did you manage to contradict yourself so vividly?[/QUOTE]
I see no contradiction. |
[QUOTE=CRGreathouse;225606]I see no contradiction.[/QUOTE]
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. |
[QUOTE=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.
[/QUOTE] 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) |
[QUOTE=3.14159;225608]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?[/QUOTE]
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?) |
| All times are UTC. The time now is 23:03. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.