Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #21 Apr 24 2021 03:07:05
%S 0,2,27,314,3217,31699,308774,2987107,28824402,277779084,2674980022,
%T 25752370493,247919235555,2387154761520
%N Number of primes less than 10^n having at least one digit 8.
%e a(2) = 2 because of the 25 primes less than 10^2, 2 have at least one digit 8.
%t NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; c = 0; p = 1; Do[ While[ p = NextPrim[p]; p < 10^n, If[ Position[ IntegerDigits[p], 8] != {}, c++ ]]; Print[c]; p--, {n, 1, 8}] (* _Robert G. Wilson v_, Feb 02 2004 *)
%o (Python)
%o from sympy import sieve # use slower primerange for larger terms
%o def a(n): return sum('8' in str(p) for p in sieve.primerange(2, 10**n))
%o print([a(n) for n in range(1, 8)]) # _Michael S. Branicky_, Apr 23 2021
%Y a(n) + A091642(n) = A006880(n).
%Y Cf. A091644, A091645, A091646, A091647, A090705, A090706, A091707, A091708, A091710.
%K nonn,base,more
%O 1,2
%A _Enoch Haga_, Jan 30 2004
%E Edited and extended by _Robert G. Wilson v_, Feb 02 2004
%E 3 more terms from _Ryan Propper_, Aug 22 2005
%E a(13) from _Robert Price_, Nov 11 2013
%E a(14) from _Giovanni Resta_, Jul 21 2015