login
A359952
Wieferich sequence where a(1) = 2.
0
2, 1093, 5, 20771, 18043, 5, 20771, 18043, 5, 20771, 18043, 5, 20771, 18043, 5, 20771, 18043, 5, 20771, 18043, 5, 20771, 18043, 5, 20771, 18043, 5, 20771, 18043, 5, 20771, 18043, 5, 20771, 18043, 5, 20771, 18043, 5, 20771, 18043, 5, 20771, 18043
OFFSET
1,1
COMMENTS
Starting with a(3), the sequence is periodic with the following cycle, which is a Wieferich triplet: 5, 20771, 18043.
PROG
(Python)
from sympy import nextprime
from gmpy2 import powmod
max_n = 45
a = 2
seq = [a]
for i in range(2, max_n+1):
p = 2
while True:
p_squared = p*p
if powmod(a, p-1, p_squared) == 1 and (a-1) % p_squared != 0 and (a+1) % p_squared != 0:
seq.append(p)
a = p
break
else:
p = nextprime(p)
print(seq)
(PARI) i=0; a=2; print1(a, ", "); while(i<100, forprime(p=2, 10^6, if(Mod(a, p^2)^(p-1)==1 && p%2!=0 && ((a-1) % p^2) && ((a+1) % p^2), print1(p, ", "); i++; a=p; break({n=1})))) \\ Michel Marcus, Jan 21 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert C. Lyons, Jan 19 2023
STATUS
approved