What is the number of positive unequal integral solution of the equation $x+y+z+w=20$, if $\,x<y<z<w\,$ and $\,x,y,z,w\ge1\;?$
How to solve this question?
What is the number of positive unequal integral solution of the equation $x+y+z+w=20$, if $\,x<y<z<w\,$ and $\,x,y,z,w\ge1\;?$
How to solve this question?
There are following posible solution:
1,2,3,14 $\,\,\,\,\,\, $ 1,3,4,12, $\,\,\,\,\,\, $ 1,4,5,10 $\,\,\,\,\,\, $ 1,5,6,8
1, 2,4,13 $\,\,\,\,\,\, $ 1,3,5,11 $\,\,\,\,\,\, $ 1,4,6,9
1,2,5,12 $\,\,\,\,\,\, $ 1,3,6,10 $\,\,\,\,\,\, $ 1,4,7,8
1,2,6,11 $\,\,\,\,\,\, $ 1,3,7,9
1,2,7,10
1,2,8,9
So there is 14 $\times $ 3 = 42 if $x=1$
You are looking for the number of partitions of $20$ into $4$ distinct parts.
Putting $x'=x-1$, $y'=y-2$, $z'=z-3$, $w'=w-4$, this is equivalent to looking for the number of integer solutions $0\leq x'\leq y'\leq z'\leq w'$ to $x'+y'+z'+w'=20-10=10$, the number of partitions of $10$ into at most $4$ parts. By transposition of the Young diagram associated to the partition, this is also the number of partitions of $10$ into any number of parts that are at most$~4$. By a direct combinatorial interpretation the latter is the coefficient of $X^{10}$ in the formal power series $$ \frac1{1-X}\times\frac1{1-X^2}\times\frac1{1-X^3}\times\frac1{1-X^4} $$ which if my hand calculation is correct equals $23$.
It looks like a complete list is doable, here it is
w'z'y'x' x,y,z,w
3,3,2,2 3,4,6,7
4,2,2,2 3,4,5,8
3,3,3,1 2,5,6,7
4,3,2,1 2,4,6,8
5,2,2,1 2,4,5,9
4,4,1,1 2,3,7,8
5,3,1,1 2,3,6,9
6,2,1,1 2,3,5,10
7,1,1,1 2,3,4,11
4,3,3,0 1,5,6,8
4,4,2,0 1,4,7,8
5,3,2,0 1,4,6,9
6,2,2,0 1,4,5,10
5,4,1,0 1,3,7,9
6,3,1,0 1,3,6,10
7,2,1,0 1,3,5,11
8,1,1,0 1,3,4,12
5,5,0,0 1,2,8,9
6,4,0,0 1,2,7,10
7,3,0,0 1,2,6,11
8,2,0,0 1,2,5,12
9,1,0,0 1,2,4,13
10,0,0,0 1,2,3,14
For a count of the solutions without restriction on the order by inclusion-exclusion, see this answer. The result is $552$; then the number of ordered solutions is obtained as $\frac{552}{4!}=23$.
It's equivalent to solving $y+z+w=19$ which in turn is equivalent to selecting $19$ elements out of a set of $3$ elements where repetition is allowed. The answer is thus ${n+k-1 \choose k}={21 \choose 3} = 1330$
There is a recursion formula (dynamic programming approach) for this problem. The formula and its derivation are given below. This is easily and efficiently solved on a computer after translating the formula to a programming language of your choice. I used Julia below to get the answer of 37.
We begin the derivation with a simple change of variables. Define integers $x_1 = x - 1$, $x_2 = y - 2$, $x_3 = z - 3$, and $x_4 = w-4$. We are given $1\leq x < y < z < w$. This is equivalent to $0\leq x_1 \leq x_2 \leq x_3 \leq x_4$. When the sum of $x,y,z,w$ is 20, then we see the sum of $x_1, x_2, x_3, x_4$ is 10. So, the question is equivalent to asking the number of ways to sum $x_1,x_2,x_3,x_4$ equal to 10.
For positive integers $m,n,k$, define the function $f(m,n,k)$ to be the number of ways to sum $m$ integers $x_1,x_2,\ldots,x_m$ equal to $n$ with $x_m = k$ and $0 \leq x_1 \leq x_2 \leq \ldots\leq x_m$.
In general if $f$ doesn't make sense for particular values of its arguments, we just set it equal to zero. If every integer is equal to the largest value $k$, then the sum of the integers is $mk$. So, $mk$ must be at least as large as $n$ if there is any hope for the integers to sum to $n$. In situations where $mk$ is less than $n$, we define $f(m,n,k) = 0$. Similarly, we set $f(1,n,k)=0$ when $n\neq k$.
Notice $f(m,n,k)=1$ if $n=k$, since there is only one way to sum integers when the value of the largest integer is equal to the total.
For all other cases we have the following recursive formula: $$ f(m,n,k) = \sum_{j=1}^{\min\{n-k,k\}} f(m-1,n-k,j). $$
This formula follows from the fact that $m>1$ integers, with the largest equal to $k$, will sum to $n$ in the same number of ways $m-1$ integers will sum to $n-k$.
The answer to the original question is equal to the following: $$ \sum_{k=1}^{10} f(4,10,k). $$
Here's how to calculate this in the Julia programming language:
# represents f(m,n,k) for m=2
function f2(n,k)
if k < = n
1
else
0
end
end
# represents f(m,n,k) when m>1
function f(m,n,k)
if m==2
f2(n,k)
else
if k==n
1
elseif k>n
0
else
sum=0
for j=1:min(n-k,k)
sum += f(m-1,n-k,j)
end
sum
end
end
end
# prints the solution
answer = 0
for j=1:10
answer+=f(4,10,j)
end
answer