cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A358854 Number of even digits necessary to write all the numbers from 0 up to n.

This page as a plain text file.
%I A358854 #22 Feb 19 2023 17:48:00
%S A358854 1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,12,13,15,16,18,19,21,22,24,
%T A358854 25,26,26,27,27,28,28,29,29,30,30,32,33,35,36,38,39,41,42,44,45,46,46,
%U A358854 47,47,48,48,49,49,50,50,52,53,55,56,58,59,61,62,64,65,66,66,67,67,68,68
%N A358854 Number of even digits necessary to write all the numbers from 0 up to n.
%C A358854 Inspired by problem 1 of British Mathematical Olympiad, round 1, in 2016/2017 (link).
%H A358854 Alois P. Heinz, <a href="/A358854/b358854.txt">Table of n, a(n) for n = 0..20000</a>
%H A358854 United Kingdom Mathematics Trust, <a href="https://bmos.ukmt.org.uk/home/bmo1-2017.pdf">2016/17 British Mathematical Olympiad Round 1</a>, Problem 1
%H A358854 <a href="/index/O#Olympiads">Index to sequences related to Olympiads</a>.
%F A358854 a(n) = A117804(n+1) - A279766(n) (number of total digits - number of odd digits).
%F A358854 a(n) = Sum_{k=0..n} A196563(k).
%p A358854 a:= proc(n) option remember; `if`(n<0, 0, a(n-1)+
%p A358854       nops(select(x-> x::even, convert(n, base, 10))))
%p A358854     end:
%p A358854 seq(a(n), n=0..100);  # _Alois P. Heinz_, Feb 19 2023
%t A358854 Accumulate[Table[Count[IntegerDigits[n], _?EvenQ], {n, 0, 100}]] (* _Amiram Eldar_, Dec 03 2022 *)
%o A358854 (Python)
%o A358854 from itertools import accumulate, count, islice
%o A358854 def A196563(n): return sum(1 for d in str(n) if d in "02468")
%o A358854 def agen(): yield from accumulate(A196563(n) for n in count(0))
%o A358854 print(list(islice(agen(), 76))) # _Michael S. Branicky_, Dec 03 2022
%Y A358854 Cf. A117804, A196563, A279766.
%K A358854 nonn,base
%O A358854 0,3
%A A358854 _Bernard Schott_, Dec 03 2022