login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A254861
Number of primes less than 10^n that do not contain the string n.
0
0, 4, 22, 102, 903, 6310, 46706, 266823, 2774348, 16531372, 419285780, 3698719206, 33962823012
OFFSET
0,2
EXAMPLE
When n = 1, there are four primes less than 10: 2, 3, 5, and 7. None of these have 1 as a digit so a(1) = 4.
MATHEMATICA
f[n_] := Block[{i}, Flatten@ Map[Length, Last@ Reap@ For[i = 0, i <= n, i++, Sow@ Select[Range[10^i], PrimeQ@ # && DigitCount[#][[i]] == 0 &]], {2}]]; f@ 7 (* Michael De Vlieger, Mar 26 2015 *)
PROG
(Sage) [len([p for p in prime_range(10^n) if not(str(n) in str(p))]) for n in [1..9]] # Tom Edgar, Feb 17 2015
(Python)
from sympy import primerange
def a(n):
target = str(n)
return sum(1 for p in primerange(1, 10**n) if target not in str(p))
print([a(n) for n in range(7)]) # Michael S. Branicky, Oct 30 2022
CROSSREFS
Cf. A006880.
Sequence in context: A366759 A007901 A368289 * A088581 A017970 A220740
KEYWORD
nonn,base,more
AUTHOR
Asa Kaplan, Feb 09 2015
EXTENSIONS
a(7)-a(9) from Tom Edgar, Feb 17 2015
a(10) from Michael S. Branicky, Oct 30 2022
a(11) from Michael S. Branicky, Jun 01 2023
a(12) from Michael S. Branicky, Jul 06 2023
STATUS
approved