cp's OEIS Frontend

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.

A368020 Palindromes which are a concatenation of three palindromes, each of which has at least 2 digits.

Original entry on oeis.org

110011, 111111, 112211, 113311, 114411, 115511, 116611, 117711, 118811, 119911, 220022, 221122, 222222, 223322, 224422, 225522, 226622, 227722, 228822, 229922, 330033, 331133, 332233, 333333, 334433, 335533, 336633, 337733, 338833, 339933, 440044, 441144, 442244
Offset: 1

Views

Author

James S. DeArmon, Dec 23 2023

Keywords

Comments

Equivalently, these are palindromes which have a palindromic prefix of length at least 2 and no more than 1 less than half the total length. For example, 7 digit terms have the form (aa)(bcb)(aa) and 8 digit terms are of the form (aa)(bccb)(aa) or (aba)(cc)(aba).

Examples

			110011 is a term since it is a palindrome, and consists of 3 palindromes: (11)(00)(11).
9999999 is a term and its constituent 3 palindromes can be listed in three ways: (99)(999)(99), (999)(99)(99), and (99)(99)(999).
		

Crossrefs

Cf. A002113 (palindromes), A344550.

Programs

  • Python
    # see Link
    
  • Python
    from itertools import count, islice, product
    def pals(d=2): # generator of palindromes with d >=2 digits as strings
        yield from (f+(s:="".join(r))+m+s[::-1]+f for f in "123456789" for r in product("0123456789", repeat=d//2-1) for m in [[""], "0123456789"][d%2])
    def agen(): # generator of terms
        yield from (int("".join(p)) for d in count(6) for p in pals(d) if any((s:=p[:i])==s[::-1] for i in range(2, d//2)))
    print(list(islice(agen(), 33))) # Michael S. Branicky, Jan 23 2024