How many ways are there to split $n$ students into groups of size $x$ OR $y$ ($50$ students into groups of $5$ or $6$)? 
How many ways are there to split $n$ students into groups of size $x$ OR $y$ ($50$ students into groups of $5$ or $6$)?

I understand there might not be an equation in general but is there an algorithm for finding the answer that I could follow?
 A: If you specify how many of each size you want it is easy.
For example, splitting $50$ students into groups of sizes $5,5,5,5,6,6,6,6,6$ can be don in $\dfrac{30!}{5!^4 6!^5 4! 3!}$ ways.
In general if you have $n$ students and you split them into $a$ groups of size $x$ and $b$ groups of size $y$ there are $\frac{n!}{x!^ay!^b b!a!}$ ways to do it.
So one way to solve the problem is to calculate the number of ways for each possible way to add up to $n$ using groups of $x$ and $y$. Luckily the non-negative solutions to $ax+by=n$ can be found easily.
A: First, you need to determine the different ways you can split up the group without leaving anyone out. In your example of 50 people in groups of 5 or 6 there are only two possibilities. I could have 10 groups of 5, or 5 groups of 6 and 4 groups of 5. From there, it's just matter of calculating possible combinations. 
Considering first the 10 groups of 5, there are 50C5 ways to pick the first group, 45C5 ways to choose the second group, 40C5 ways to choose the third, etc. 
Multiplying all these possibilities, we find that there are around 4.9*10^43 ways to choose 10 groups of 5. 
For the second case, involving groups of both 5 and 6, the calculation is very similar. 
(50C5)(45C5)(40C5)(35C5)(30C6)(24C6)(18C6)(12C6)(6C6)= around 7.58*10^41
Note that i could have started with the groups of 6 in my calculation and gotten the same answer. 
The last step is just to add the two combination totals together, giving a final answer of around 5*10^43 possible ways to split up the students. 
