OFFSET
5,1
COMMENTS
Conjecture: the sequence is bounded.
FORMULA
If a(n) > 1 then a(pi(k)) = a(n) - 1 where k = 100*floor(p/10) + p mod 10 and p = prime(n) (i.e., k is the result when a single 0 is inserted to the left of the ones digit of p).
EXAMPLE
For n = 8, prime(8) is 19. 109, 1009, and 10009 are all primes, while 100009 is not, thus a(8) = 4.
For n = 30, prime(30) is 113. 1103 and 11003 are prime, while 110003 is not, thus a(30) = 3.
MATHEMATICA
a[n_] := Module[{p = Prime[n], c = 1, q, r}, r = Mod[p, 10]; q = 10*(p - r); While[PrimeQ[q + r], q *= 10; c++]; c]; Array[a, 100, 5] (* Amiram Eldar, Nov 27 2022 *)
PROG
(Python)
from sympy import isprime, prime
def a(n):
s, c = str(prime(n)), 1
while isprime(int(s[:-1] + '0'*c + s[-1])): c += 1
return c
print([a(n) for n in range(5, 92)]) # Michael S. Branicky, Nov 09 2022
(PARI) a(n) = n=prime(n); for(i=1, oo, isprime(n=10*n-n%10*9) || return(i)); \\ Kevin Ryde, Dec 08 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rida Hamadani, Nov 09 2022
STATUS
approved