Number of different possibilities including repeats so in one of my math classes, we're learning about counting and using this operation called "n choose k" $\binom{n}{k}=\frac{n!}{k!(n-k)!}$, however this operation does not account for the possibilities of repeats, and answers with repeating variables.
An analogy would be that you want to buy a pizza with the following conditions:


*
  
*up to 3 toppings on each pizza
  
*7 toppings to choose from


The pizza toppings must be unique—double or triple toppings are not allowed. The arrangement of the toppings on each pizza does not matter; e.g., tomatoes on top of
pepperoni is the same as pepperoni on top of tomatoes.
What is the total number of possibilities for a pizza order in this deal?
And we learned that the answer would be $x=\binom{7}{0} + \binom{7}{1} + \binom{7}{2}+\binom{7}{3}=64$.
However, how would you find how many pizzas you could order with double or triple toppings.  So pretty much using this "choose" function, but allowing for those doubles and triples to come up in the count.  I tried this manually, by writing down all the possibilities and I found that the "choose" did not account for a pretty significant amount of doubles and triples.
Ex: $\binom{7}{3}=35$, and when I drew out all the possibilities for lets say the 3 toppings were A, B, C, D, E, F, G.  I found there to be an extra 49 pizzas which could be accounted for (if there are repeated toppings, like AA, BB etc...).
Another Ex: For $\binom{7}{2}=21$, if we draw the two by two table you can see that the diagonal is the only place where two of the same variables meet, and this "choose" function does not account for them.
So essentially my question is, how do you account for these without doing what I did, by manually drawing out all the tables, and physically finding all the possibilities which can have 2 or 3 repeated values? Like is there a mathematical way of finding this?
And to conclude from what I found then there would be a total of $64+49+7+7=127
$ ways to get a pizza with the 2nd condition.  The extra 7 I added in there is intuitively there can only be 7 pizzas which have the same toppings, like AAA, BBB, CCC, DDD, EEE, FFF, GGG.

So for example, if you want to compute the number of ways to choose $3$ toppings out of $7$ not necessarily distinct, and the order in which they are put on the pizza does not matter, here is how you could do it:


*

*Choose three indices $i_1<i_2<i_3$ from $\{1,2,...,9\}$, since $7+3-1=9$.

*Map $i_2\mapsto i_2-1$ and $i_3\mapsto i_3-2$.


Then $i_1\leq i_2\leq i_3$ are chosen from $\{1,2,...,7\}$. This gives you
$$
\binom{9}{3}=84
$$
instead of
$$
\binom73=35
$$
thus accounting for the remaining $84-35=49$ other possibilities where some toppings are equal.
