hermann on Sun, 24 Mar 2024 00:57:09 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: How to efficiently count Proth primes with GP parfor?


On 2024-03-22 01:20, hermann@stamm-wilbrandt.de wrote:

You can use it from here (I submitted to oeis.org, but reviews will take time):

Changes have been approved:
https://oeis.org/A080076
https://oeis.org/A080076/a080076.json.txt


Afterwards I verified that count is correct with gist:

hermann@7950x:~$ n=2^40 gp -q < proth.gp
32
45min, 54,738 ms × 24.010 = 18h, 22min, 21,364 ms
122742
^C

hermann@7950x:~$ gp -q
? P=readvec("a080076.json.txt")[1];

While it is best to "readvec()" file locally, I learned that PARI/GP can curl it as well:

hermann@7950x:~$ cat oeis_proth.gp
is_A080075 = isproth(x)={!bittest(x--, 0) && (x>>valuation(x+!x, 2))^2 < x };
is_A080076(N)=isproth(N)&&isprime(N); \\ see A080075 for isproth()
#
P=extern("curl -s https://oeis.org/A080076/a080076.json.txt";);
foreach(P,p,if(!is_A080076(p),print(p)));
for(i=2,#P,if(P[i-1]>=P[i],print(i)));
#P
hermann@7950x:~$ gp -q < oeis_proth.gp
   timer = 1 (on)
cpu time = 18 ms, real time = 1,272 ms.
cpu time = 140 ms, real time = 140 ms.
cpu time = 21 ms, real time = 21 ms.
122742
hermann@7950x:~$



Having all Proth primes up to 2^40 allows to analyze distribution
of Proth primes for all 1<=m<=20 (p=k*2^m+1, k<2^m) for a given m.

I did distribution analysis as part of this posting:
https://www.mersenneforum.org/showthread.php?p=653526#post653526

I) All 122,742 Proth primes below 2^40
II) distribution of "k"s for a fixed 1≤m≤20
II) most frequent "k"s among the 2290 Proth primes in all.txt
IV) LLR 4.0.5 Proth prime (prize) proof for 100,000,000 decimal digit number ETA of 74 days


I had some trouble in scaling diagram with plotscale(), but was finally able to see interesting distribution pattern for the "k"s for m=20 (and 1024 buckets for p2=10):
https://gist.github.com/Hermann-SW/b373c166d3a9e35253f3f4eab020b002?permalink_comment_id=4998459#gistcomment-4998459


Regards,

Hermann.