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.

  • 1
    $\begingroup$ 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... $\endgroup$ – gt6989b Mar 6 '13 at 18:23


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!}$

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

  • $\begingroup$ o yeah, i see.... thanks a lot. your answer is correct.. it's very useful :) $\endgroup$ – ochapuspita Mar 6 '13 at 18:29
  • $\begingroup$ 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 :) $\endgroup$ – Alfonso Fernandez Mar 6 '13 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.