I want to calculate the amount of permutations of 4 numbers between the first 12 natural numbers, whose sum is 26. I first thought using $${}^{12}\!P_{4}=\frac{12!}{(12-4)!}=11880$$ but it also counts the permutations that don't add up to 26. How can I do that?
Edit:
As said in the comments, I want to calculate the amount of possible values of $A$, $B$, $C$ and $D$ in this system:
$$A+B+C+D=26$$$$\{A,B,C,D\}\in\mathbb{N}$$$$A< B< C< D\leq12$$
We want to construct the number 26 in exactly 4 ways using ONLY the numbers from 1 to 12. This is called a Restricted 4-Composition of 26, with the restriction that the 4 numbers must be from 1 to 12. In general we can find any sequence of natural numbers from a to b, upto n such that we make n with any combination and length k.
Since you want permutations, we want all the ordered partitions. So using the closed form formula for C(n,k,1,b) where $n=26$, $k=4$ and $b=12$, we find:
$$C(n,k,1,b)=\sum_{j=0}^{\lfloor \frac {n-k}{b}\rfloor}(-1)^j{k \choose j}{n-bj-1 \choose k-1}$$
$$=\sum_{j=0}^{\lfloor \frac {26-4}{12}\rfloor=1}(-1)^j{4 \choose j}{26-12j-1 \choose 4-1}=(-1)^0{4 \choose 0}{26-1 \choose 3}+(-1)^1{4 \choose 1}{26-12-1 \choose 3}$$
$$={4 \choose 0}{25 \choose 3}-{4 \choose 1}{13 \choose 3}=1156$$
So there are 1156 ordered ways of creating the number 26 in exactly 4 summands with the numbers 1 to 12.
The formula I used comes from formula (E): https://www.fq.math.ca/Scanned/14-5/abramson.pdf. It relies on inclusion-exclusion principles.
Please let me know if I can clarify!