cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A085976 Number of 2's in decimal expansion of prime(n).

This page as a plain text file.
%I A085976 #10 Dec 15 2017 17:36:30
%S A085976 1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,
%T A085976 0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,
%U A085976 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0
%N A085976 Number of 2's in decimal expansion of prime(n).
%H A085976 Reinhard Zumkeller, <a href="/A085976/b085976.txt">Table of n, a(n) for n = 1..10000</a>
%e A085976 prime(4) = 7, so a(4)=0 and prime(2490) = 22229, so a(2490)=4.
%t A085976 DigitCount[Prime[Range[110]],10,2] (* _Harvey P. Dale_, Jan 14 2014 *)
%o A085976 (Haskell)
%o A085976 a085976 = count2 0 . a000040 where
%o A085976    count2 c x | d == 2    = if x < 10 then c + 1 else count2 (c + 1) x'
%o A085976               | otherwise = if x < 10 then c else count2 c x'
%o A085976               where (x', d) = divMod x 10
%o A085976 -- _Reinhard Zumkeller_, Apr 08 2014
%Y A085976 Cf. 0's A085974, 1's A085975, 3's A085977, 4's A085978, 5's A085979, 6's A085980, 7's A085981, 8's A085982, 9's A085983.
%K A085976 base,nonn
%O A085976 1,48
%A A085976 _Jason Earls_, Jul 06 2003