PrimeGrid
Please visit donation page to help the project cover running costs for this month

Toggle Menu

Join PrimeGrid

Returning Participants

Community

Leader Boards

Results

Other

drummers-lowrise

Advanced search

Message boards : Wieferich and Wall-Sun-Sun Prime Search : Check a WW find with PARI/GP

Author Message
Profile JeppeSNProject donor
Avatar
Send message
Joined: 5 Apr 14
Posts: 1625
ID: 306875
Credit: 39,019,713
RAC: 29,261
Found 1 prime in the 2020 Tour de Primes321 LLR Gold: Earned 500,000 credits (529,293)Cullen LLR Gold: Earned 500,000 credits (611,298)ESP LLR Silver: Earned 100,000 credits (174,818)Generalized Cullen/Woodall LLR Silver: Earned 100,000 credits (112,799)PPS LLR Jade: Earned 10,000,000 credits (14,354,241)PSP LLR Silver: Earned 100,000 credits (428,457)SoB LLR Silver: Earned 100,000 credits (466,812)SR5 LLR Silver: Earned 100,000 credits (145,419)SGS LLR Silver: Earned 100,000 credits (112,277)TRP LLR Silver: Earned 100,000 credits (342,501)Woodall LLR Silver: Earned 100,000 credits (109,455)321 Sieve (suspended) Silver: Earned 100,000 credits (175,037)PPS Sieve Bronze: Earned 10,000 credits (10,113)AP 26/27 Bronze: Earned 10,000 credits (12,129)GFN Ruby: Earned 2,000,000 credits (4,181,260)WW Turquoise: Earned 5,000,000 credits (9,640,000)PSA Turquoise: Earned 5,000,000 credits (7,614,290)
Message 145728 - Posted: 28 Nov 2020 | 13:18:49 UTC

I am repeating myself here, because I have posted these PARI functions before (in the old days in the Project Staging Area subforum), but now that we have a dedicated WW subforum, I thought I would create a thread.

You can test your Wall-Sun-Sun/Wieferich find or near-find easily and very quickly with PARI/GP. Here are some methods:

checkwss(p) = { if(!isprime(p)||p<=5,return("no, p is not a prime greater than 5")); index = p-kronecker(p,5); result = Mod([1,1;1,0],p^2)^(index-1); result = centerlift(result[1,1])/p; Strprintf("%d is a WallSunSun special instance (+0 %+d p)", p, result) } checkwieferich(p) = { if(!isprime(p)||p==2,return("no, p is not an odd prime")); plusOrMinus = kronecker(2,p); result = centerlift(Mod(2,p^2)^((p-1)/2)); result = (result-plusOrMinus)/p; Strprintf("%d is a Wieferich special instance (%+d %+d p)", p, plusOrMinus, result) } checkww(p) = print(checkwss(p));print(checkwieferich(p))


The functions declare all primes special instances, but you can check for yourself if the A value in the parenthesis is small. For example checkww(597076280277725011) gives
597076280277725011 is a WallSunSun special instance (+0 -200675094101863100 p) 597076280277725011 is a Wieferich special instance (-1 +865 p)
from which you see that as a Wall-Sun-Sun it is not "near", but with Wieferich, it is "near" (+865 is small).

Of course, if you want the A value as an integer (not inside some formatted text string), that part is easy to extract:
wssA(p) = { if(!isprime(p)||p<=5,return("no, p is not a prime greater than 5")); index = p-kronecker(p,5); result = Mod([1,1;1,0],p^2)^(index-1); centerlift(result[1,1])/p; } wieferichA(p) = { if(!isprime(p)||p==2,return("no, p is not an odd prime")); plusOrMinus = kronecker(2,p); result = centerlift(Mod(2,p^2)^((p-1)/2)); (result-plusOrMinus)/p; }


Note, PrimeGrid's WW search is about small primes, up to 19 digits. So it is instantaneous to check one such prime with the above functions.

If you want to use these function with titanic prime, you should remove the first line in all the multiline functions (the line that checks the sanity of the argument p). That is because isprime is slow; you should check primality with another tool if the candidates are huge.

/JeppeSN

Message boards : Wieferich and Wall-Sun-Sun Prime Search : Check a WW find with PARI/GP

[Return to PrimeGrid main page]
DNS Powered by DNSEXIT.COM
Copyright © 2005 - 2022 Rytis Slatkevičius (contact) and PrimeGrid community. Server load 1.32, 0.90, 1.07
Generated 28 Jan 2022 | 6:30:48 UTC