mersenneforum.org  

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

Reply
 
Thread Tools
Old 2010-08-16, 13:47   #562
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

135338 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
But that only gets rid of one divisor, 229. What if we wished to get rid of 229 and 233?
Duh, wrap the whole thing in a forprime(p=229,233, ___).

That's why you want the calculations to find the starting point rather than just finding it on your own beforehand.
CRGreathouse is offline   Reply With Quote
Old 2010-08-16, 14:11   #563
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24×3×5×7 Posts
Default

Quote:
Originally Posted by CRGreathouse
Duh, wrap the whole thing in a forprime(p=229,233, ___).
forprime(p=a,b,forstep(n=lift(Mod(-1,p)/(x!),10^m,p,...)?

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

3×1,993 Posts
Default

I have to drag you kicking and screaming, don't I.

So inside the loop you know that exponent n is bad (creates a number divisible by p). So you need to have a list of numbers and mark number n as bad (whatever value you choose for that).
CRGreathouse is offline   Reply With Quote
Old 2010-08-16, 14:25   #565
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24×3×5×7 Posts
Default

Quote:
Originally Posted by CRGreathouse
So inside the loop you know that exponent n is bad (creates a number divisible by p). So you need to have a list of numbers and mark number n as bad (whatever value you choose for that).
A particular k-value is bad if k * n! + 1 makes a value divisible by a small prime.
If a certain k * n! + 1 is divisible by, let's say, 2550871, I would make a forstep loop, where the step size = 2550871, where all the k-values that would be divisible by 2550871 are eliminated.

If n = 430, and k goes up to 108:

Eliminated k's are:

Code:
702669
3253540
5804411
8355282
10906153
13457024
16007895
18558766
21109637
23660508
26211379
28762250
31313121
33863992
36414863
38965734
41516605
44067476
46618347
49169218
51720089
54270960
56821831
59372702
61923573
64474444
67025315
69576186
72127057
74677928
77228799
79779670
82330541
84881412
87432283
89983154
92534025
95084896
97635767
I would have to code that to exclude those numbers, as I know they form a k * 430! + 1 that is divisible by 2550871.

Or: A smaller prime: 577.
There would be 173310 k-values eliminated by 577.

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

24×3×5×7 Posts
Default

I thought of a code snippet:
Note: e = variable, not 2.718281828459045..
kfacsieve(a,x,e,b) = {
forprime(p=a,x,
forstep(n=lift(Mod(-1,p)/(e!),10^b,p,print(n))
);
}


(Please check for any errors I might have made there.)

Last fiddled with by 3.14159 on 2010-08-16 at 14:58 Reason: Error in code.
3.14159 is offline   Reply With Quote
Old 2010-08-16, 14:54   #567
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Default

OK. Now show what's left, not what's removed. You'll generally want to sieve out all the primes in a large range (at the very least 3 to 1e6).

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

24·3·5·7 Posts
Default

Quote:
Originally Posted by CRGreathouse
OK. Now show what's left, not what's removed. You'll generally want to sieve out all the primes in a large range (at the very least 3 to 1e6).
How can I do that? Forstep is only capable of showing what's removed.

Last fiddled with by 3.14159 on 2010-08-16 at 14:59
3.14159 is offline   Reply With Quote
Old 2010-08-16, 15:09   #569
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
How can I do that? Forstep is only capable of showing what's removed.
Clearly this is false. Just store the information instead of printing it.
CRGreathouse is offline   Reply With Quote
Old 2010-08-16, 15:35   #570
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

Quote:
Originally Posted by CRGreathouse
Clearly this is false. Just store the information instead of printing it.
There is no such option.
3.14159 is offline   Reply With Quote
Old 2010-08-16, 16:12   #571
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3·1,993 Posts
Default

Ah, so I must have been lying about having constructed a sieve in Pari earlier, and I must be intentionally misleading you now.
CRGreathouse is offline   Reply With Quote
Old 2010-08-16, 16:25   #572
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24×3×5×7 Posts
Default

Quote:
Originally Posted by CRGreathouse
Ah, so I must have been lying about having constructed a sieve in Pari earlier, and I must be intentionally misleading you now.
Not exactly what I said, but cool strawman, anyway.
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: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.