login
A055253
Number of even digits in 2^n.
5
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, 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, 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
OFFSET
0,7
LINKS
MAPLE
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
MATHEMATICA
Table[Length@ Select[IntegerDigits[2^n], EvenQ], {n, 0, 120}] (* or *)
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 *)
Count[IntegerDigits[#], _?EvenQ]&/@(2^Range[0, 100]) (* Harvey P. Dale, Mar 25 2020 *)
PROG
(PARI) a(n) = #select(x->(x % 2) == 0, digits(2^n)); \\ Michel Marcus, May 01 2016
(Python)
def a(n): return sum(1 for d in str(1<<n) if d in "02468")
print([a(n) for n in range(91)]) # Michael S. Branicky, Dec 23 2022
CROSSREFS
Sequence in context: A352682 A374578 A361639 * A103626 A238224 A026268
KEYWORD
nonn,base,easy
AUTHOR
Asher Auel, May 05 2000
EXTENSIONS
More terms from Jaap Spies, Dec 30 2003
STATUS
approved