%I #10 Jan 20 2018 11:11:39
%S 0,0,1,0,1,2,1,0,1,2,3,1,0,1,3,2,1,2,3,4,2,1,2,2,1,0,1,2,3,3,2,3,5,4,
%T 3,1,2,3,1,0,1,3,2,1,3,4,5,3,2,3,3,2,1,2,3,4,4,3,4,6,5,4,2,3,4,2,1,2,
%U 4,3,2,2,3,4,2,1,2,2,1,0,1,2,3,3,2,3,5,4,3,3
%N Sum{|d(i)-d(i-1)|: i=0,1,...,m}, where Sum{d(i)*3^i: i=0,1,...,m} is base 3 representation of n.
%C This is the base-3 total variation sequence; see A297330. - _Clark Kimberling_
%H Clark Kimberling, <a href="/A037835/b037835.txt">Table of n, a(n) for n = 1..10000</a>
%p A037835 := proc(n)
%p local dgs ;
%p dgs := convert(n,base,3);
%p add( abs(op(i,dgs)-op(i-1,dgs)),i=2..nops(dgs)) ;
%p end proc: # _R. J. Mathar_, Oct 16 2015
%t b = 3; z = 120; t = Table[Total@Flatten@Map[Abs@Differences@# &, Partition[IntegerDigits[n, b], 2, 1]], {n, z}] (* cf. Michael De Vlieger, A037834 *)
%Y Cf. A297330.
%K nonn,base
%O 1,6
%A _Clark Kimberling_
%E Updated by _Clark Kimberling_, Jan 19 2018
|