A354155 Lagrange primes: primes p == 1 (mod 4) such that X = (p-1)/2 is the least solution in the interval [1, (p-1)/2] of the congruence (X!)^2 == -1 (mod p).
5, 13, 17, 29, 41, 53, 73, 97, 137, 229, 241, 257, 281, 313, 397, 409, 449, 457, 461, 521, 541, 617, 653, 661, 677, 733, 769, 809, 853, 857, 929, 953, 997, 1021, 1069, 1109, 1201, 1213, 1217, 1249, 1277, 1361, 1373, 1409, 1489, 1553, 1597, 1609, 1621, 1697
Offset: 1
Keywords
References
- J. B. Cosgrave, A Mersenne-Wieferich Odyssey, Manuscript, May 2022. See Section 18.5.
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..3100
Programs
-
PARI
is(n)=if(n%4 != 1 || !isprime(n), return(0)); my(t1=lift(sqrt(Mod(-1,n))), t2=n-t1, t=Mod(1,n)); for(k=2,n\2, if(t==t1 || t==t2, return(0)); t*=k); 1 \\ Charles R Greathouse IV, Aug 03 2023
-
PARI
list(lim)=my(v=List()); forprimestep(p=5,lim\1,4, my(t1=lift(sqrt(Mod(-1,p))),t2=p-t1, t=Mod(1,p)); for(k=2,p\2, if(t==t1 || t==t2, next(2)); t*=k); listput(v,p)); Vec(v) \\ Charles R Greathouse IV, Aug 03 2023
-
Python
from itertools import islice from sympy import factorial, nextprime def agen(): # generator of terms p = 5 while True: X = (p-1)//2 Xf = factorial(X)**2 if all(pow(factorial(Y), 2, p)+1 != p for Y in range(X-1, 0, -1)): yield p p = nextprime(p) while p%4 != 1: p = nextprime(p) print(list(islice(agen(), 5))) # Michael S. Branicky, May 30 2022
Extensions
a(20) and beyond from Michael S. Branicky, May 30 2022