OFFSET
1,3
COMMENTS
LINKS
Alois P. Heinz, Rows n = 1..30, flattened
E. D. Demaine, M. L. Demaine, Y. N. Minsky, J. S. B. Mitchell, R. L. Rivest, M. Patrascu, Picture-Hanging Puzzles, arXiv:1203.3602 [cs.DS], 2012-2014.
EXAMPLE
Triangle T(n,k) begins:
1;
1, 2, -1, -2;
1, 2, -1, -2, 3, 2, 1, -2, -1, -3;
1, 2, -1, -2, 3, 4, -3, -4, 2, 1, -2, -1, 4, 3, -4, -3;
MAPLE
r:= s-> seq(-s[-k], k=1..nops(s)):
T:= proc(n) option remember; `if`(n=1, 1, (m->
((x, y)-> [x[], y[], r(x), r(y)][])([T(m)],
map(h-> h+sign(h)*m, [T(n-m)])))(iquo(n+1, 2)))
end:
seq(T(n), n=1..7);
MATHEMATICA
r[s_List] := -Reverse[s];
T[1] = {1}; T[n_] := T[n] = Module[{ m = Quotient[n+1, 2]}, Function[{x, y}, {x, y, r[x], r[y]} // Flatten][T[m], Function[h, h + Sign[h]*m] /@ T[n - m]]];
Table[T[n], {n, 1, 7}] // Flatten (* Jean-François Alcover, Nov 06 2017, after Alois P. Heinz *)
CROSSREFS
KEYWORD
AUTHOR
Alois P. Heinz, Feb 01 2015
STATUS
approved