A119295 Total number of 4's digits in the first 10^n primes.
0, 27, 311, 3919, 47647, 628061, 7098709, 79587350, 888504625, 10169426048, 110936566287, 1199775766812
Offset: 1
Examples
At a(2)=27 there are 27 4's digits in the first 10^2 primes.
Programs
-
Maple
A119295 := proc(n) option remember: local k,s,lim: if(n=0)then return 0:fi: lim:=10^n: s:=procname(n-1): for k from 10^(n-1)+1 to lim do s:=s+nops([SearchAll("4",convert(ithprime(k),string))]): od: return s: end: seq(A119295(n),n=1..4); # Nathaniel Johnston, May 09 2011
-
Mathematica
Accumulate@Table[c = 0; For[i = 10^(n - 1) + 1, i <= 10^n, i++, c += Count[IntegerDigits[Prime[i]], 4]]; c, {n, 6}] (* Robert Price, Jun 09 2019 *)
Extensions
Offset changed from 0 to 1 by Nathaniel Johnston, May 09 2011
a(8)-a(11) from Robert Price, Nov 05 2013
a(12) from Marek Hubal, Mar 04 2019