x+y+z+w=n,where x<=w,y<=w. total number of non negative integral solutions of this equation?is there any closed form formula. what is the generalized formula across any number of variables?
1 Answers
Treat n==0 separately, because Reduce doesn't parenthesize it in the same way, and let Reduce find the number of solutions.
Join[{1}, Table[Length[Reduce[x+y+z+w==n && 0<=x<=w && 0<=y<=w && 0<=z<=n &&
0<=w<=n, {x, y, z, w}, Integers]], {n, 1, 12}]]
which returns
{1, 2, 5, 9, 15, 23, 34, 47, 64, 84, 108, 136, 169}
and OEIS almost instantly finds a formula, a generating function, etc.
Mathematica can also find the generating function for you, if you don't need the context and possible connections to prior work.
FindGeneratingFunction[{1, 2, 5, 9, 15, 23, 34, 47, 64, 84, 108, 136, 169}, x]
Attempting to generalize this with one more variable
Join[{1}, Table[Length[Reduce[v+x+y+z+w==n && 0<=v<=w && 0<=x<=w && 0<=y<=w &&
0<=z<=n && 0<=w<=n, {v, x, y, z, w}, Integers]], {n, 1, 12}]]
returns
{1, 2, 6, 13, 24, 41, 67, 102, 150, 213, 294, 396, 523}
but this is not found in the OEIS. FindGeneratingFunction is also unsuccessful.
This perhaps hints that some bright individual might contemplate this, discover some underlying pattern, submit your work to the OEIS and leave a bit of knowledge for those who might follow along behind you. Or it is possible that I have made some mistake or not correctly generalized your question.
- 12,001
- 12
- 13
Mathematicaprogramming I recommend to see this answer Finding the number of solutions to a diophantine equation – Artes Dec 28 '15 at 20:31