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.

A037845 a(n) = Sum_{i=1..m, d(i) d(i-1)-d(i), where Sum_{i=0..m} d(i)*4^i is the base 4 representation of n.

This page as a plain text file.
%I A037845 #15 Oct 24 2015 11:44:58
%S A037845 0,0,0,0,0,1,2,0,0,0,1,0,0,0,0,0,1,2,3,0,0,1,2,1,1,1,2,2,2,2,2,0,1,2,
%T A037845 3,0,0,1,2,0,0,0,1,1,1,1,1,0,1,2,3,0,0,1,2,0,0,0,1,0,0,0,0,0,1,2,3,1,
%U A037845 1,2,3,2,2,2,3,3,3,3,3,0,1,2,3,0,0,1,2,1,1,1
%N A037845 a(n) = Sum_{i=1..m, d(i)<d(i-1)} d(i-1)-d(i), where Sum_{i=0..m} d(i)*4^i is the base 4 representation of n.
%H A037845 Clark Kimberling, <a href="/A037845/b037845.txt">Table of n, a(n) for n = 1..10000</a>
%p A037845 A037845 := proc(n)
%p A037845     a := 0 ;
%p A037845     dgs := convert(n,base,4);
%p A037845     for i from 2 to nops(dgs) do
%p A037845         if op(i,dgs)<op(i-1,dgs) then
%p A037845             a := a-op(i,dgs)+op(i-1,dgs) ;
%p A037845         end if;
%p A037845     end do:
%p A037845     a ;
%p A037845 end proc: # _R. J. Mathar_, Oct 19 2015
%t A037845 d[n_] := d[n] = Differences[RealDigits[n, 4][[1]]]
%t A037845 Table[Total[Select[d[n], # > 0 &]], {n, 1, z}];  (* A037845 *)
%t A037845 -Table[Total[Select[d[n], # < 0 &]], {n, 1, z}]; (* A037854 *)
%t A037845 (* _Clark Kimberling_, Oct 20 2015 *)
%K A037845 nonn,base
%O A037845 1,7
%A A037845 _Clark Kimberling_
%E A037845 Definition swapped with A037854. - _R. J. Mathar_, Oct 19 2015