OFFSET
0,3
COMMENTS
Inspired by problem 1 of British Mathematical Olympiad, round 1, in 2016/2017 (link).
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..20000
United Kingdom Mathematics Trust, 2016/17 British Mathematical Olympiad Round 1, Problem 1
FORMULA
MAPLE
a:= proc(n) option remember; `if`(n<0, 0, a(n-1)+
nops(select(x-> x::even, convert(n, base, 10))))
end:
seq(a(n), n=0..100); # Alois P. Heinz, Feb 19 2023
MATHEMATICA
Accumulate[Table[Count[IntegerDigits[n], _?EvenQ], {n, 0, 100}]] (* Amiram Eldar, Dec 03 2022 *)
PROG
(Python)
from itertools import accumulate, count, islice
def A196563(n): return sum(1 for d in str(n) if d in "02468")
def agen(): yield from accumulate(A196563(n) for n in count(0))
print(list(islice(agen(), 76))) # Michael S. Branicky, Dec 03 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Bernard Schott, Dec 03 2022
STATUS
approved