mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Prime Cullen Prime (https://www.mersenneforum.org/forumdisplay.php?f=79)
-   -   Cullen prime problem (https://www.mersenneforum.org/showthread.php?t=6690)

Siemelink 2006-12-01 22:08

I am currently sieving with Multisieve Woodall numbers. I use the range from 1.3 million to 2 million. I still have 30,000 candidates left. Do I understand this discussion correctly that Multisieve is not really meant for such a range?
If this is so, how can I sieve quicker? Citrix, would your sieve be amendable to do Woodalls? Or should I stick with Multisieve but switch to short ranges (10,000) containing 500 candidates?

Have a nice day, Willem.

rogue 2006-12-01 23:58

[QUOTE=Siemelink;93004]I am currently sieving with Multisieve Woodall numbers. I use the range from 1.3 million to 2 million. I still have 30,000 candidates left. Do I understand this discussion correctly that Multisieve is not really meant for such a range?
If this is so, how can I sieve quicker? Citrix, would your sieve be amendable to do Woodalls? Or should I stick with Multisieve but switch to short ranges (10,000) containing 500 candidates?

Have a nice day, Willem.[/QUOTE]

MultiSieve is fine for that range since you are sieving all n in that range. If you were only sieving where n is a prime, then Citrix's code would have the advantage.

maxal 2006-12-02 05:04

[QUOTE=maxal;93001]P.P.S. There is another speed up possible if we replace p-1 with the multiplicative order of 2 modulo p (that is a divisor of p-1). So, instead of letting k go from 0 to p-2, we compute incrementally and store values u[i]=2^i mod p, i=1,2,... until we get u[z]=1, meaning that z is the multiplicative order of 2 modulo p. Then we let k go from 0 to z-1, compute
r = ((z-k) * p + u[k] * z) mod (p*z), and eliminate candidates r, r + (p*z), r + 2*(p*z), ..., up to selected upper bound.[/QUOTE]
Correction: [b]r = ((z-k) * p + u[k] * (p-1)) mod (p*z)[/b]

Citrix 2006-12-26 05:42

@ rouge.

I was able to modify your program yesterday, to suit my needs, but it did not become as fast as we thought it would have become. I just increased the size of the array that stores all the values of 2^1, 2^2... (mod p). Though I did see some speed up.

I am not sure how to speed up the program further. Any thoughts.

Also something is wrong with the time function. The time per candidate keeps on jumping between 15 sec and 60 secs. (I did not modify this code, so its not me)

rogue 2006-12-26 13:39

[QUOTE=Citrix;94763]@ rouge.

I was able to modify your program yesterday, to suit my needs, but it did not become as fast as we thought it would have become. I just increased the size of the array that stores all the values of 2^1, 2^2... (mod p). Though I did see some speed up.

I am not sure how to speed up the program further. Any thoughts.

Also something is wrong with the time function. The time per candidate keeps on jumping between 15 sec and 60 secs. (I did not modify this code, so its not me)[/QUOTE]

Is as fast as your code? If not, is there anything you see that could be modified to help? I wonder if the compiler you are using is smart enough to optimize the code correctly so that the ASM routines I have written do not provide any benefit (and might actually hurt performance). The code was written to be fairly generic, so it doesn't take advantage of any CPU specific optimizations. I would expect that you would see the biggest benefit for p > 2^31.

I'm not aware of any issues with the timing code. If you find something let me know.

Citrix 2006-12-26 19:56

[QUOTE=rogue;94769]Is as fast as your code? If not, is there anything you see that could be modified to help? I wonder if the compiler you are using is smart enough to optimize the code correctly so that the ASM routines I have written do not provide any benefit (and might actually hurt performance). The code was written to be fairly generic, so it doesn't take advantage of any CPU specific optimizations. I would expect that you would see the biggest benefit for p > 2^31.

I'm not aware of any issues with the timing code. If you find something let me know.[/QUOTE]

It is about as fast as my program. My program only computes upto 2^31, so there is no way to compare on speeds after that. As for the compiler, I am using VC++ 6.0. Is there a better compiler I could use? I am testing both programs on a 1.4 Ghz intel celeron processor.

Currently I have only sieved upto 350M. (The sieve is quite slow, about 80M/hr. Not sure if this series will be worth testing.) So, it will be a long time before I cross 2^31, and if the program gets slower after that....

For the timing issue I think it depends on the distribution of factors. Sometimes 10 factors are found in a min and then no factors for 5+ mins. I think this would screw up the timing?

ATH 2007-01-31 08:26

I sieved cullen numbers from n=1 to n=5,000,000 up to 2.5G (2.5 * 10[sup]9[/sup]). I found 4,847,529 factors so that leaves 152,457 unknowns plus the 14 known cullen primes.

Here is all 5 million n's with factors:

[URL="http://www.hoegge.dk/mersenne/cullenfactors.zip"]cullenfactors.zip[/URL] (18 Mb).

The 14 primes have "PRIME" instead of a factor, and the 152,457 unknowns have "?" instead of a factor.

Here is ABC format file for the 109,042 unknowns between n=1,500,000 (current progress according to [URL="http://www.prothsearch.net/cullenrange.html"]http://www.prothsearch.net/cullenrange.html[/URL] ) and n=5,000,000:

[URL="http://www.hoegge.dk/mersenne/cullen1.5M-5M.zip"]cullen1.5M-5M.zip[/URL]

alpertron 2007-01-31 19:22

p*2[sup]p[/sup]+1 cannot be prime if p>3 is a prime twin.

First suppose p=1 (mod 3) and let p=2q+1 (because p is odd). Operating modulo 3 we find:

p*2[sup]p[/sup]+1 = 1*2[sup]2q+1[/sup]+1 = 2[sup]2q[/sup]*2+1 = (2[sup]2[/sup])[sup]q[/sup]*2+1 = 1[sup]q[/sup]*2+1 = 2+1 = 0 (mod 3)

The other possibility is p=2 (mod 3) and p+2 also a prime. Operating modulo p+2 we find:

p*2[sup]p[/sup]+1 = (-2)*2[sup]p[/sup]+1 = -2[sup]p+1[/sup]+1 = -1+1 = 0 (mod p+2)

So in both cases p*2[sup]p[/sup]+1 is composite.

brunoparga 2007-02-01 01:17

Dario,

Modular arithmetic still looks like a strange realm to me. So, I'm not sure if I understand what you've written:
[QUOTE=alpertron;97409]
p*2[sup]p[/sup]+1 = 1*2[sup]2q+1[/sup]+1 = 2[sup]2q[/sup]*2+1 = (2[sup]2[/sup])[sup]q[/sup]*2+1 = 1[sup]q[/sup]*2+1 = 2+1 = 0 (mod 3)
[/QUOTE]

In short, does this mean no prime p = 1 (mod 3) can generate a Cullen prime? Even if this p isn't a prime twin?

[QUOTE=alpertron;97409]p*2[sup]p[/sup]+1 = (-2)*2[sup]p[/sup]+1 = [B]-2[sup]p+1[/sup]+1 = -1+1[/B] = 0 (mod p+2)[/QUOTE]

I can't understand the part I've put in bold. Since both sides have a "+1" term, I assume I can change that particular equality to:

-2[sup]p+1[/sup] = -1 (mod p+2)

I still can't understand it even if I multiply both sides by (-1) (can I do that?), giving:

2[sup]p+1[/sup] = 1 (mod p+2)

Testing with small primes, I can see it works. But why?

Thanks a lot,
Bruno

ATH 2007-02-01 03:59

[QUOTE=brunoparga;97434]
2[sup]p+1[/sup] = 1 (mod p+2)
[/QUOTE]

This is just [URL="http://primes.utm.edu/notes/proofs/FermatsLittleTheorem.html"]Fermat's Little Theorem[/URL] with p+2 = prime (p being twin prime) and a=2.

alpertron 2007-02-01 12:14

[QUOTE=brunoparga;97434]In short, does this mean no prime p = 1 (mod 3) can generate a Cullen prime? Even if this p isn't a prime twin?[/QUOTE]
In that case p does not need to be prime. When p=1 (mod 3) the argument shown above demonstrates that p*2[sup]p[/sup]+1 is multiple of 3.


All times are UTC. The time now is 15:59.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.