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.

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

This page as a plain text file.
%I A037879 #18 Feb 11 2019 01:42:23
%S A037879 0,0,0,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,2,1,1,1,1,0,1,1,1,0,1,0,0,0,1,1,
%T A037879 2,1,2,2,2,1,1,1,2,1,1,1,1,0,1,1,2,1,1,1,1,0,1,1,1,0,1,0,0,0,1,1,2,1,
%U A037879 2,2,3,1,2,2,2,2,2,2,2,1,1,1,2,1,2,2,2,1,1,1
%N A037879 a(n) = (1/2)*Sum{|d(i)-e(i)|} where Sum{d(i)*2^i} is the base-2 representation of n and {e(i)} are digits {d(i)} in nondecreasing order.
%H A037879 Robert Israel, <a href="/A037879/b037879.txt">Table of n, a(n) for n = 1..10000</a>
%F A037879 a(2*n) = a(n). a(2*n+1) is either a(n) or a(n) + 1. - _Robert Israel_, Feb 08 2019
%p A037879 A037879 := proc(n)
%p A037879         local a,dgs,dgsE ;
%p A037879         a := 0 ;
%p A037879         dgs := convert(n,base,2);
%p A037879         dgsE := sort(dgs) ;
%p A037879         for i from 1 to nops(dgs) do
%p A037879                 a := a+ abs(op(i,dgs)-op(i,dgsE)) ;
%p A037879         end do:
%p A037879         a/2 ;
%p A037879 end proc: # _R. J. Mathar_, Oct 19 2015
%K A037879 nonn,base
%O A037879 1,19
%A A037879 _Clark Kimberling_
%E A037879 Definition swapped with A037870. - _R. J. Mathar_, Oct 19 2015