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 A064834 #29 Apr 03 2020 17:55:09 %S A064834 0,0,0,0,0,0,0,0,0,0,1,0,1,2,3,4,5,6,7,8,2,1,0,1,2,3,4,5,6,7,3,2,1,0, %T A064834 1,2,3,4,5,6,4,3,2,1,0,1,2,3,4,5,5,4,3,2,1,0,1,2,3,4,6,5,4,3,2,1,0,1, %U A064834 2,3,7,6,5,4,3,2,1,0,1,2,8,7,6,5,4,3,2,1,0,1,9,8,7,6,5,4,3,2,1,0,1,0,1,2,3 %N A064834 If n (in base 10) is d_1 d_2 ... d_k then a(n) = Sum_{i = 1..[k/2] } |d_i - d_{k-i+1}|. %C A064834 Might be called the Palindromic Deviation (or PD(n)) of n, since it measures how far n is from being a palindrome. - _W. W. Kokko_, Mar 13 2013 %C A064834 a(A002113(n)) = 0; a(A029742(n)) > 0; A136522(n) = A000007(a(n)). - _Reinhard Zumkeller_, Sep 18 2013 %H A064834 N. J. A. Sloane, <a href="/A064834/b064834.txt">Table of n, a(n) for n = 0..10000</a> %H A064834 <a href="/index/Pac#palindromes">Index entries for sequences related to palindromes</a> %e A064834 a(456) = | 4 - 6 | = 2, a(4567) = | 4 - 7 | + | 5 - 6 | = 4. %p A064834 f:=proc(n) %p A064834 local t1,t2,i; %p A064834 t1:=convert(n,base,10); %p A064834 t2:=nops(t1); %p A064834 add( abs(t1[i]-t1[t2+1-i]),i=1..floor(t2/2) ); %p A064834 end; %p A064834 [seq(f(n),n=0..120)]; # _N. J. A. Sloane_, Mar 24 2013 %t A064834 f[n_] := (k = IntegerDigits[n]; l = Length[k]; Sum[ Abs[ k[[i]] - k[[l - i + 1]]], {i, 1, Floor[l/2] } ] ); Table[ f[n], {n, 0, 100} ] %o A064834 (Haskell) %o A064834 a064834 n = sum $ take (length nds `div` 2) $ %o A064834 map abs $ zipWith (-) nds $ reverse nds %o A064834 where nds = a031298_row n %o A064834 -- _Reinhard Zumkeller_, Sep 18 2013 %o A064834 (Python) %o A064834 from sympy import floor, ceiling %o A064834 def A064834(n): %o A064834 x, y = str(n), 0 %o A064834 lx2 = len(x)/2 %o A064834 for a,b in zip(x[:floor(lx2)],x[:ceiling(lx2)-1:-1]): %o A064834 y += abs(int(a)-int(b)) %o A064834 return y %o A064834 # _Chai Wah Wu_, Aug 09 2014 %Y A064834 Cf. A037904, A040163, A064844. %Y A064834 Cf. A031298, A037888. %K A064834 nonn,base,easy %O A064834 0,14 %A A064834 _N. J. A. Sloane_, Oct 25 2001 %E A064834 More terms from _Vladeta Jovovic_, _Matthew Conroy_ and _Robert G. Wilson v_, Oct 26 2001