OFFSET
2,4
COMMENTS
See A346914 for more information.
LINKS
Paolo Xausa, Table of n, a(n) for n = 2..7813
MATHEMATICA
(* Uses Algorithm O from Knuth's TAOCP section 7.2.1.6 *)
olist[m_] := Block[{p = Range[m] - 1, j, d, k},
Reap[
While[True,
Sow[p];
If[p[[m]] > 0,
p[[m]] = p[[p[[m]]]],
k = m; While[k > 0 && p[[--k]] == 0];
If[k == 0, Break[]];
j = p[[k]]; d = k-- -j;
While[++k <= m, p[[k]] = If[p[[k-d]] == p[[j]], p[[j]], p[[k-d]] + d]]
]]][[2, 1]]];
Flatten[Total[Array[olist, 6], {3}]]
CROSSREFS
KEYWORD
nonn
AUTHOR
Paolo Xausa, May 22 2024
STATUS
approved