- There are
Numguys - The sum of their ages is
Tot - The
Ageof every one of them isMin <= Age <= Max
I want to create a formula for a program to calculate the total number of possibilities
Any ideas/links that point me to the right direction are appreciated
You can map this to the problem of balls in bins with limited capacity by subtracting $\text{Num}\cdot\text{Min}$ from $\text{Tot}$ and then distributing the remainder into $\text{Num}$ bins with equal capacity $\text{Max}-\text{Min}$. The above page gives a formula for the case of equal capacities at the very end, which can be derived using the inclusion–exclusion principle by considering the number of bins filled to capacity.