|
|
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
|
|
|
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)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|