|
|
A367595
|
|
List the positive integers but erase commas between terms if the digits just before and just after the comma have opposite parity.
|
|
2
|
|
|
123456789, 1011, 1213, 1415, 1617, 181920, 2122, 2324, 2526, 2728, 29, 3031, 3233, 3435, 3637, 383940, 4142, 4344, 4546, 4748, 49, 5051, 5253, 5455, 5657, 585960, 6162, 6364, 6566, 6768, 69, 7071, 7273, 7475, 7677, 787980, 8182, 8384, 8586, 8788, 89, 9091, 9293, 9495, 9697, 9899, 100101, 102103
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
|
|
|
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
|
|
|
STATUS
|
approved
|
|
|
|