TITLE: Count the numbers in which the product of the digits is 48 (1 not allowed)
QUESTION [5 upvotes]: Count the numbers in which the product of the digits is 48 (1 not allowed as digit).

Proposed solution: I addressed the problem by brute force, first noticing that
$$48=2^4\times 3.$$
Then I found the possible groups of digits to be permuted for each number: (1) 2,2,2,2,3; (2) 2,2,2,6; (3) 4,2,2,3; (4) 4,2,6; (5) 4,4,3; (6) 8,2,3; (7) 8,6.
By adding the permutations with repetition for each case, I've found 38 possible numbers. Which agrees with the answer provided in the source.
My problem: I found this solution is not elegant and I'm wondering if there is a better way to address problems like these. By brute force it is easy to undercount terms (as I did as first solving the problem). Any help?

REPLY [3 votes]: There isn't a much better way, no. There are better ways for calculating the number of ordered factorizations but those will include factorizations with factors that aren't single digits.
If $a_n = $ the number of ordered factorizations of $n$ then we have two identities:

$a_n = \sum a_d$ over all factors $d$ of $n$ not including $d = n$.
$a_{p^k} = 2^{k - 1}$ when $p$ is a prime.

See http://oeis.org/A074206 for references/additional formulae/etc.
So using this we have
\begin{align}
a_{48} &= a_1 + a_2 + a_3 + a_4 + a_6 + a_8 + a_{12} + a_{16} + a_{24} \\
&= 1 + 1 + 1 + 2 + a_6 + 4 + a_{12} + 8 + a_{24} \\
&= 17 + a_6 + a_{12} + a_{24} \\
&= 17 + (a_1 + a_2 + a_3) + ([a_1 + a_2 + a_3] + a_4 + a_6) \\
&\quad\qquad+ ([a_1 + a_2 + a_3 + a_4 + a_6] + a_8 + a_{12}) \\
&= 17 + 3 + (3 + 2 + 3) + (8 + 4 + 8) \\
&= 48
\end{align}
So there are 48 total ordered factorizations. But we know this is overcounting because it includes factorizations which are permutations of $2,24$ and $2,2,12$ and $4,12$ and $3,16$. So that's an additional $2 + 3 + 2 + 2 = 10$.
So there are $48 - 10 = 38$ ordered factorizations where no factor is larger than $9$.
Was this easier than calculating the number $38$ directly? Probably not. But hopefully it's still useful to someone.