OFFSET
1,1
COMMENTS
After the digit 9 comes 0 and it repeats.
If k could equal 1, the sequence becomes {171, 1, 1, 4, 1, 2, 1, 2, 13}.
It is interesting that when n is prime, a(n) is prime.
EXAMPLE
78 is not prime. 789 is not prime. 7890 is not prime. 78901 is prime. Thus a(7) = 5 since 78901 is a 5-digit number.
PROG
(Python)
import sympy
from sympy import isprime
def a(n):
num = str(n)
for i in range(n+1, 10**3):
num += str(i%10)
if isprime(int(num)):
return len(num)
n=1
while n < 10:
print(a(n), end=', ')
n+=1
(PARI) a(n) = {s = Str(n); i = n+1; while (1, if (i==10, i = 0); s = concat(s, i); i++; if (isprime(eval(s)), return (length(s))); ); } \\ Michel Marcus, Jun 04 2014
CROSSREFS
KEYWORD
nonn,base,full,fini,changed
AUTHOR
Derek Orr, Jun 02 2014
STATUS
approved