OFFSET
1,1
COMMENTS
Erase a comma if the last digit of previous term and first digit of the following term have opposite parity.
LINKS
Michael De Vlieger, Log log scatterplot of a(n), n = 1..10^5, showing even terms in red.
EXAMPLE
1213 is in the sequence. We can check by looking at where 12 and 13 appear in the list of natural numbers {..., 11, 12, 13, 14, ...}. The digits that flank the comma in the pair (11,12) are {1,1}, which have the same parity, so we keep the comma between 11 and 12. This gives {..., <--11, 12-->, ...} [the <-- --> arrows indicate the possibility of more digits to the left and right. Note that 1011 is also a member.]. Checking the flanking digits in the pair (12,13), we see that {2,1} have opposite parity, so the comma is deleted there to give {..., <--11, 1213-->, ...}. We must keep checking additional pairs to the right until we find a comma. (13,14) has flanking digits {3,1} with the same parity, so no comma is deleted. Now we see that 1213 is a member, since {..., <--11, 1213, 14-->, ...}.
MATHEMATICA
nn = 103; j = {0}; Reap[Do[Set[k, IntegerDigits[n]]; If[Mod[Last[j], 2] != Mod[First[k], 2], j = Join[j, k], Sow[FromDigits[j]]; j = k], {n, nn}]][[-1, 1]] (* Michael De Vlieger, Nov 24 2023 *)
CROSSREFS
KEYWORD
AUTHOR
Wesley Ivan Hurt, Nov 24 2023
STATUS
approved