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.

A037887 a(n)=(1/2)*Sum{|d(i)-e(i)|} where Sum{d(i)*10^i} is the base 10 representation of n and e(i) are the digits d(i) in nondecreasing order.

This page as a plain text file.
%I A037887 #11 Dec 30 2023 16:51:17
%S A037887 0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,0,0,0,1,2,3,4,5,6,7,0,0,0,0,1,
%T A037887 2,3,4,5,6,0,0,0,0,0,1,2,3,4,5,0,0,0,0,0,0,1,2,3,4,0,0,0,0,0,0,0,1,2,
%U A037887 3,0,0,0,0,0,0,0,0,1,2,0,0,0,0,0,0,0,0,0,1,0
%N A037887 a(n)=(1/2)*Sum{|d(i)-e(i)|} where Sum{d(i)*10^i} is the base 10 representation of n and e(i) are the digits d(i) in nondecreasing order.
%p A037887 A037887 := proc(n)
%p A037887     local a,dgs,dgsE ;
%p A037887     a := 0 ;
%p A037887     dgs := convert(n,base,10);
%p A037887     dgsE := sort(dgs) ;
%p A037887     for i from 1 to nops(dgs) do
%p A037887         a := a+ abs(op(i,dgs)-op(i,dgsE)) ;
%p A037887     end do:
%p A037887     a/2 ;
%p A037887 end proc: # _R. J. Mathar_, Oct 19 2015
%K A037887 nonn,base
%O A037887 1,13
%A A037887 _Clark Kimberling_
%E A037887 Definition swapped with A037878. - _R. J. Mathar_, Oct 19 2015