%I #22 Mar 21 2023 06:12:31
%S 1,21,1121,1211121,2111211211121,112112111212111211211121,
%T 12111212111211211121112112111212111211211121,
%U 211121121112111211211121211121121112112111212111211211121112112111212111211211121
%N a(1) = 1; a(n) is the second smallest number k such that k > a(n-1) and concatenation of a(1), ..., a(n-1), k is a palindrome.
%C Conjecture: Length A055642(a(n)) = A000073(n+2), and A305393 is a sequence of digits in the concatenation of all terms in this sequence.
%e For n = 3 concatenation of the previous terms is 121. Numbers that would make it a palindrome if concatenated to it are 121, 1121, ... and the second smallest of them is a(3) = 1121.
%o (Python)
%o pal = lambda s: s == s[::-1]
%o up_to = 10
%o terms = [1, ]
%o for i in range(up_to-1):
%o c, r = ''.join(map(str, terms)), 0
%o for j in range(len(str(terms[-1])), len(c)+1):
%o found, p = False, int(c[:j][::-1])
%o if p > terms[-1] and pal(c + c[:j][::-1]):
%o r+=1
%o if r == 2:
%o terms.append(p);found = True;break
%o if found: continue
%o j = 0
%o while 1:
%o j+=1
%o r+=1
%o if r == 2:
%o terms.append(int(str(j) + c[::-1]))
%o break
%o print(terms)
%Y Cf. A000073, A002275, A055642, A083122, A305393.
%K nonn,base
%O 1,2
%A _Gleb Ivanov_, Sep 23 2022