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.

A387199 Numbers which are not themselves palindromes, but a single swap of two digits creates a palindrome.

This page as a plain text file.
%I A387199 #12 Aug 26 2025 22:22:36
%S A387199 110,112,113,114,115,116,117,118,119,122,133,144,155,166,177,188,199,
%T A387199 211,220,221,223,224,225,226,227,228,229,233,244,255,266,277,288,299,
%U A387199 311,322,330,331,332,334,335,336,337,338,339,344,355,366,377,388,399,411,422
%N A387199 Numbers which are not themselves palindromes, but a single swap of two digits creates a palindrome.
%C A387199 Might be called "single-transposition palindromes".
%C A387199 Leading zeros are not allowed in either the initial number or the resultant palindrome.
%H A387199 Michael S. Branicky, <a href="/A387199/b387199.txt">Table of n, a(n) for n = 1..10000</a>
%e A387199 110 is a term since a swap of the second and third digits yields the palindrome 101.
%o A387199 (Python)
%o A387199 def pal(s): return s == s[::-1]
%o A387199 def swaps(s): yield from (t for i in range(len(s)-1) for j in range(i+1, len(s)) if (t:=s[:i]+s[j]+s[i+1:j]+s[i]+s[j+1:])[0]!='0')
%o A387199 def ok(n): return not pal(s:=str(n)) and any(pal(t) for t in swaps(s))
%o A387199 print([k for k in range(425) if ok(k)]) # _Michael S. Branicky_, Aug 22 2025
%Y A387199 Cf. A002113.
%K A387199 nonn,base,new
%O A387199 1,1
%A A387199 _James S. DeArmon_, Aug 21 2025
%E A387199 More terms from _Michael S. Branicky_, Aug 22 2025