login
Difference sequence of A256793.
2

%I #6 Apr 14 2015 11:05:12

%S 1,2,3,2,2,3,3,1,2,3,3,2,1,2,3,3,2,2,1,2,3,2,1,2,2,2,1,2,3,2,2,1,2,2,

%T 2,1,2,3,3,1,2,1,2,2,2,1,2,3,2,3,1,2,1,2,2,2,1,2,3,2,2,3,1,2,1,2,2,2,

%U 1,2,3,3,1,2,3,1,2,1,2,2,2,1,2,3,2,1

%N Difference sequence of A256793.

%C These are the numbers of consecutive positive traces when the minimal alternating squares representations for positive integers are written in order. Is every term < 5? The first term greater than 3 is a(116) = 4, corresponding to these 3 consecutive representations:

%C R(225) = 225;

%C R(226) = 256 - 36 + 9 - 4 + 1;

%C R(227) = 256 - 36 + 9 - 4 + 2.

%C (See A256789 for definitions.)

%t b[n_] := n^2; bb = Table[b[n], {n, 0, 1000}]; (* Squares as base *)

%t s[n_] := Table[b[n], {k, 1, 2 n - 1}];

%t h[1] = {1}; h[n_] := Join[h[n - 1], s[n]];

%t g = h[100]; r[0] = {0}; r[1] = {1}; r[2] = {4, -2};

%t r[n_] := If[MemberQ[bb, n], {n}, Join[{g[[n]]}, -r[g[[n]] - n]]];

%t Table[r[n], {n, 0, 120}]; (* A256789 *)

%t u = Flatten[Table[Last[r[n]], {n, 1, 1000}]]; (* A256791 *)

%t u1 = Select[Range[800], u[[#]] > 0 &]; (* A256792 *)

%t u2 = Select[Range[800], u[[#]] < 0 &]; (* A256793 *)

%t Differences[u1] (* A256794 *)

%t Differences[u2] (* A256795 *)

%Y Cf. A256792, A256794.

%K nonn,easy

%O 1,2

%A _Clark Kimberling_, Apr 13 2015