This is from a math olympiad:
The product of the digits of positive integer $n$ is $20$, and the sum of the digits is $12$. What is the smallest possible value of $n$?
I started with the prime factors of $20 = 2*2*5$.
Then tried to sum them up — $2+2+5\neq12$ so started adding $1$s to the summation, since it wouldn't affect the product.
and so, I come up with:
$2+2+5+1+1=12$ to make it equal to $12$
Hence, arranging the digits in ascending order, we get the least $n = 111225$.
Is this too childish an approach? Is there any better way to go about this?
This is too long for a comment.
So, I'm writing here. This is not a solution. I think your solution is not childish at all. Since it's a competition type problem, no one should expect a super elegant solution for such a problem. I am rephrasing for your solution.
First of all, it's impossible to have such a single-digit number. So, we begin our journey with a $2$ digits number. There are only $2$ two digits numbers whose product of digits is $20$ namely, $45$ and $54.$ The sum of the digits of these numbers is $9$. So, we place some $1$s at the left side of $45$ until we get a number whose digits add up to $12.$ This gives the number $11145.$ Since we're looking for smallest such number we did not choose $54.$
Note that you started with a $3$ digits number namely $225.$ That's why you had a bigger number. I wish someone writes some cool solutions. Thanks!