login
A338742
When a(n) is even, a(n) is the number of even digits present so far in the sequence, a(n) included.
6
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, 12, 43, 14, 45, 16, 47, 18, 20, 22, 24, 26, 28, 49, 30, 51, 53, 55, 57, 59, 61, 32, 63, 34, 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
OFFSET
1,2
COMMENTS
The odd nonnegative integers are present in their natural order. Some even natural integers will never appear.
EXAMPLE
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);
The next even term is a(14) = 4 and there are now 4 even digits so far (2, 2, 2 and 4);
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.
MATHEMATICA
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 *)
CROSSREFS
Cf. A338741, A338743, A338744, A338745, A338746 (variants on the same idea), A196563.
Sequence in context: A356929 A187349 A238704 * A251238 A059547 A064719
KEYWORD
base,nonn
AUTHOR
Eric Angelini and Carole Dubois, Nov 06 2020
STATUS
approved