# Calculating combinations within constraints

Building out a web dev portfolio. For a web app I am working with lottery probabilities.

How many combinations are there if I only choose combinations within observed maximum and minimum values? Here are the stats:

The lottery I'm starting with is Mega Millions. 5 numbers drawn and not replaced from 1-75, with a sixth number chosen from 1-15.

C(75,5) * 15 = 258,890,850 combinations


My attempt is:

All combinations within maximums observed.
( 43 * (64-1) * (68-2) * (74-3) * (75-4) ) / 5! * 15 = 112,662,569.25

Less combinations below minimums observed.
( (3-1) * (8-2) * (20-3) * (23-4) ) / 4! = 161.5

Combinations within maximum & minimum limits = 112,662,407


Is there a better approach to calculating the number of combinations within constraints?

Your first calculation of the total number of combinations is close but may not be correct. I would guess that the sixth number cannot match any of the first five. In that case, you need to multiply first draws that have one number $1-15$ by $14$, those that have two by $13$, etc. Easier is to pick the sixth number first, then pick the rest from the remaining $74$, so there are $15 {74 \choose 5}$ possibilities.
Similarly, the calculation you want to do is made difficult by the interactions between the numbers. If the lowest number is $43$ there are many fewer choices for the others. It is going to be a mess