OFFSET
1,3
COMMENTS
It takes 6 iterations for a term in the sequence to generate a number ending with the term itself. The numbers in the table below, except for those that begin with 0, are the terms with the numbers of digits (d) up to 10 in which the endings in the six iterations are: m1 -> m2 -> m3 -> m4 -> m5 -> m6 -> m1.
d m1 m2 m3 m4 m5 m6
-- ---------- ---------- ---------- ---------- ---------- ----------
1 0 1 2 5 6 7
2 30 01 02 05 26 77
3 330 901 802 205 026 677
4 4330 8901 7802 1205 2026 4677
5 74330 48901 07802 71205 52026 04677
6 474330 948901 107802 271205 152026 904677
7 0474330 8948901 9107802 7271205 2152026 5904677
8 10474330 88948901 89107802 77271205 22152026 55904677
9 510474330 588948901 989107802 977271205 122152026 455904677
10 6510474330 1588948901 9989107802 9977271205 8122152026 3455904677
PROG
(Python)
for n in range(0, 10**11):
s = len(str(n)); t = n; L = set()
while t not in L:
L.add(t); t = (t*t+1) % 10**s
if t == n: print(n, end = ', ')
(PARI) isok(m) = {my(mm=m); for (i=1, 6, mm = mm^2+1; ); !((mm-m) % 10^(#Str(m))); } \\ Michel Marcus, Feb 16 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Ya-Ping Lu, Dec 15 2021
STATUS
approved