A243294 Least number k > 1 such that a number composed of k consecutive ascending digits starting with n is prime.
171, 2, 179, 4, 29, 2, 5, 2, 13
Offset: 1
Examples
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.
Crossrefs
Cf. A120821.
Programs
-
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
-
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
Comments