# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/
Search: id:a055254
Showing 1-1 of 1
%I A055254 #44 Oct 27 2023 22:00:46
%S A055254 1,0,0,0,1,1,0,1,1,2,1,0,1,2,2,2,3,4,1,1,3,4,3,1,5,5,2,5,3,5,5,3,4,6,
%T A055254 7,7,6,8,5,7,9,8,6,4,6,6,6,8,7,9,6,8,9,9,8,8,11,10,10,7,8,10,7,9,10,
%U A055254 10,7,12,13,13,12,6,7,12,10,15,16,12,12,10,12,13,10,14,14,12,16,13,11,13,12
%N A055254 Number of odd digits in 2^n.
%C A055254 Related sequence b(n) = Number of digits in 2^n that are at least 5. a(0) = 1, b(0) = 0 and a(n+1) = b(n), as a digit with value 5 of higher in 2^n will generate an odd digit in 2^(n+1). In the Nieuw Archief voor Wiskunde link there is a proof that sum(k>=, b(k)/2^k) = 2/9. - _Jaap Spies_, Mar 13 2009
%D A055254 J. Borwein, D. Bailey and R. Girgensohn, Experimentation in mathematics : computational paths to discovery, A. K. Peters, 2004, pp. 14-15.
%H A055254 Seiichi Manyama, Table of n, a(n) for n = 0..10000
%H A055254 D. Bowman and T. White, Proposers, Problem 6609, A rational sum, Amer. Math. Monthly, 98:3 (1991), 279-281.
%H A055254 Nieuw Archief voor Wiskunde, Problemen/UWC, p174-175, June 2004.
%H A055254 Jaap Spies, A Bit of Math, The Art of Problem Solving, Jaap Spies Publishers (2019).
%F A055254 Sum(k>=0,a(k)/2^k)=11/9 (for a proof see the comment above). [Corrected by _Jaap Spies_, Mar 13 2009]
%e A055254 2^30 = 1073741824 and 1073741824 contains 5 odd decimal digits hence a(30)=5.
%p A055254 A055254 := 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 = 1 then j := j+1 fi; n := floor(n/10); od; RETURN(j); end: seq(A055254(n),n=0..110); # _Jaap Spies_
%t A055254 A055254[N_] := Count[ #, True] & /@ Map[OddQ, IntegerDigits /@ (2^# & /@ Range[N])] (* This generates a table of the number of odd digits in the first N powers of two *) (* Douglas Skinner (skinnerd(AT)comcast.net), Dec 06 2007 *)
%t A055254 Table[Count[IntegerDigits[2^n],_?OddQ],{n,0,90}] (* _Harvey P. Dale_, Mar 25 2015 *)
%o A055254 (PARI) a(n)=my(d=digits(2^n)%2);sum(i=1,#d,d[i]) \\ _Charles R Greathouse IV_, Jun 04 2013
%o A055254 (Perl) sub a{my $m;map $m+=1&$_,split //,1<