login
A349786
Prime numbers p such that iterating the map m -> m^2 on p generates a number ending with p.
1
5, 41, 61, 241, 281, 401, 521, 601, 641, 761, 881, 1201, 1361, 1601, 2081, 2161, 2801, 3041, 3121, 3361, 3761, 4001, 4241, 4481, 4561, 4721, 4801, 5281, 5441, 5521, 6481, 6961, 7121, 7681, 7841, 8081, 8161, 8641, 9041, 9281, 9521, 9601, 11681, 12161, 12641
OFFSET
1,1
EXAMPLE
41 is a term because iterating the map, m -> m^2, on 41 gives: 41 -> 1681 -> 2825761 -> 7984925229121 -> 63759030914653054346432641, which ends with 41.
MATHEMATICA
q[n_] := NestWhileList[Mod[#^2, 10^IntegerLength[n]] &, n, UnsameQ, All][[-1]] == n; Select[Range[10^4], PrimeQ[#] && q[#] &] (* Amiram Eldar, Nov 30 2021 *)
PROG
(Python)
from sympy import nextprime
p0 = 1
while p0 < 13000:
p = nextprime(p0); s = len(str(p)); t = p; L = set()
while t not in L: L.add(t); t = (t*t) % 10**s
if t == p: print(p, end = ', ')
p0 = p
CROSSREFS
Sequence in context: A106963 A276916 A203018 * A199692 A031917 A139846
KEYWORD
nonn,base
AUTHOR
Ya-Ping Lu, Nov 30 2021
STATUS
approved