A065582 Smallest prime ending in exactly n 9's.
19, 199, 1999, 49999, 199999, 2999999, 19999999, 799999999, 10999999999, 59999999999, 1099999999999, 34999999999999, 59999999999999, 499999999999999, 14999999999999999, 139999999999999999, 1099999999999999999, 20999999999999999999, 29999999999999999999, 2099999999999999999999
Offset: 1
Links
- Hugo Pfoertner, Table of n, a(n) for n = 1..500 (first 100 terms from Harry J. Smith).
Programs
-
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} ]
-
PARI
a(n)={ my(t=10^n, b=t-1, d=0); while(!isprime(b + t*d), d++; if(d%10==9, d++)); 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
Comments