[go: up one dir, main page]

login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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
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
Cf. A000027, A365822 (same parity).
Sequence in context: A172917 A068247 A224780 * A277057 A180408 A050289
KEYWORD
nonn,base,look
AUTHOR
Wesley Ivan Hurt, Nov 24 2023
STATUS
approved