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.

A338743 When a(n) is odd, a(n) is the number of even digits present so far in the sequence, a(n) included.

This page as a plain text file.
%I A338743 #9 Nov 15 2020 12:55:33
%S A338743 0,1,2,4,3,6,8,5,10,12,7,14,16,9,18,20,22,24,26,28,21,30,23,32,25,34,
%T A338743 27,36,29,38,40,42,44,46,48,41,50,43,52,45,54,47,56,49,58,60,62,64,66,
%U A338743 68,61,70,63,72,65,74,67,76,69,78,80,82,84,86,88,81,90,83,92,85,94,87,96,89,98,100,102,104
%N A338743 When a(n) is odd, a(n) is the number of even digits present so far in the sequence, a(n) included.
%C A338743 The even nonnegative integers are present in their natural order. Some odd natural integers will never appear (11 for instance).
%e A338743 The first odd term is a(2) = 1 and there is indeed 1 even digit so far in the sequence (0);
%e A338743 The next odd term is a(5) = 3 and there are now 3 even digits so far (0, 2 and 4);
%e A338743 The next odd term is a(8) = 5 and there are now 5 even digits so far (0, 2, 4, 6 and 8);
%e A338743 ...
%e A338743 The term a(21) = 21 and there are indeed 21 even digits in the sequence so far (0, 2, 4, 6, 8, 0, 2, 4, 6, 8, 2, 0, 2, 2, 2, 4, 2, 6, 2, 8, 2); etc.
%t A338743 Block[{a = {0}, c = 1}, Do[Block[{k = 1, s}, While[If[OddQ[k], Nand[FreeQ[a, k], k == c + Set[s, Total@DigitCount[k, 10, {0, 2, 4, 6, 8}]]], ! FreeQ[a, k]], k++]; If[OddQ[k], c += s, c += Total@ DigitCount[k, 10, {0, 2, 4, 6, 8}]]; AppendTo[a, k]], {i, 77}]; a] (* _Michael De Vlieger_, Nov 06 2020 *)
%Y A338743 Cf. A338741, A338742, A338744, A338745, A338746 (variants on the same idea), A196563.
%K A338743 base,nonn
%O A338743 1,3
%A A338743 _Eric Angelini_ and _Carole Dubois_, Nov 06 2020