OFFSET
1,1
FORMULA
|a(n+1)-a(n)| = 1 for every n.
EXAMPLE
Starting with s = (1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 1, 2, 2, ... ) we form a shifted partial sum array:
(row 1) = (1,2,2,1,1,2,1,2,2,...)
(row 2) = (s(1)+s(2), s(2)+s(3), s(3)+s(4),...) = (3,4,3,2,3,3,3,4,...) = A333229
(row 3) = (s(1)+s(2)+s(3), s(2)+s(3)+s(4), s(3)+s(4)+s(5),...) = (5,5,4,4,4,5,5,5,5,5,5,4,...)
The number of distinct numbers in (row 3) is 2, so a(3) = 2.
The first 12 rows of the shifted partial sum array:
(1, 2), (2, 3, 4), (4, 5), (5, 6, 7), (6, 7, 8, 9), (8, 9, 10), (9, 10, 11, 12), (11, 12, 13), (13, 14), (14, 15, 16), (15, 16, 17, 18), (17, 18, 19). These rows illustrate that fact that the integers in each row are consecutive.
MATHEMATICA
s = Prepend[Nest[Flatten[Partition[#, 2] /. {{2, 2} -> {2, 2, 1, 1}, {2, 1} -> {2, 2, 1}, {1, 2} -> {2, 1, 1}, {1, 1} -> {2, 1}}] &, {2, 2}, 24], 1]; (* A000002 *)
Length[s]
r[1] = s;
r[n_] := r[n] = Rest[r[n - 1]];
c[n_] := c[n] = Take[r[n], 1000];
sum[n_] := Sum[c[k], {k, 1, n}];
t = Table[Union[sum[n]], {n, 1, 100}]
Map[Length, t]
CROSSREFS
KEYWORD
nonn,hard,more,new
AUTHOR
Clark Kimberling, Dec 16 2024
STATUS
approved