OFFSET
0,4
COMMENTS
From Bernard Schott, Feb 19 2023: (Start)
Problem 1 of the British Mathematical Olympiad, round 1, in 2016/2017 asked: when the integers 1, 2, 3, ..., 2016 are written down in base 10, how many of the digits in the list are odd? The answer is a(2016) = 4015.
The similar sequence but with number of even digits is A358854. (End)
LINKS
Joseph Myers, Table of n, a(n) for n = 0..1000
United Kingdom Mathematics Trust, 2016/17 British Mathematical Olympiad Round 1, Problem 1.
FORMULA
a(n) = A117804(n+1) - A358854(n) (number of total digits - number of even digits). - Bernard Schott, Feb 19 2023
MAPLE
a:= proc(n) option remember; `if`(n=0, 0, a(n-1)+
nops(select(x-> x::odd, convert(n, base, 10))))
end:
seq(a(n), n=0..100); # Alois P. Heinz, Dec 22 2016
MATHEMATICA
Table[Count[Flatten@ IntegerDigits@ Range[0, n], d_ /; OddQ@ d], {n, 0, 68}] (* or *)
Accumulate@ Table[Count[IntegerDigits@ n, d_ /; OddQ@ d], {n, 0, 68}] (* Michael De Vlieger, Dec 22 2016 *)
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Joseph Myers, Dec 18 2016
STATUS
approved