%I #13 Jan 19 2018 15:21:20
%S 0,0,0,0,1,0,0,0,0,1,2,0,0,1,1,1,1,0,1,2,0,0,1,0,0,0,0,1,2,1,1,2,2,2,
%T 2,0,1,2,0,0,1,1,1,1,1,2,3,1,1,2,1,1,1,0,1,2,1,1,2,2,2,2,0,1,2,0,0,1,
%U 1,1,1,0,1,2,0,0,1,0,0,0,0,1,2,1,1,2,2,2,2,1
%N Sum{d(i-1)-d(i): d(i)<d(i-1), i=1,...,m}, where Sum{d(i)*3^i: i=0,1,...,m} is base 3 representation of n.
%C This is the base-3 up-variation sequence; see A297330.
%H Clark Kimberling, <a href="/A037844/b037844.txt">Table of n, a(n) for n = 1..10000</a>
%p A037844 := proc(n)
%p a := 0 ;
%p dgs := convert(n,base,3);
%p for i from 2 to nops(dgs) do
%p if op(i,dgs)<op(i-1,dgs) then
%p a := a-op(i,dgs)+op(i-1,dgs) ;
%p end if;
%p end do:
%p a ;
%p end proc: # _R. J. Mathar_, Oct 16 2015
%t g[n_, b_] := Differences[IntegerDigits[n, b]]; b = 3; z = 120;
%t Table[-Total[Select[g[n, b], # < 0 &]], {n, 1, z}]; (*A037853*)
%t Table[Total[Select[g[n, b], # > 0 &]], {n, 1, z}]; (*A037844*)
%Y Cf. A037853, A297330.
%K nonn,base
%O 1,11
%A _Clark Kimberling_
%E Definition corrected by _R. J. Mathar_, Oct 16 2015
%E Updated by _Clark Kimberling_, Jan 18 2018