|
|
A332661
|
|
a(1)=1; a(n+1) is the smallest palindrome not already in the sequence such that the product of a(n+1) and a(n) is also a palindrome.
|
|
1
|
|
|
1, 2, 3, 11, 4, 22, 101, 5, 111, 6, 1001, 7, 88, 77, 8, 1111, 9, 10001, 33, 121, 131, 202, 44, 2002, 141, 212, 1221, 303, 2112, 222, 3003, 232, 10101, 55, 99, 555, 979, 5555, 9779, 55555, 97779, 100001, 66, 1000001, 151, 11011, 161, 11111, 171, 101101, 181
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
First mentioned by Eric Angelini in the 'math-fun' mailing list on Jan 12, 2020.
The sequence is infinite because, when all smaller numbers fail, a sufficiently large 10^k+1 will always succeed.
|
|
LINKS
|
|
|
EXAMPLE
|
a(4) = 11 because the smallest not-yet-used palindromes (4, 5, 6, 7, 8, 9) multiplied by 3 are not base-10 palindromes, but 11*3 is.
|
|
PROG
|
(Python)
from itertools import count, islice, product
def ispal(n): s = str(n); return s == s[::-1]
def pals(): # generator of palindromes
digits = "0123456789"
for d in count(1):
for p in product(digits, repeat=d//2):
if d > 1 and p[0] == "0": continue
left = "".join(p); right = left[::-1]
for mid in [[""], digits][d%2]: yield int(left + mid + right)
def agen(): # generator of terms
an, aset = 1, {0, 1} # 0 is not allowed
yield 1
while True:
for p in pals():
if p not in aset and ispal(an*p):
an = p; aset.add(an); yield an; break
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|