cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A349786 Prime numbers p such that iterating the map m -> m^2 on p generates a number ending with p.

This page as a plain text file.
%I A349786 #8 Dec 14 2021 22:18:58
%S A349786 5,41,61,241,281,401,521,601,641,761,881,1201,1361,1601,2081,2161,
%T A349786 2801,3041,3121,3361,3761,4001,4241,4481,4561,4721,4801,5281,5441,
%U A349786 5521,6481,6961,7121,7681,7841,8081,8161,8641,9041,9281,9521,9601,11681,12161,12641
%N A349786 Prime numbers p such that iterating the map m -> m^2 on p generates a number ending with p.
%e A349786 41 is a term because iterating the map, m -> m^2, on 41 gives: 41 -> 1681 -> 2825761 -> 7984925229121 -> 63759030914653054346432641, which ends with 41.
%t A349786 q[n_] := NestWhileList[Mod[#^2, 10^IntegerLength[n]] &, n, UnsameQ, All][[-1]] == n; Select[Range[10^4], PrimeQ[#] && q[#] &] (* _Amiram Eldar_, Nov 30 2021 *)
%o A349786 (Python)
%o A349786 from sympy import nextprime
%o A349786 p0 = 1
%o A349786 while p0 < 13000:
%o A349786     p = nextprime(p0); s = len(str(p)); t = p; L = set()
%o A349786     while t not in L: L.add(t); t = (t*t) % 10**s
%o A349786     if t == p: print(p, end = ', ')
%o A349786     p0 = p
%Y A349786 Cf. A000290, A348339.
%K A349786 nonn,base
%O A349786 1,1
%A A349786 _Ya-Ping Lu_, Nov 30 2021