login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A365822 List the positive integers but erase commas between terms if the digits just before and just after the comma have the same parity. 2
1, 2, 3, 4, 5, 6, 7, 8, 910, 1112, 1314, 1516, 1718, 19, 2021, 2223, 2425, 2627, 282930, 3132, 3334, 3536, 3738, 39, 4041, 4243, 4445, 4647, 484950, 5152, 5354, 5556, 5758, 59, 6061, 6263, 6465, 6667, 686970, 7172, 7374, 7576, 7778, 79, 8081, 8283, 8485, 8687, 888990, 9192, 9394, 9596, 9798, 99100, 101102 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
Erase a comma if the last digit of previous term and first digit of the following term have the same parity.
LINKS
Michael De Vlieger, Log log scatterplot of a(n), n = 1..10^5, showing even terms in red and odd in dark blue.
EXAMPLE
1112 is in the sequence. We can check by looking at where 11 and 12 appear in the list of natural numbers {..., 10, 11, 12, 13, ...}. The digits that flank the comma in the pair (10,11) are {0,1}, which have opposite parity, so we keep the comma between 10 and 11. This gives {..., <--10, 11-->, ...} [the <-- --> arrows indicate the possibility of more digits to the left and right. Note that 910 is also a member!]. Checking the flanking digits in the pair (11,12), we see that {1,1} have the same parity, so the comma is deleted there to give {..., <--10, 1112-->, ...}. We must keep checking additional pairs to the right until we find a comma. (12,13) has flanking digits {2,1} with opposite parity, so no comma is deleted. Now we see that 1112 is a member, since {..., <--10, 1112, 13-->, ...}.
MATHEMATICA
nn = 120; j = {0}; Rest@ 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 *)
PROG
(Python)
from itertools import count, islice
def agen():
cat = ""
for i in count(1):
s = str(i)
if cat != "" and int(cat[-1])%2 != int(s[0])%2:
yield int(cat)
cat = ""
cat += s
print(list(islice(agen(), 55))) # Michael S. Branicky, Nov 18 2023
CROSSREFS
Cf. A000027, A367595 (opposite parity).
Sequence in context: A029965 A004881 A004892 * A004903 A004914 A243369
KEYWORD
nonn,base,look
AUTHOR
Wesley Ivan Hurt, Nov 12 2023
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 9 15:11 EDT 2024. Contains 375765 sequences. (Running on oeis4.)