OFFSET
1,1
LINKS
Michael De Vlieger and Robert G. Wilson v, Table of n, a(n) for n = 1..1215
EXAMPLE
a(2) = 8 since 13, 23, 31, 37, 43, 53, 73 and 83 are all primes.
a(3) = 9 since 233, 313, 331, 337, 353, 373, 383, 433 and 733 are all primes.
MATHEMATICA
f3[n_] := Block[{cnt = k = 0, r = 3 (10^n - 1)/9, s = Range[0, 9] - 3}, While[k < n, cnt += Length@ Select[r + 10^k*s, PrimeQ@ # && IntegerLength@ # > k &]; k++]; cnt]; Array[f3, 105]
PROG
(PARI) a(n)={sum(i=0 , n-1, sum(d=i==n-1, 9, isprime((10^n-1)/3 + (d-3)*10^i)))} \\ Andrew Howroyd, Feb 28 2018
(Python)
from __future__ import division
from sympy import isprime
def A266142(n):
return 4*n if (n==1 or n==2) else sum(1 for d in range(-3, 7) for i in range(n) if isprime((10**n-1)//3+d*10**i)) # Chai Wah Wu, Dec 27 2015
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Michael De Vlieger and Robert G. Wilson v, Dec 21 2015
EXTENSIONS
a(2) corrected by Chai Wah Wu, Dec 27 2015
a(2) in b-file corrected as above by Andrew Howroyd, Feb 28 2018
STATUS
approved