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 A037878 #8 Oct 19 2015 14:33:43 %S A037878 0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0,3,2,1,0,0, %T A037878 0,0,0,0,0,4,3,2,1,0,0,0,0,0,0,5,4,3,2,1,0,0,0,0,0,6,5,4,3,2,1,0,0,0, %U A037878 0,7,6,5,4,3,2,1,0,0,0,8,7,6,5,4,3,2,1,0,0,9 %N A037878 (1/2)*Sum{|d(i)-e(i)|}, where Sum{d(i)*10^i} is base 10 representation of n and e(i) are digits d(i) in nonincreasing order, for i=0,1,...,m. %p A037878 A037878 := proc(n) %p A037878 local a,dgs,dgsE ; %p A037878 a := 0 ; %p A037878 dgs := convert(n,base,10); %p A037878 dgsE := sort(dgs,`>`) ; %p A037878 for i from 1 to nops(dgs) do %p A037878 a := a+ abs(op(i,dgs)-op(i,dgsE)) ; %p A037878 end do: %p A037878 a/2 ; %p A037878 end proc: # _R. J. Mathar_, Oct 19 2015 %K A037878 nonn,base %O A037878 1,20 %A A037878 _Clark Kimberling_ %E A037878 Definition swapped with A037887. - _R. J. Mathar_, Oct 19 2015