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”).

Number of 2's in first n primes.
1

%I #10 Jun 13 2018 23:09:48

%S 1,1,1,1,1,1,1,1,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,

%T 4,4,4,4,4,4,4,4,4,4,4,4,5,7,9,11,12,13,14,15,16,17,18,19,20,21,22,23,

%U 23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24

%N Number of 2's in first n primes.

%C In the first 10^m (m=3,4,5) primes there are 339, 4070, 55213 2's, among all 3803, 48982, 610484 digits, which gives the frequencies {0.08914, 0.08309, 0.09044}.

%H Robert Israel, <a href="/A121242/b121242.txt">Table of n, a(n) for n = 1..10000</a>

%p ListTools:-PartialSums([seq(numboccur(2,convert(ithprime(i),base,10)),i=1..100)]); # _Robert Israel_, Jun 13 2018

%t Accumulate[DigitCount[Prime[Range[90]],10,2]] (* _Harvey P. Dale_, Nov 09 2013 *)

%Y Cf. A068670 Number of digits in the first n primes.

%Y Partial sums of A085976.

%K base,nonn

%O 1,9

%A _Zak Seidov_, Aug 22 2006