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.
%I A329267 #25 Dec 07 2019 04:10:52 %S A329267 0,0,0,0,0,0,0,0,0,0,1,0,1,2,3,4,5,5,4,3,2,1,0,1,2,3,4,5,5,4,3,2,1,0, %T A329267 1,2,3,4,5,5,4,3,2,1,0,1,2,3,4,5,5,4,3,2,1,0,1,2,3,4,5,5,4,3,2,1,0,1, %U A329267 2,3,4,5,5,4,3,2,1,0,1,2,3,4,5,5,4,3,2 %N A329267 a(n) is the absolute difference between n and its nearest palindromic neighbor. %C A329267 Empirical observation: this sequence is similar to A261424 but yields the absolute difference between n and its nearest palindromic neighbor. It answers the question "How far from this number is the nearest palindrome?" %H A329267 <a href="/index/Di#distance_to_the_nearest">Index entries for sequences related to distance to nearest element of some set</a> %e A329267 For 0 <= n <= 9, n is palindromic so a(n) = 0. %e A329267 a(10) = 10-9 = 11-10 = 1 (10 is equidistant from its two nearest palindromes). %e A329267 a(11) = 0 because 11 is palindromic. %e A329267 For 12 <= n <= 16, a(n) = n-11 because 11 is the nearest palindromic number. %e A329267 For 17 <= n <= 22, a(n) = 22-n because 22 is the nearest palindromic number. %e A329267 . %e A329267 n nearest palindrome difference %e A329267 -- ------------------ ---------- %e A329267 1 1 1-1 = 0 %e A329267 2 2 2-2 = 0 %e A329267 3 3 3-3 = 0 %e A329267 4 4 4-4 = 0 %e A329267 5 5 5-5 = 0 %e A329267 6 6 6-6 = 0 %e A329267 7 7 7-7 = 0 %e A329267 8 8 8-8 = 0 %e A329267 9 9 9-9 = 0 %e A329267 10 9 or 11 10-9 = 11-10 = 1 %e A329267 11 11 11-11 = 0 %e A329267 12 11 12-11 = 1 %e A329267 13 11 13-11 = 2 %e A329267 14 11 14-11 = 3 %e A329267 15 11 15-11 = 4 %e A329267 16 11 16-11 = 5 %e A329267 17 22 22-17 = 5 %e A329267 18 22 22-18 = 4 %e A329267 19 22 22-19 = 3 %e A329267 20 22 22-20 = 2 %e A329267 21 22 22-21 = 1 %e A329267 22 22 22-22 = 0 %e A329267 23 22 23-22 = 1 %t A329267 palQ[n_] := Block[{d = IntegerDigits[n]}, d == Reverse@ d]; a[n_] := Block[{k=0}, While[! palQ[n+k] && ! palQ[n-k], k++]; k]; Array[a, 121] (* _Giovanni Resta_, Nov 12 2019 *) %o A329267 (PARI) ispal(n) = my (d=digits(n)); d==Vecrev(d) %o A329267 a(n) = for (k=0, oo, if (ispal(n-k) || ispal(n+k), return (k))) \\ _Rémy Sigrist_, Dec 03 2019 %Y A329267 Cf. A261424, A261423. %K A329267 nonn,base %O A329267 0,14 %A A329267 _Christopher J. Shore_, Nov 09 2019