mersenneforum.org  

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

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

168010 Posts
Default

Quote:
Originally Posted by 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?)
You failed to specify that.

Also: It would be a difficult task to write a sieve for k * n! + 1 in PARI/GP

Last fiddled with by 3.14159 on 2010-08-16 at 01:12
3.14159 is offline   Reply With Quote
Old 2010-08-16, 01:13   #552
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

You suggested the use of lift(Mod(-1,x)/(n!)) and lift(Mod(1,x)/(n!))

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

3·1,993 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
You failed to specify that.
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).
CRGreathouse is offline   Reply With Quote
Old 2010-08-16, 01:14   #554
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

10111010110112 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
You suggested the use of lift(Mod(-1,x)/(n!))
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. 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);
once I strip out all the unrelated junk. But that's variable-exponent, not variable-factor.

Last fiddled with by CRGreathouse on 2010-08-16 at 01:16
CRGreathouse is offline   Reply With Quote
Old 2010-08-16, 11:56   #555
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

Quote:
Originally Posted by 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).
What sequence is it that you have been working for?

Quote:
Originally Posted by 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. Ugh, lost 6 hours of work with that one.
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.

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

3·1,993 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
What sequence is it that you have been working for?
http://oeis.org/classic/A176494 -- see the seqfan archives if you're interested.

Quote:
Originally Posted by 3.14159 View Post
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.
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?
CRGreathouse is offline   Reply With Quote
Old 2010-08-16, 12:32   #557
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

Since the point of a sieve is to avoid trial division: (forstep) loops.

At this point, I can get rid of specific divisors, but not groups of them.

Quote:
Originally Posted by 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?
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,..) ?

Last fiddled with by 3.14159 on 2010-08-16 at 12:43
3.14159 is offline   Reply With Quote
Old 2010-08-16, 12:49   #558
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

If so, that is incorrect, because it would also kick out prime numbers. (Ex: 9405 * 22! + 1 is prime.)

Last fiddled with by 3.14159 on 2010-08-16 at 12:50
3.14159 is offline   Reply With Quote
Old 2010-08-16, 12:49   #559
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3·1,993 Posts
Default

Maybe the step size just needs to be the prime itself?
CRGreathouse is offline   Reply With Quote
Old 2010-08-16, 12:52   #560
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

69016 Posts
Default

Quote:
Originally Posted by CRGreathouse
Maybe the step size just needs to be the prime itself?
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.)

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

24·3·5·7 Posts
Default

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.

Last fiddled with by 3.14159 on 2010-08-16 at 13:00
3.14159 is offline   Reply With Quote
Reply

Thread Tools


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:33 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.