login
a(n) is the least positive number k such that applying x->prime(x) n times results in a number that ends in k.
1

%I #18 Apr 20 2021 10:35:08

%S 1,7,6447,7,1,1,69,9,1,1,1,7,1,1

%N a(n) is the least positive number k such that applying x->prime(x) n times results in a number that ends in k.

%e a(1) = 7 since prime(7) = 17 which ends in 7.

%e a(2) = 6447 since prime(prime(6447)) = 806447 which ends in 6447.

%e a(3) = 7 since prime(prime(prime(7)))=277 which ends in 7.

%e a(4) = 1 since prime(prime(prime(prime(1)))) = 11 which ends in 1.

%e a(5) = 1 since prime(prime(prime(prime(prime(1))))) = 31 which ends in 1.

%e a(6) = 69 since prime(prime(prime(prime(prime(prime(69)))))) = 54615469 which ends in 69.

%e a(7) = 9 since prime(prime(prime(prime(prime(prime(prime(9))))))) = 4535189 which ends in 9.

%o (Python)

%o def A343145(n):

%o k = 1

%o while True:

%o m = k

%o for _ in range(n):

%o m = prime(m)

%o if m % 10**(len(str(k))) == k:

%o return k

%o k += 1

%o while not (k % 2 and k % 5):

%o k += 1

%o (PARI) primemap(n, tms) = my(x=n); for(i=1, tms, x=prime(x)); x

%o enddigits(n, len) = ((n/10^len - floor(n/10^len)) * 10^len)

%o a(n) = for(k=1, oo, my(x=k); if(enddigits(primemap(k, n), #Str(k))==k, return(k))) \\ _Felix Fröhlich_, Apr 14 2021

%Y Cf. A046883, A074978, A343128.

%K nonn,hard,base,more

%O 0,2

%A _Chai Wah Wu_, Apr 06 2021