OFFSET
0,3
COMMENTS
A way of writing n as a (presumed nonnegative) linear combination of a finite sequence y is any sequence of pairs (k_i,y_i) such that k_i >= 0 and Sum k_i*y_i = n. For example, the pairs ((3,1),(1,1),(1,1),(0,2)) are a way of writing 5 as a linear combination of (1,1,1,2), namely 5 = 3*1 + 1*1 + 1*1 + 0*2. Of course, there are A000041(n) ways to write n as a linear combination of (1..n).
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..500
EXAMPLE
The a(0) = 1 through a(3) = 13 ways:
0 1*1 1*2 1*3
0*1+2*1 0*2+3*1
1*1+1*1 1*2+1*1
2*1+0*1 0*1+0*1+3*1
0*1+1*1+2*1
0*1+2*1+1*1
0*1+3*1+0*1
1*1+0*1+2*1
1*1+1*1+1*1
1*1+2*1+0*1
2*1+0*1+1*1
2*1+1*1+0*1
3*1+0*1+0*1
MAPLE
b:= proc(n, i, m) option remember; `if`(n=0, `if`(m=0, 1, 0),
`if`(i<1, 0, b(n, i-1, m)+add(b(n-i, min(i, n-i), m-i*j), j=0..m/i)))
end:
a:= n-> b(n$3):
seq(a(n), n=0..27); # Alois P. Heinz, Jan 28 2024
MATHEMATICA
combs[n_, y_]:=With[{s=Table[{k, i}, {k, y}, {i, 0, Floor[n/k]}]}, Select[Tuples[s], Total[Times@@@#]==n&]];
Table[Length[Join@@Table[combs[n, ptn], {ptn, IntegerPartitions[n]}]], {n, 0, 5}]
CROSSREFS
KEYWORD
nonn
AUTHOR
Gus Wiseman, Aug 18 2023
EXTENSIONS
a(9)-a(26) from Alois P. Heinz, Jan 28 2024
STATUS
approved