OFFSET
1,2
COMMENTS
The sequence S starts with a(1) = 1 and a(2) = 3. S is extended by duplicating the first term A among the not yet duplicated terms, under the condition that the first digit of A and the last digit of the sequence have opposite parities. If this is not the case for A, we then extend the sequence with the smallest integer X not yet present in S whose first digit has the same parity as the last digit of the sequence.
LINKS
Jean-Marc Falcoz, Table of n, a(n) for n = 1..20002
EXAMPLE
After a(1) = 1 and a(2) = 3 we cannot have a(3) = 2 as this 2 would be the first underlined term, which is forbidden (the first underlined term of the sequence must be 1 as we want the underlined terms to rebuild the starting sequence). The same argument forbids a(3) = 4 (the digit 4 and the preceding digit 3, being of opposite parities, would force the term 4 to be the first one to be underlined).
This procedure forces the first 6 terms to be 1, 3, 5, 7, 9 and 10. But now something has changed: the last digit of the sequence is even. We must then duplicate the first term not yet duplicated, which is 1, as this digit 1 and the 0 of 10 have opposite parities. We thus have a(7) = 1, our genuine first underlined term. In the same spirit follow a(8) = 11 and a(9) = 12 which, again, ends the sequence with an even digit, allowing us to duplicate 3: a(10) = 3.
Etc.
CROSSREFS
KEYWORD
AUTHOR
Eric Angelini and Jean-Marc Falcoz, Feb 26 2019
STATUS
approved