OFFSET
1,10
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..1000
EXAMPLE
a(1) = 1: S={1}, P={}, v=1.
a(2) = 0: no partition of {1,2} satisfies the condition.
a(3) = 1: S={1,2}, P={3}, v=3.
a(10) = 2: three partitions of {1,2,...,10} into S and P satisfy v = Sum_{i:S} i = Product_{k:P} k but there are only two distinct values v: S={2,3,5,6,7,8,9}, P={1,4,10}, v=40; S={4,5,6,8,9,10}, P={1,2,3,7}, v=42; S={1,2,3,4,5,8,9,10}, P={6,7}, v=42.
MAPLE
b:= proc(n, s, p)
`if`(s=p, {s}, `if`(n<1, {}, {b(n-1, s, p)[],
`if`(s-n<p*n, {}, b(n-1, s-n, p*n))[]}))
end:
a:= n-> nops(b(n, n*(n+1)/2, 1)):
seq(a(n), n=1..100);
MATHEMATICA
b[n_, s_, p_] := b[n, s, p] = If[s == p, {s}, If[n < 1, {}, Union[b[n - 1, s, p], If[s - n < p n, {}, b[n - 1, s - n, p n]]]]];
a[n_] := Length[b[n, n(n+1)/2, 1]];
Array[a, 100] (* Jean-François Alcover, Dec 07 2020, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Jun 07 2012
STATUS
approved