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 A083122 #16 Aug 10 2022 07:40:05 %S A083122 1,21,2,12,121,1121,211,112,1211,11121,2111,1112,12111,111121,21111, %T A083122 11112,121111,1111121,211111,111112,1211111,11111121,2111111,1111112, %U A083122 12111111,111111121,21111111,11111112,121111111,1111111121,211111111,111111112,1211111111 %N A083122 a(1) = 1, then the smallest number not included earlier and not a string of 1's such that the concatenation a(n), a(n+1) is a palindrome. %C A083122 Starting with a(7), follows the pattern 21^k, 1^k2, 121^k, 1^(k+1)21, 2(1)^(k+1), ..., for k >= 2, where ^ represents repeated concatenation. - _Michael S. Branicky_, Aug 09 2022 %o A083122 (Python) %o A083122 from itertools import count, islice, product %o A083122 def pals(digs): %o A083122 yield from digs %o A083122 for d in count(2): %o A083122 for p in product(digs, repeat=d//2): %o A083122 left = "".join(p) %o A083122 for mid in [[""], digs][d%2]: %o A083122 yield left + mid + left[::-1] %o A083122 def folds(s): # generator of suffixes of palindromes starting with s %o A083122 for i in range((len(s)+1)//2, len(s)+1): %o A083122 for mid in [True, False]: %o A083122 t = s[:i] + (s[:i-1][::-1] if mid else s[:i][::-1]) %o A083122 if t.startswith(s): %o A083122 yield t[len(s):] %o A083122 yield from ("".join(p)+s[::-1] for p in pals("12")) %o A083122 def agen(): %o A083122 s, seen = "1", {"1"}; yield 1 %o A083122 while True: %o A083122 for t in folds(s): %o A083122 if len(t) > 0 and set(t) != {"1"} and t not in seen: break %o A083122 s = t; seen.add(t); yield int(t) %o A083122 print(list(islice(agen(), 33))) # _Michael S. Branicky_, Aug 09 2022 %K A083122 base,nonn %O A083122 1,2 %A A083122 _Amarnath Murthy_ and Meenakshi Srikanth (menakan_s(AT)yahoo.com), Apr 23 2003 %E A083122 Corrected and extended by _Ray G. Opao_, Sep 22 2005 %E A083122 a(18) and beyond from _Michael S. Branicky_, Aug 09 2022