OFFSET
1,1
LINKS
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
PROG
(perl/tcsh) "bzcat A069090.b.txt.bz2 | perl -anle 'print length($F[1])' | sort | uniq -c" with https://github.com/barrycarter/bcapps/blob/master/QUORA/A069090.b.txt.bz2
(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
CROSSREFS
KEYWORD
nonn,base,more
AUTHOR
Barry Carter, Sep 15 2016
EXTENSIONS
a(9)-a(11) from Michael S. Branicky, Jul 03 2021
STATUS
approved