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.

A055253 Number of even digits in 2^n.

This page as a plain text file.
%I A055253 #24 Oct 27 2023 22:00:46
%S A055253 0,1,1,1,1,1,2,2,2,1,3,4,3,2,3,3,2,2,5,5,4,3,4,6,3,3,6,4,6,4,5,7,6,4,
%T A055253 4,4,5,4,7,5,4,5,7,9,8,8,8,7,8,6,10,8,7,7,9,9,6,8,8,11,11,9,12,10,10,
%U A055253 10,13,9,8,8,10,16,15,10,13,8,7,12,12,14,13,12,15,11,12,14,10,14,16,14,16
%N A055253 Number of even digits in 2^n.
%H A055253 Seiichi Manyama, <a href="/A055253/b055253.txt">Table of n, a(n) for n = 0..10000</a>
%p A055253 A055253 := proc(val) local i, j, k, n; n := 2^val; j := 0; k := floor(ln(n)/ln(10))+1; for i from 1 to k do if (n mod 10) mod 2 = 0 then j := j+1 fi; n := floor(n/10); od; RETURN(j); end: seq(A055253(n),n=0..110); # _Jaap Spies_, Dec 30 2003
%t A055253 Table[Length@ Select[IntegerDigits[2^n], EvenQ], {n, 0, 120}] (* or *)
%t A055253 Table[Total@ Pick[DigitCount[2^n], {0, 1, 0, 1, 0, 1, 0, 1, 0, 1}, 1], {n, 0, 120}] (* _Michael De Vlieger_, May 01 2016 *)
%t A055253 Count[IntegerDigits[#],_?EvenQ]&/@(2^Range[0,100]) (* _Harvey P. Dale_, Mar 25 2020 *)
%o A055253 (PARI) a(n) = #select(x->(x % 2) == 0, digits(2^n)); \\ _Michel Marcus_, May 01 2016
%o A055253 (Python)
%o A055253 def a(n): return sum(1 for d in str(1<<n) if d in "02468")
%o A055253 print([a(n) for n in range(91)]) # _Michael S. Branicky_, Dec 23 2022
%Y A055253 Cf. A055254, A034887.
%K A055253 nonn,base,easy
%O A055253 0,7
%A A055253 _Asher Auel_, May 05 2000
%E A055253 More terms from _Jaap Spies_, Dec 30 2003