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.

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

This page as a plain text file.
%I A037882 #12 Aug 05 2025 13:58:54
%S A037882 0,0,0,0,0,0,1,2,3,0,0,0,1,2,0,0,0,0,1,0,0,0,0,0,0,1,2,3,4,0,0,1,2,3,
%T A037882 1,1,1,2,3,2,2,2,2,3,3,3,3,3,3,0,1,2,3,4,0,0,1,2,3,0,0,0,1,2,1,1,1,1,
%U A037882 2,2,2,2,2,2,0,1,2,3,4,0,0,1,2,3,0,0,0,1,2,0
%N A037882 a(n)=(1/2)*Sum{|d(i)-e(i)|} where Sum{d(i)*5^i} is the base 5 representation of n and e(i) are the digits d(i) in nondecreasing order.
%C A037882 Starts to differ from A037846 at n=137 = 1022_5. -_R. J. Mathar_, Aug 05 2025
%p A037882 A037882 := proc(n)
%p A037882     local a,dgs,dgsE ;
%p A037882     a := 0 ;
%p A037882     dgs := convert(n,base,5);
%p A037882     dgsE := sort(dgs) ;
%p A037882     for i from 1 to nops(dgs) do
%p A037882         a := a+ abs(op(i,dgs)-op(i,dgsE)) ;
%p A037882     end do:
%p A037882     a/2 ;
%p A037882 end proc: # _R. J. Mathar_, Oct 19 2015
%K A037882 nonn,base
%O A037882 1,8
%A A037882 _Clark Kimberling_
%E A037882 Definition swapped with A037873. - _R. J. Mathar_, Oct 19 2015