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.

Original entry on oeis.org

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

Views

Author

Ya-Ping Lu, Nov 30 2021

Keywords

Examples

			41 is a term because iterating the map, m -> m^2, on 41 gives: 41 -> 1681 -> 2825761 -> 7984925229121 -> 63759030914653054346432641, which ends with 41.
		

Crossrefs

Programs

  • 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 *)
  • 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