A276707 Number of terms of A069090 with exactly n digits.
4, 12, 60, 381, 2522, 19094, 151286, 1237792, 10354144, 88407746, 766869330
Offset: 1
Links
Crossrefs
Cf. A069090.
Programs
-
Maple
A276707 := proc(n) local a,k; a := 0 ; k := nextprime(10^(n-1)) ; while k < 10^n do if isA069090(k) then a := a+1 ; end if; k := nextprime(k) ; end do: a ; end proc: # R. J. Mathar, Dec 15 2016
-
Python
from sympy import primerange, isprime def ok(p): s = str(p) if len(s) == 1: return True return all(not isprime(int(s[:i])) for i in range(1, len(s))) def a(n): return sum(ok(p) for p in primerange(10**(n-1), 10**n)) print([a(n) for n in range(1, 7)]) # Michael S. Branicky, Jul 03 2021
-
Python
# faster version skipping bad prefixes from sympy import isprime, nextprime def a(n): if n == 1: return 4 p, c = nextprime(10**(n-1)), 0 while p < 10**n: s, fail = str(p), False for i in range(1, n): ti = int(s[:i]) if isprime(ti): fail = i; break if fail: p = nextprime((ti+1)*10**(n-i)) else: p, c = nextprime(p), c+1 return c print([a(n) for n in range(1, 8)]) # Michael S. Branicky, Jul 03 2021
Extensions
a(9)-a(11) from Michael S. Branicky, Jul 03 2021
Comments