This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A369127 #42 Mar 12 2024 23:43:59 %S A369127 0,1,2,3,4,5,6,7,8,9,11,101,111,202,121,131,141,151,22,303,212,161, %T A369127 222,171,181,33,191,313,44,414,515,55,616,232,242,323,404,333,252,717, %U A369127 262,818,66,919,272,282,292,1001,77,1111,1221,88,1331,343,353,1441,99 %N A369127 S is a "boomerang sequence". Replace each digit d of S by a base-10 palindrome not yet used that contains d: the sequence S remains identical to itself if we follow each palindrome with a comma. %H A369127 Michael S. Branicky, <a href="/A369127/b369127.txt">Table of n, a(n) for n = 1..10000</a> %e A369127 As a(1) to a(10) are single-digit palindromes, the replacement leaves the terms a(1) to a(10) as they were. %e A369127 a(11) = 11 and we must replace the first digit d = 1 of 11 by the smallest base-10 palindrome not yet used; this is 11 (as the palindrome 1 has been used before); %e A369127 a(11) = 11 and we must replace now the second digit d = 1 of 11 by the smallest base-10 palindrome not yet used; this is 101 (as 1 and 11 have been used before); %e A369127 a(12) = 101 and we must replace the first digit d = 1 of 101 by the smallest base-10 palindrome not yet used; this is 111; %e A369127 a(12) = 101 and we must now replace the digit d = 0 of 101 by the smallest base-10 palindrome not yet used; this is 202 (as 0 and 101 have been used before); %e A369127 a(12) = 101 and we must now replace the last digit d = 1 of 101 by the smallest base-10 palindrome not yet used; this is 121; etc. %o A369127 (Python) %o A369127 from collections import deque %o A369127 from itertools import count, islice %o A369127 def pals(start=1): # generator of palindromes >= palindrome start %o A369127 s = str(start) %o A369127 q, r = divmod(len(s)+1, 2) %o A369127 for d in count(q): %o A369127 olst = [1, 0][int(d==q and r==1):] %o A369127 for offset in olst: %o A369127 lb = max(1, 10**(d-1)) if d>q or offset!=olst[0] else int(s[:q]) %o A369127 for i in range(lb, 10**d): %o A369127 left = str(i) %o A369127 yield int(left+left[::-1][offset:]) %o A369127 def agen(): # generator of terms %o A369127 S = deque([101]) %o A369127 head = list(range(10)) + [11] %o A369127 yield from head %o A369127 used = set(head) | {101} %o A369127 pstart = {d:0 for d in "0123456789"} %o A369127 while True: %o A369127 an = S.popleft() %o A369127 yield an %o A369127 for d in str(an): %o A369127 p = next(p for p in pals(start=pstart[d]) if p not in used and d in str(p)) %o A369127 pstart[d] = p %o A369127 S.append(p) %o A369127 used.add(p) %o A369127 print(list(islice(agen(), 57))) # _Michael S. Branicky_, Mar 03 2024 %Y A369127 Cf. A002113, A369603, A369604, A369823, A369824, A369798. %K A369127 base,nonn %O A369127 1,3 %A A369127 _Eric Angelini_, Mar 02 2024 %E A369127 More terms from _Michael S. Branicky_, Mar 03 2024