# Digit Product of 10000 (from Brilliant.org)

How many 7 digit positive integers are there such that the product of the individual digits of each number is equal to 10000?

Details and assumptions As an example, 22225555 is an 8 digit integer, whose product of individual digits is 10000.

Note: This is a past question from brilliant.org.

• Hint: $10000 = 2^4 \cdot 5^4$. What can you combine into one digit? (i.e. powers of 2 can combine into one digit, can powers of 5?) Write a set of sequences you need and then compute in how many ways each set can be made to fit 7 digits... – gt6989b Mar 6 '13 at 18:23

$10000=2^45^4$

You need $7$ digits, so only possibility for digits are $(4,2,2,5,5,5,5),(4,4,1,5,5,5,5),(8,2,1,5,5,5,5)$

Now, no. of permutation of this set of digits gives you the required answer = $\frac{7!}{2!4!}+\frac{7!}{2!4!}+\frac{7!}{4!}$

• i just answered 105. but, the answer was incorrect :( – ochapuspita Mar 6 '13 at 18:24
• You overlooked the cases with the digits (1,2,8,5,5,5,5) and (1,4,4,5,5,5,5). – Jakube Mar 6 '13 at 18:32
• i have incorporated all the permutations. Re-read my answer. – Aang Mar 6 '13 at 18:34
• that's right... thank you :)) – ochapuspita Mar 6 '13 at 18:56

$10000 = 10^4 = 2^45^4$. The only way you can get the $5^4$ is by actually having $4$ copies of $5$. Now you need $2^4$, which can be divided to $(4,2,2)$ or $(4,4,1)$ or $(8,2,1)$.

If you select either of $(4,2,2)$ or $(4,4,1)$, the problem is creating a number from seven digits comprised of one set of $4$ identical ones, one set of $2$ identical ones, and another one. The number of ways to do that is $\frac{7!}{4!\cdot 2!}$ (set the order for all of them, then disregard the orders of each repeating digit).

If you select $(8,2,1)$, you get $\frac{7!}{4!}$.

In total, since those are all distinct (they are made of different digits) there are $2\cdot\frac{7!}{4! \cdot 2!} + \frac{7!}{4!} = 2\cdot\frac{7!}{4!} = 420$ numbers.

• o yeah, i see.... thanks a lot. your answer is correct.. it's very useful :) – ochapuspita Mar 6 '13 at 18:29
• Also, telling python len([x for x in xrange(1000000,9999999) if reduce(lambda x,y:x*y, map(int,str(x)))==10000]) gives the answer in 50sec (on my computer) without having to think :) – Alfonso Fernandez Mar 6 '13 at 18:32