OFFSET
0,10
COMMENTS
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
REFERENCES
J. Borwein, D. Bailey and R. Girgensohn, Experimentation in mathematics : computational paths to discovery, A. K. Peters, 2004, pp. 14-15.
LINKS
Seiichi Manyama, Table of n, a(n) for n = 0..10000
D. Bowman and T. White, Proposers, Problem 6609, A rational sum, Amer. Math. Monthly, 98:3 (1991), 279-281.
Nieuw Archief voor Wiskunde, Problemen/UWC, p174-175, June 2004.
Jaap Spies, A Bit of Math, The Art of Problem Solving, Jaap Spies Publishers (2019).
FORMULA
Sum(k>=0,a(k)/2^k)=11/9 (for a proof see the comment above). [Corrected by Jaap Spies, Mar 13 2009]
EXAMPLE
2^30 = 1073741824 and 1073741824 contains 5 odd decimal digits hence a(30)=5.
MAPLE
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
MATHEMATICA
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 *)
Table[Count[IntegerDigits[2^n], _?OddQ], {n, 0, 90}] (* Harvey P. Dale, Mar 25 2015 *)
PROG
(PARI) a(n)=my(d=digits(2^n)%2); sum(i=1, #d, d[i]) \\ Charles R Greathouse IV, Jun 04 2013
(Perl) sub a{my $m; map $m+=1&$_, split //, 1<<pop; $m}
(Python)
def a(n): return sum(1 for d in str(1<<n) if d in "13579")
print([a(n) for n in range(91)]) # Michael S. Branicky, Dec 23 2022
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Asher Auel, May 05 2000
EXTENSIONS
More terms from Jaap Spies, Dec 30 2003
STATUS
approved