So I've been kind of obsessed with combinatorics with limited repetitions for a while now, but I recently stumbled on a really elegant solution that uses a generating function to find the number of combinations of $n$ items, choosing $k$, where the $n$ items are split into $m$ groups having $g_1, g_2,...,g_m$ members respectively. I don't really care about what the actual item is, just the group it came from, so it could be thought of as a bunch of different items in discrete groups, or as several different items repeated various numbers of times. Hopefully that made enough sense.
Here's the formula:
$$[x^k]\prod_{i=1}^m\sum_{j=0}^{g_i}x^j$$
What this does is generates functions for each $g_i$ so that the function is equal to $1+x+x^2+...+x^{g_i}$, and multiplies all of those functions together. Then, if you look at the coefficient of $x^k$, you will get the number of combinations. $n$ isn't strictly necessary for the calculation, so it could also just be provided as $n=\sum_{i=1}^mg_i$. I'm not super good at choosing variables, so I apologize if the ones I chose are confusing in any way.
What I really want to be able to do is find a way to expand this to also account for permutations. I wrote a program that did this using partitions, but it's a little unwieldy, and the elegance of the formula above leads me to wonder if there is a nicer formula for permutations as well.
It's not enough to simply multiply by $k!$, sadly. Say we set $n=6$ and $k=3$, and all $g_i=2$. Let's also call the 6 items: A A B B C C. The combinations will include A B C, which does have $k!=6$ unique permutations, but it will also include combinations like A A B, or B C B, which only have $3$ unique permutations. I can describe how I'm using partitions to count them currently if that's helpful, and even before that, I had a third, far slower approach that just did brute force counting, but I'm hoping there's a solution akin to the generating function above that is a bit more concise and easier to see what the formula is doing all at once.
Thanks to anyone and everyone who helps and comments! Even if I can't find a solution, I don't have a whole lot of people to talk to about this stuff, so hopefully someone finds this interesting too!