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!)
A355404 Lexicographically earliest sequence of distinct terms such that the concatenation of three successive terms form a palindrome using the alphabet {1, 2}. 1
1, 2, 21, 22, 12, 122, 121, 221, 22121, 22122, 12122, 12122122, 12122121, 22122121, 2212212122121, 2212212122122, 1212212122122, 121221212212212122122, 121221212212212122121, 221221212212212122121, 2212212122122121221212212212122121 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
Also, lexicographically earliest sequence of distinct terms > 0 such that the concatenation of three successive terms form a palindrome in bases >= 3.
a(45) with 1597 digits is the first term > 10^1000.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..44
PROG
(Python)
from itertools import count, islice, product
def pals(digs):
yield from digs
for d in count(2):
for p in product(digs, repeat=d//2):
left = "".join(p)
for mid in [[""], digs][d%2]:
yield left + mid + left[::-1]
def folds(s): # generator of suffixes of palindromes starting with s
for i in range((len(s)+1)//2, len(s)+1):
for mid in [True, False]:
t = s[:i] + (s[:i-1][::-1] if mid else s[:i][::-1])
if t.startswith(s):
yield t[len(s):]
yield from ("".join(p)+s[::-1] for p in pals("12"))
def agen():
s, t, seen = "1", "2", {"1", "2"}
yield from [1, 2]
while True:
for u in folds(s+t):
if len(u) > 0 and u not in seen: break
s, t = t, u
seen.add(u)
yield int(t)
print(list(islice(agen(), 21))) # updated Michael S. Branicky, Aug 09 2022
CROSSREFS
Sequence in context: A320523 A371060 A171549 * A077678 A037309 A037315
KEYWORD
nonn,base
AUTHOR
Michael S. Branicky, Jul 01 2022
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 May 8 12:12 EDT 2024. Contains 372333 sequences. (Running on oeis4.)