How many $5$-digit numbers can be made from digits in the number $75226522$?

I'm having troubles with this one:

How many $5$-digit numbers can be made from digits in the number $75226522$ ?

So there is: one seven, one six, two fives, and four twos in that number.

So I guess I need to use combination with repetition but I'm having trouble with understanding this.

I know how many $8$-digit numbers there are: $$\frac{8!}{4!2!}$$ But I'm clueless in $5$-digit case

• Hint: Looks like you need to choose any 5 digits from that number, and each time you take one of the digits you are not replacing it. Aug 9, 2016 at 10:35
• I would start off with numbers with 4 2's in them, then numbers with 3 2's (can also have 2 5's is a special case), then numbers with 2 x 2's, then 1 , then zero
– Cato
Aug 9, 2016 at 10:42
• 4 2's is 3 choices of 5th number, 5 ways of arranging them, 3 x 5 = 15
– Cato
Aug 9, 2016 at 10:48
• 3 2's + 2 5's = 5!/2!/3!
– Cato
Aug 9, 2016 at 10:52

• The number of ways to rearrange $\color\red{2222}\color\green{ 5}\color\orange{ }\color\lightblue{ }$, which is $\frac{5!}{\color\red{4!}\color\green{1!}\color\orange{ }\color\lightblue{ }}= 5$
• The number of ways to rearrange $\color\red{2222}\color\green{ }\color\orange{6}\color\lightblue{ }$, which is $\frac{5!}{\color\red{4!}\color\green{ }\color\orange{1!}\color\lightblue{ }}= 5$
• The number of ways to rearrange $\color\red{2222}\color\green{ }\color\orange{ }\color\lightblue{7}$, which is $\frac{5!}{\color\red{4!}\color\green{ }\color\orange{ }\color\lightblue{1!}}= 5$
• The number of ways to rearrange $\color\red{ 222}\color\green{55}\color\orange{ }\color\lightblue{ }$, which is $\frac{5!}{\color\red{3!}\color\green{2!}\color\orange{ }\color\lightblue{ }}=10$
• The number of ways to rearrange $\color\red{ 222}\color\green{ 5}\color\orange{6}\color\lightblue{ }$, which is $\frac{5!}{\color\red{3!}\color\green{1!}\color\orange{1!}\color\lightblue{ }}=20$
• The number of ways to rearrange $\color\red{ 222}\color\green{ 5}\color\orange{ }\color\lightblue{7}$, which is $\frac{5!}{\color\red{3!}\color\green{1!}\color\orange{ }\color\lightblue{1!}}=20$
• The number of ways to rearrange $\color\red{ 222}\color\green{ }\color\orange{6}\color\lightblue{7}$, which is $\frac{5!}{\color\red{3!}\color\green{ }\color\orange{1!}\color\lightblue{1!}}=20$
• The number of ways to rearrange $\color\red{ 22}\color\green{55}\color\orange{6}\color\lightblue{ }$, which is $\frac{5!}{\color\red{2!}\color\green{2!}\color\orange{1!}\color\lightblue{ }}=30$
• The number of ways to rearrange $\color\red{ 22}\color\green{55}\color\orange{ }\color\lightblue{7}$, which is $\frac{5!}{\color\red{2!}\color\green{2!}\color\orange{ }\color\lightblue{1!}}=30$
• The number of ways to rearrange $\color\red{ 22}\color\green{ 5}\color\orange{6}\color\lightblue{7}$, which is $\frac{5!}{\color\red{2!}\color\green{1!}\color\orange{1!}\color\lightblue{1!}}=60$
• The number of ways to rearrange $\color\red{ 2}\color\green{55}\color\orange{6}\color\lightblue{7}$, which is $\frac{5!}{\color\red{1!}\color\green{2!}\color\orange{1!}\color\lightblue{1!}}=60$

Hence the total number of ways is $5+5+5+10+20+20+20+30+30+60+60=265$.

Number with no 5's, so either three or four 2's: $$\frac{5!}{3!} + 2 \times \frac{5!}{4!}.$$ Number with one 5, so either two, three, or four 2's: $$\frac{5!}{2!} + 2 \times \frac{5!}{3!} + \frac{5!}{4!}.$$ Number with two 5's, so either one, two, or three 2's: $$\frac{5!}{2!} + 2 \times \frac{5!}{2! 2!} + \frac{5!}{2! 3!}.$$ Now adding these three numbers together should give the right result.

• For the situation where there are no 5s and three 2s, I think it should be 4!/2! ? Aug 9, 2016 at 10:57
• Why so? We're still permuting 5 digits... Aug 9, 2016 at 10:58
• Is there a generic solution for this type of problem. Or it is always about considering different cases ? Aug 9, 2016 at 11:00
• Not one I'm aware of. It would certainly become painful with too many more repeated digits, but you can at least be systematic about breaking into cases. Aug 9, 2016 at 11:01
• @Mr.Chip Never mind, I made a mistake. Aug 9, 2016 at 11:02