OFFSET
0,2
COMMENTS
Wu Wei Chao asked in American Mathematical Monthly for a proof that a(n) >= 0 with a(n) = 0 only if n = 0 or n = 3 (see Richard K. Guy reference).
REFERENCES
Richard K. Guy, Unsolved Problems in Number Theory, 3rd Edition, Springer, 2004, Section F24, Some decimal digital problems, p. 398.
EXAMPLE
a(6) = sod(5^6) - sod(2^6) = sod(15625) - sod(64) = (1+5+6+2+5) - (6+4) = 19 - 10 = 9.
MATHEMATICA
a[n_] := Subtract @@ (Plus @@ IntegerDigits[#] & /@ {5^n, 2^n}); Array[a, 100, 0] (* Amiram Eldar, Jul 09 2022 *)
PROG
(PARI) a(n) = sumdigits(5^n) - sumdigits(2^n); \\ Michel Marcus, Jul 09 2022
(Python)
def a(n): return sum(map(int, str(5**n))) - sum(map(int, str(2**n)))
print([a(n) for n in range(66)]) # Michael S. Branicky, Jul 09 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Bernard Schott, Jul 08 2022
STATUS
approved