login
An absolute difference sequence based on A087655: a(n)=If[Mod[A087655(n), 3] == 1, a(n - 1) - (-1)^n*n, a(n - 1) + (-1)^n*n]
1

%I #2 Mar 30 2012 17:34:39

%S 1,0,-2,1,5,10,16,9,17,26,16,5,-7,6,-8,7,23,6,-12,7,-13,8,30,7,31,6,

%T 32,5,33,4,34,3,35,2,-32,-67,-31,-68,-30,-69,-29,12,54,11,55,100,54,

%U 101,149,100,150,99,47,-6,48,-7,-63,-120,-62,-121,-61,-122,-184,-247,-183

%N An absolute difference sequence based on A087655: a(n)=If[Mod[A087655(n), 3] == 1, a(n - 1) - (-1)^n*n, a(n - 1) + (-1)^n*n]

%C Abs[a(n)-a(n-1)]=n

%t (*A087655[n]*)

%t Rauzy[n_Integer?Positive] := Rauzy[n] = Rauzy[ Abs[n - Rauzy[n - 1]]] + Rauzy[Abs[n - Rauzy[n - 2]]] + Rauzy[Abs[n - Rauzy[n - 3]]];

%t Rauzy[0] = Rauzy[1] = Rauzy[2] = Rauzy[3] = 1;

%t a[0] := 1; a[1] := 0;

%t a[n_] := a[n] = If[ Mod[Rauzy[n], 3] == 1, a[n - 1] - (-1)^n*n, a[n - 1] + (-1)^n*n];

%t Table[a[n], {n, 0, 200}]

%K sign,uned

%O 0,3

%A _Roger L. Bagula_, Mar 12 2010