login
A338741
When a(n) is odd, a(n) is the number of odd digits present so far in the sequence, a(n) included.
6
0, 1, 2, 4, 6, 8, 10, 3, 12, 5, 14, 7, 16, 9, 11, 13, 15, 17, 18, 20, 22, 24, 26, 28, 30, 32, 21, 34, 23, 36, 25, 38, 27, 40, 42, 44, 46, 48, 50, 29, 31, 33, 35, 37, 39, 52, 41, 54, 43, 56, 45, 58, 47, 60, 62, 64, 66, 68, 70, 49, 51, 53, 55, 57, 59, 72, 61, 74, 63, 76, 65, 78, 67, 80, 82, 84, 86, 88, 90, 69
OFFSET
1,3
COMMENTS
The even nonnegative integers are present in their natural order. Some odd natural integers will never appear (19 for instance).
EXAMPLE
The first odd term is a(2) = 1 and there is indeed 1 odd digit so far in the sequence (1 itself);
The next odd term is a(8) = 3 and there are now 3 odd digits so far (1, 1 and 3);
The next odd term is a(10) = 5 and there are now 5 odd digits so far (1, 1, 3, 1 and 5);
...
The next odd term is a(18) = 17 and there are indeed 17 odd digits so far in the sequence (1, 1, 3, 1, 5, 1, 7, 1, 9, 1, 1, 1, 3, 1, 5, 1, 7); etc.
MATHEMATICA
Block[{a = {0}, c = 0}, Do[Block[{k = 1, s}, While[If[OddQ[k], Nand[FreeQ[a, k], k == c + Set[s, Total@ DigitCount[k, 10, {1, 3, 5, 7, 9}]]], ! FreeQ[a, k]], k++]; If[OddQ[k], c += s, c += Total@ DigitCount[k, 10, {1, 3, 5, 7, 9}]]; AppendTo[a, k]], {i, 79}]; a] (* Michael De Vlieger, Nov 06 2020 *)
CROSSREFS
Cf. A338742, A338743, A338744, A338745, A338746 (variants on the same idea), A196564.
Sequence in context: A372144 A357379 A083167 * A115950 A077127 A082191
KEYWORD
base,nonn
AUTHOR
Eric Angelini and Carole Dubois, Nov 06 2020
STATUS
approved