Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #17 Sep 14 2022 21:45:56
%S 1,9,3,7,5,8,2,11,4,6,22,88,44,66,77,33,99,55,101,909,111,191,121,181,
%T 131,171,141,161,151,252,262,242,272,232,282,222,292,212,393,313,494,
%U 323,383,333,373,343,363,353,454,464,444,474,434,484,424
%N Lexicographic earliest sequence of distinct palindromes (A002113) such that a(n)+a(n+1) is never palindromic.
%C Obviously the sequence cannot contain 0.
%C It is easy to prove that the sequence is a permutation of the nonzero palindromes (in the sense that it contains each of them exactly once).
%H Eric Angelini, <a href="http://cinquantesignes.blogspot.com/2022/09/sums-with-palindromes.html">Sums with palindromes</a>, personal blog "Cinquante signes" on blogspot.com, and post to the math-fun list, Sep 12 2022
%o (PARI) A357044_first(n, U=[0], a=9)={vector(n,k, k=U[1]; while(is_A002113(a+k=A262038(k+1)) || setsearch(U, k), ); U=setunion(U,[a=k]); while(#U>1 && U[2]==A262038(U[1]+1), U=U[^1]); a)}
%o (Python)
%o from itertools import count, islice
%o def ispal(n): s = str(n); return s == s[::-1]
%o def nextpal(p): # next largest palindrome after palindrome p
%o d = str(p)
%o if set(d) == {'9'}: return int('1' + '0'*(len(d)-1) + '1')
%o h = str(int(d[:(len(d)+1)//2]) + 1)
%o return int(h + h[:-1][::-1]) if len(d)&1 else int(h + h[::-1])
%o def agen():
%o aset, pal, minpal = {1}, 1, 2
%o while True:
%o an = pal; yield an; aset.add(an); pal = minpal
%o while pal in aset or ispal(an+pal): pal = nextpal(pal)
%o while minpal in aset: minpal = nextpal(minpal)
%o print(list(islice(agen(), 55))) # _Michael S. Branicky_, Sep 14 2022
%Y Cf. A002113 (palindromes), A029742 (non-palindromes), A262038 (next palindrome), A357045 (non-palindromes with palindromic sum of neighbors).
%K nonn,base
%O 1,2
%A _Eric Angelini_ and _M. F. Hasler_, Sep 14 2022