login
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

%I #23 Apr 29 2022 17:20:48

%S 1,2,3,11,4,22,101,5,111,6,1001,7,88,77,8,1111,9,10001,33,121,131,202,

%T 44,2002,141,212,1221,303,2112,222,3003,232,10101,55,99,555,979,5555,

%U 9779,55555,97779,100001,66,1000001,151,11011,161,11111,171,101101,181

%N 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.

%C First mentioned by Eric Angelini in the 'math-fun' mailing list on Jan 12, 2020.

%C The sequence is infinite because, when all smaller numbers fail, a sufficiently large 10^k+1 will always succeed.

%H Hans Havermann, <a href="/A332661/b332661.txt">Table of n, a(n) for n = 1..461</a>

%H Hans Havermann, <a href="/A332661/a332661.png">Sequence graph using alternately-colored indices</a>

%e 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.

%o (Python)

%o from itertools import count, islice, product

%o def ispal(n): s = str(n); return s == s[::-1]

%o def pals(): # generator of palindromes

%o digits = "0123456789"

%o for d in count(1):

%o for p in product(digits, repeat=d//2):

%o if d > 1 and p[0] == "0": continue

%o left = "".join(p); right = left[::-1]

%o for mid in [[""], digits][d%2]: yield int(left + mid + right)

%o def agen(): # generator of terms

%o an, aset = 1, {0, 1} # 0 is not allowed

%o yield 1

%o while True:

%o for p in pals():

%o if p not in aset and ispal(an*p):

%o an = p; aset.add(an); yield an; break

%o print(list(islice(agen(), 51))) # _Michael S. Branicky_, Apr 29 2022

%Y Cf. A002113 (base-10 palindromes).

%K nonn,base

%O 1,2

%A _Eric Angelini_ and _Hans Havermann_, Feb 18 2020