OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..5000
FORMULA
a(n) == n (mod 2).
EXAMPLE
a(6) = 42 = 3 + 3 + 3 + 3 + 3 + 3 + 4 + 4 + 5 + 5 + 6: 12(3), 1(3)2, 21(3), 2(3)1, (3)12, (3)21, 2(4), (4)2, 1(5), (5)1, (6).
MAPLE
b:= proc(n, i, p) option remember; `if`(i*(i+1)/2<n, 0,
`if`(n=0, p!, b(n-i, min(n-i, i-1), p+1)*
`if`(p=0, i, 1)+b(n, i-1, p)))
end:
a:= n-> `if`(n=0, 0, b(n$2, 0)):
seq(a(n), n=0..50);
MATHEMATICA
b[n_, i_, p_] := b[n, i, p] = If[i(i + 1)/2 < n, 0,
If[n == 0, p!, b[n - i, Min[n - i, i - 1], p + 1]*
If[p == 0, i, 1] + b[n, i - 1, p]]];
a[n_] := If[n == 0, 0, b[n, n, 0]];
Table[a[n], {n, 0, 50}] (* Jean-François Alcover, Jul 12 2021, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Aug 07 2020
STATUS
approved