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

%I #9 Nov 15 2020 12:55:18

%S 1,3,5,7,9,11,13,15,17,19,21,2,23,4,25,6,27,8,29,10,31,33,35,37,39,41,

%T 12,43,14,45,16,47,18,20,22,24,26,28,49,30,51,53,55,57,59,61,32,63,34,

%U 65,36,67,38,40,42,44,46,48,69,50,71,73,75,77,79,81,52,83,54,85,56,87,58,60,62,64,66,68,89

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

%C The odd nonnegative integers are present in their natural order. Some even natural integers will never appear.

%e The first even term is a(12) = 2 and there are indeed 2 even digits so far in the sequence (the 2 from 21 and 2 itself);

%e The next even term is a(14) = 4 and there are now 4 even digits so far (2, 2, 2 and 4);

%e The next even term is a(16) = 6 and there are now 6 even digits so far (2, 2, 2, 4, 2 and 6); etc.

%t Block[{a = {0}, c = 0}, Do[Block[{k = 1, s}, While[If[EvenQ[k], Nand[FreeQ[a, k], k == c + Set[s, Total@ DigitCount[k, 10, {0, 2, 4, 6, 8}]]], ! FreeQ[a, k]], k++]; If[EvenQ[k], c += s, c += Total@ DigitCount[k, 10, {0, 2, 4, 6, 8}]]; AppendTo[a, k]], {i, 79}]; a] (* _Michael De Vlieger_, Nov 06 2020 *)

%Y Cf. A338741, A338743, A338744, A338745, A338746 (variants on the same idea), A196563.

%K base,nonn

%O 1,2

%A _Eric Angelini_ and _Carole Dubois_, Nov 06 2020