OFFSET
1,1
COMMENTS
The other digit cannot be 0, 3, 6, or 9, or else the number would not be prime. - N. J. A. Sloane, May 20 2016
LINKS
Dana Jacobsen, Table of n, a(n) for n = 1..2500 (first 1215 terms from Michael De Vlieger and Robert G. Wilson v)
EXAMPLE
a(3) = 7 since 199, 499, 599, 919, 929, 991 and 997 are all the three-digit primes containing two 9's.
MATHEMATICA
f9[n_] := Block[{cnt = k = 0, r = 9 (10^n - 1)/9, s = Range[0, 9] - 9}, While[k < n, cnt += Length@ Select[r + 10^k * s, PrimeQ@ # && IntegerLength@ # > k &]; k++]; cnt]; Array[f9, 100]
PROG
(Python)
from sympy import isprime
def A266148(n):
return sum(1 for d in range(-9, 1) for i in range(n) if isprime(10**n-1+d*10**i)) # Chai Wah Wu, Dec 31 2015
(Perl) use ntheory ":all"; sub a266148 { my $n = shift; vecsum( map { my $k=$_; scalar grep { is_prime("9" x $k . $_ . "9" x ($n-$k-1)) } 0+($k>0) .. 8 } 0 .. $n-1 ); } # Dana Jacobsen, Jan 01 2016
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Michael De Vlieger and Robert G. Wilson v, Dec 21 2015
STATUS
approved