Find the number of seven digit numbers whose product of digits is $2^43^4$.

One method is to list out all possible sets of seven digits that give this product, and then find number of permutations for each case. But there are too many cases that way.

Is there a shorter method?

  • $\begingroup$ You can limit yourself to digits 1,2,3,6, 4,8,9. You can use 1 as filler to get to 7 digits. $\endgroup$ – Pieter21 Sep 27 '16 at 8:02
  • $\begingroup$ Python script gives $13405$ (for reference). $\endgroup$ – barak manos Sep 27 '16 at 8:52
  • $\begingroup$ @ghosts_in_the_code I confirm the number 13405. See my answer for details $\endgroup$ – Robert Z Sep 27 '16 at 17:54

Split into cases depending on how the twos are distributed:

  1. 3-1-0-0-0-0-0, which can be done in $42$ different ways. For each of those, how many ways can you distribute the threes?
  2. 2-2-0-0-0-0-0, which can be done in $21$ ways. Same question.
  3. 2-1-1-0-0-0-0, a hundred and five ways. I think you get the idea.
  4. Lastly, there are $35$ ways to distribute the twos like 1-1-1-1-0-0-0.

This is somewhat of a pidgeon hole problem.

There are 7 buckets, and you should fill them with factors 2, 3.


  1. all factors 2 and 3 are used
  2. no more than 3 factors 2 in a bucket
  3. no more than 2 factors 3 in a bucket
  4. if 1 factor 3 in a bucket, no more than 1 other factor 2 in the bucket

This should be countable

  • 1
    $\begingroup$ First of all, is finite, so it's countable (poor choice of words on a math forum). Second, you missed that if there are two $3$'s in a bucket, then there are no twos. $\endgroup$ – Arthur Sep 27 '16 at 8:24
  • $\begingroup$ Could you please elaborate how you'll incorporate all the restrictions together? Will you end up making the same number of cases? $\endgroup$ – ghosts_in_the_code Sep 27 '16 at 8:27

I propose to count these numbers with respect to the number of digits 6.

We have five cases: ZERO, ONE, TWO, THREE, FOUR. In the following formulas we place the $6$s then the powers of $2$ (i. e. $2,4,8$) and finally the powers of $3$ (i. e. $3,9$).

If there are ZERO digits 6 then we have $$ \binom{7}{4}\left[\binom{3}{4}+3\binom{3}{3}+\binom{3}{2}\right] +3\binom{7}{3}\left[\binom{4}{4}+3\binom{4}{3}+\binom{4}{2}\right] \\+ 3\binom{7}{2}\left[\binom{5}{4}+3\binom{5}{3}+\binom{5}{2}\right] =5040.$$

If there is ONE digit 6 then we have $$\binom{7}{1} \left[ \binom{6}{3}\left[\binom{3}{3}+2\binom{3}{2}\right] +2\binom{6}{2}\left[\binom{4}{3}+2\binom{4}{2}\right]+ \binom{6}{1}\left[\binom{5}{3}+2\binom{5}{2}\right] \right] =5600.$$

If there are TWO digits 6 then we have $$\binom{7}{2}\left[ \binom{5}{2}\left[\binom{3}{2}+\binom{3}{1}\right] +\binom{5}{1}\left[\binom{4}{2}+\binom{4}{1}\right] \right]=2310.$$

If there are THREE digits 6 then we have $$\binom{7}{3}\binom{4}{1}\binom{3}{1}=420.$$

If there are FOUR digits 6 then we have $$\binom{7}{4}=35.$$

Finally, the total number is $$5040+ 5600+2310+420+35=13405.$$

  • $\begingroup$ @barak manos Finally I got the number. Python wins! $\endgroup$ – Robert Z Sep 27 '16 at 9:24

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.