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.

A196563 Number of even digits in decimal representation of n.

This page as a plain text file.
%I A196563 #43 Feb 16 2025 01:01:54
%S A196563 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,2,1,2,1,2,1,2,1,2,1,1,0,1,0,
%T A196563 1,0,1,0,1,0,2,1,2,1,2,1,2,1,2,1,1,0,1,0,1,0,1,0,1,0,2,1,2,1,2,1,2,1,
%U A196563 2,1,1,0,1,0,1,0,1,0,1,0,2,1,2,1,2,1
%N A196563 Number of even digits in decimal representation of n.
%H A196563 Reinhard Zumkeller, <a href="/A196563/b196563.txt">Table of n, a(n) for n = 0..10000</a>
%H A196563 Zachary P. Bradshaw and Christophe Vignat, <a href="https://arxiv.org/abs/2307.05565">Dubious Identities: A Visit to the Borwein Zoo</a>, arXiv:2307.05565 [math.HO], 2023.
%F A196563 a(n) = A055642(n) - A196564(n);
%F A196563 a(A014261(n)) = 0; a(A007928(n)) > 0.
%F A196563 From _Hieronymus Fischer_, May 30 2012: (Start)
%F A196563 a(n) = Sum_{j=0..m} (1 + floor(n/(2*10^j)) - floor(n/(2*10^j) + (1/2))), where m=floor(log_10(n)).
%F A196563 a(10*n+k) = a(n) + a(k), 0<=k<10, n>=1.
%F A196563 a(n) = a(floor(n/10))+a(n mod 10), n>=10.
%F A196563 a(n) = Sum_{j=0..m} a(floor(n/10^j) mod 10), n>=0.
%F A196563 a(A014263(n)) = 1 + floor(log_5(n-1)), n>1.
%F A196563 G.f.: g(x) = 1 + (1/(1-x))*Sum_{j>=0} x^(2*10^j)/(1+x^10^j). (End)
%p A196563 A196563 := proc(n)
%p A196563         if n =0 then
%p A196563                 1;
%p A196563         else
%p A196563                 convert(n,base,10) ;
%p A196563                 add(1-(d mod 2),d=%) ;
%p A196563         end if:
%p A196563 end proc: # _R. J. Mathar_, Jul 13 2012
%t A196563 Table[Count[Mod[IntegerDigits[n],2],0][n],{n,0,100}] (* _Zak Seidov_, Oct 13 2015 *)
%t A196563 Table[Count[IntegerDigits[n],_?EvenQ],{n,0,120}] (* _Harvey P. Dale_, Feb 22 2020 *)
%o A196563 (Haskell)
%o A196563 a196563 n = length [d | d <- show n, d `elem` "02468"]
%o A196563 -- _Reinhard Zumkeller_, Feb 22 2012, Oct 04 2011
%o A196563 (PARI) a(n) = #select(x->(!(x%2)), if (n, digits(n), [0])); \\ _Michel Marcus_, Oct 14 2015
%o A196563 (Python)
%o A196563 def a(n): return sum(1 for d in str(n) if d in "02468")
%o A196563 print([a(n) for n in range(100)]) # _Michael S. Branicky_, May 15 2022
%Y A196563 Cf. A014261, A014263, A027868, A046034, A055640, A055641, A055642, A061217, A102669-A102685, A122640, A196564.
%K A196563 nonn,base,easy
%O A196563 0,21
%A A196563 _Reinhard Zumkeller_, Oct 04 2011