![]() |
[QUOTE=CRGreathouse]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?)
[/QUOTE] You failed to specify that. Also: It would be a difficult task to write a sieve for k * n! + 1 in PARI/GP |
You suggested the use of lift(Mod(-1,x)/(n!)) and lift(Mod(1,x)/(n!))
|
[QUOTE=3.14159;225611]You failed to specify that.[/QUOTE]
[i]I[/i] think I was pretty clear, but if it didn't come across that way I suppose that speaks to my communications skills. Somehow I really just don't enjoy writing sieves. I just wrote one today (on a project with Vladimir Shevelev) and I've been working on a specialized siever for one of my sequences in the OEIS. The quick ones (yours and the one I made for Vladimir) aren't too bad, but this other one has been just draining... it's a pain, since this one needs to be really efficient (since it will run over the course of several months). |
[QUOTE=3.14159;225612]You suggested the use of lift(Mod(-1,x)/(n!))[/QUOTE]
Yes, I think that's the right calculation. Check it with an example before trusting me, though... I've already messed up one siever today. :down: Ugh, lost 6 hours of work with that one. For my earlier sieve the calculations were essentially [code]b=znorder(Mod(2,p)); a=znlog(2293,Mod(2,p),b);[/code] once I strip out all the unrelated junk. But that's variable-exponent, not variable-factor. |
[QUOTE=CRGreathouse]Somehow I really just don't enjoy writing sieves. I just wrote one today (on a project with Vladimir Shevelev) and I've been working on a specialized siever for one of my sequences in the OEIS. The quick ones (yours and the one I made for Vladimir) aren't too bad, but this other one has been just draining... it's a pain, since this one needs to be really efficient (since it will run over the course of several months).
[/QUOTE] What sequence is it that you have been working for? [QUOTE=CRGreathouse]Yes, I think that's the right calculation. Check it with an example before trusting me, though... I've already messed up one siever today. :down: Ugh, lost 6 hours of work with that one. [/QUOTE] Ouch. Mod(-1,p)/(n!) gives the smallest k for which (k * n! + 1)%p=0, and Mod(1,p)/(n!) gives the smallest k for which (k * n! -1)%p=0. I'm searching for k * n! + 1. Mod(-1,p)/(n!) will help me a bit more here. |
[QUOTE=3.14159;225650]What sequence is it that you have been working for?[/QUOTE]
[url]http://oeis.org/classic/A176494[/url] -- see the seqfan archives if you're interested. [QUOTE=3.14159;225650]Mod(-1,p)/(n!) gives the smallest k for which (k * n! + 1)%p=0, and Mod(1,p)/(n!) gives the smallest k for which (k * n! -1)%p=0. I'm searching for k * n! + 1. Mod(-1,p)/(n!) will help me a bit more here.[/QUOTE] Right. So start at the place where k * n! + 1 is 0, and repeatedly add on the k-value where k * n! = 1 mod p. Yes? |
Since the point of a sieve is to avoid trial division: (forstep) loops. :tu:
At this point, I can get rid of specific divisors, but not groups of them. [QUOTE=CRGreathouse]Right. So start at the place where k * n! + 1 is 0, and repeatedly add on the k-value where k * n! = 1 mod p. Yes? [/QUOTE] Ex: 229. >Mod(-1, 229)/(22!) %1 = Mod(105, 229) 105 * 22! + 1 = 0 mod 229. In other words, 105 * 22! + 1 is divisible by 229. >Mod(1, 229)/(22!) %1 = Mod(124, 229) So the forstep= (n=105,a,124,..) ? |
If so, that is incorrect, because it would also kick out prime numbers. (Ex: 9405 * 22! + 1 is prime.)
|
Maybe the step size just needs to be the prime itself?
|
[QUOTE=CRGreathouse]Maybe the step size just needs to be the prime itself?
[/QUOTE] Yep. Step = 229. (Verified, every k value after 105 that was of the form 105 + 229a yielded a k * 22! + 1 value that was divisible by 229.) |
So, the forstep is set.
forstep(n=105,a,229,if((n*22!+1)%229==0,print(n))) But that only gets rid of one divisor, 229. What if we wished to get rid of 229 and 233? One suggestion I received was to write two or more separate commands within one script: One for each divisor. A forstep command for 229, and a separate forstep command for 233, within the same script. Excellent. |
| All times are UTC. The time now is 23:03. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.