OFFSET
1,1
COMMENTS
From Jeppe Stig Nielsen, Jul 30 2022: (Start)
Can decrease, for example a(25) < a(24). So not the same as Smallest prime ending in n or more 9s.
a(n) can contain other 9s as well, for example a(46), a(118), a(156). (End)
LINKS
Hugo Pfoertner, Table of n, a(n) for n = 1..500 (first 100 terms from Harry J. Smith).
MATHEMATICA
Do[a = Table[9, {n} ]; k = 0; While[ b = FromDigits[ Join[ IntegerDigits[k], a]]; Mod[k, 10] == 9 || !PrimeQ[b], k++ ]; Print[b], {n, 1, 17} ]
pe9[n_]:=Module[{k=1, rh=FromDigits[PadRight[{}, n, 9]]}, While[!PrimeQ[ k 10^n+rh], k++]; k 10^n+rh]; Array[pe9, 20] (* Harvey P. Dale, Mar 26 2012 *)
PROG
(PARI) { for (n=1, 100, t=10^n; b=t - 1; d=0; while(!isprime(b + t*d), d++; if (d%10==9, d++)); write("b065582.txt", n, " ", b + t*d) ) } \\ Harry J. Smith, Oct 23 2009
(Python)
from sympy import isprime
def a(n):
pow, end, i = 10**n, 10**n-1, 1
while i%10 == 9 or not isprime(i*pow + end): i += 1
return i*pow + end
print([a(n) for n in range(1, 20)]) # Michael S. Branicky, Jul 30 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Robert G. Wilson v, Nov 28 2001
STATUS
approved