cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A357044 Lexicographic earliest sequence of distinct palindromes (A002113) such that a(n)+a(n+1) is never palindromic.

This page as a plain text file.
%I A357044 #21 Dec 21 2024 20:35:54
%S A357044 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 A357044 131,171,141,161,151,252,262,242,272,232,282,222,292,212,393,313,494,
%U A357044 323,383,333,373,343,363,353,454,464,444,474,434,484,424
%N A357044 Lexicographic earliest sequence of distinct palindromes (A002113) such that a(n)+a(n+1) is never palindromic.
%C A357044 Obviously the sequence cannot contain 0.
%C A357044 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 A357044 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
%H A357044 Eric Angelini, <a href="/A357044/a357044.pdf">Sums with palindromes</a>, personal blog "Cinquante signes" on blogspot.com, and post to the math-fun list, Sep 12 2022 [Cached copy]
%o A357044 (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 A357044 (Python)
%o A357044 from itertools import count, islice
%o A357044 def ispal(n): s = str(n); return s == s[::-1]
%o A357044 def nextpal(p): # next largest palindrome after palindrome p
%o A357044     d = str(p)
%o A357044     if set(d) == {'9'}: return int('1' + '0'*(len(d)-1) + '1')
%o A357044     h = str(int(d[:(len(d)+1)//2]) + 1)
%o A357044     return int(h + h[:-1][::-1]) if len(d)&1 else int(h + h[::-1])
%o A357044 def agen():
%o A357044     aset, pal, minpal = {1}, 1, 2
%o A357044     while True:
%o A357044         an = pal; yield an; aset.add(an); pal = minpal
%o A357044         while pal in aset or ispal(an+pal): pal = nextpal(pal)
%o A357044         while minpal in aset: minpal = nextpal(minpal)
%o A357044 print(list(islice(agen(), 55))) # _Michael S. Branicky_, Sep 14 2022
%Y A357044 Cf. A002113 (palindromes), A029742 (non-palindromes), A262038 (next palindrome), A357045 (non-palindromes with palindromic sum of neighbors).
%K A357044 nonn,base
%O A357044 1,2
%A A357044 _Eric Angelini_ and _M. F. Hasler_, Sep 14 2022