login
Number of primes less than 10^n having at least one digit 5.
7

%I #17 Jul 21 2015 06:10:21

%S 1,3,32,324,3282,31949,309669,2995706,28891689,278270868,2678674624,

%T 25780340194,248131741834,2388797604792

%N Number of primes less than 10^n having at least one digit 5.

%e a(1) = 1 because of the 4 primes less than 10^1, 1 has at least one digit 5.

%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], 5] != {}, c++ ]]; Print[c]; p--, {n, 1, 8}] (* _Robert G. Wilson v_, Feb 02 2004 *)

%t Table[Count[Prime[Range[PrimePi[10^n]]],_?(DigitCount[#,10,5]>0&)],{n,8}] (* _Harvey P. Dale_, Dec 29 2012 *)

%Y a(n) + A091639(n) = A006880(n).

%Y Cf. A091644, A091645, A091646, A091647, A091705, A091707, A091708, A091709, A091710.

%K nonn,base

%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 21 2005

%E a(13) from _Robert Price_, Nov 11 2013

%E a(14) from _Giovanni Resta_, Jul 21 2015