login
A338744
When a(n) is even, a(n) is the number of odd digits present so far in the sequence, a(n) included.
6
0, 1, 3, 2, 5, 7, 4, 9, 11, 13, 10, 15, 17, 19, 21, 18, 23, 25, 20, 27, 29, 22, 31, 24, 33, 26, 35, 28, 37, 39, 41, 34, 43, 36, 45, 38, 47, 49, 40, 51, 42, 53, 44, 55, 46, 57, 48, 59, 61, 52, 63, 54, 65, 56, 67, 58, 69, 71, 73, 75, 77, 79, 70, 81, 72, 83, 74, 85, 76, 87, 78, 89, 91, 93, 95, 97, 99, 90, 101
OFFSET
1,3
COMMENTS
The odd nonnegative integers are present in their natural order. Some even natural integers will never appear (6 for instance).
EXAMPLE
The first even term is a(1) = 0 and there is indeed 0 odd digit so far in the sequence;
The next even term is a(4) = 2 and there are now 2 odd digits so far (1 and 3);
The next even term is a(7) = 4 and there are now 4 odd digits so far (1, 3, 5 and 7);
...
The even term a(11) = 10 and there are indeed 10 odd digits in the sequence so far (1, 3, 5, 7, 9, 1, 1, 1, 3 and 1); 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, {1, 3, 5, 7, 9}]]], ! FreeQ[a, k]], k++]; If[EvenQ[k], c += s, c += Total@ DigitCount[k, 10, {1, 3, 5, 7, 9}]]; AppendTo[a, k]], {i, 78}]; a] (* Michael De Vlieger, Nov 06 2020 *)
CROSSREFS
Cf. A338741, A338742, A338743, A338745, A338746 (variants on the same idea), A196564.
Sequence in context: A276684 A105353 A115966 * A338745 A203602 A249559
KEYWORD
base,nonn
AUTHOR
Eric Angelini and Carole Dubois, Nov 06 2020
STATUS
approved