%I #11 Feb 18 2022 23:07:33
%S 2,5,7,677,948901,55904677,88948901,
%T 36414201356422028396069993813455904677,
%U 8964456980291877636414201356422028396069993813455904677,711873588184178964456980291877636414201356422028396069993813455904677
%N Prime numbers p such that iterating the map m -> m^2 + 1 on p generates a number ending with p.
%C Primes in A350130. All terms, except the first two terms, end with either 1 or 7.
%C It takes six iterations for a term in the sequence to generate a number ending with the term itself.
%C If two terms, a(i) and a(j) with i < j, share the same last digit of 1 or 7, then a(j) ends with a(i). For example, a(5)=948901, a(7)=88948901, and a(11)=8941500847661758065828477233177642295842210081239701539110201588948901. a(11) ends with a(7), which ends with a(5).
%e 2 is a term because 2 is a prime and iterating the map on 2 gives: 2 -> 5 -> 26 -> 677 -> 458330 -> 210066388901 -> 44127887745906175987802, which ends with 2.
%o (Python)
%o from sympy import isprime; R = []
%o for i in range(1, 100):
%o m = 1; L = [m]; m = (m*m+1)%10**i
%o while m not in L: L.append(m); m = (m*m+1)%10**i
%o del L[:L.index(m)]; {R.append(j) for j in L if isprime(j) and j not in R}
%o R.sort(); print(*R, sep = ", ")
%Y Cf. A002522, A066872, A349786, A350130.
%K nonn,base
%O 1,1
%A _Ya-Ping Lu_, Jan 07 2022
|