A five-digit number $N$ is equal to $45$ times the product of its $5$ digits. Find $N$.

Please help. I am not sure how to solve this. I have a feeling it is simple


Let the digits of $n$ from left to right be $a,b,c,d$, and $e$, so that we’re told that


Clearly $n$ is a multiple of $5$, so $e$ is either $0$ or $5$. But obviously none of the digits is $0$, so $e=5$, and $(1)$ becomes


or, after dividing through by $5$,


The lefthand side of $(2)$ is odd, so all of $a,b,c$, and $d$ must be odd as well. The one’s digit of $$2\left(10^3a+10^2b+10c+d\right)+1$$ is either $2d+1$ or $2d+1-10=2d-9$, depending on whether $d<5$ or not. However, the number in $(2)$ is an odd multiple of $5$, so its one’s digit is $5$, and either $2d+1=5$ or $2d-9=5$. Since $d$ is known to be odd, the former is impossible, $d=7$, and $(2)$ becomes


or, after another division by $5$,


Reduce $(3)$ modulo $9$ to see that $$4\left(10^2a+10b+c\right)\equiv 6\pmod 9$$ and hence $10^2a+10b+c\equiv6\pmod9$, which further implies that $a+b+c\equiv6\pmod9$. We know that $a,b$, and $c$ are odd, so $a+b+c$ is odd, and therefore $a+b+c$ can only be $15$; the next larger possibility is $33$, which is too large, since $a+b+c\le3\cdot9=27$. The largest of $a,b$, and $c$ must therefore be at least $5$.

Now note that $100,000>n=45abcde=1575abc$, so $$abc\le\left\lfloor\frac{100,000}{1575}\right\rfloor=63\;.$$ This reduces the possibilities for $a,b$, and $c$ to $7,7,1$ (in some order) and $9,5,1$ (in some order). In the first case we have $45abcde=77175$, so $77175$ is a solution. In the second case we have $45abcde=70875$ and get no solution. The unique solution is therefore $n=77175$.


What's wrong with just computing it? Here's some GAP code that would give you the answer:

  if(n=0) then return []; fi;
  return Concatenation(DecimalDigits(Int(n/10)),[n mod 10]);

for n in [10000..99999] do if(45*Product(DecimalDigits(n))=n) then Print(n,"\n"); fi; od;

Here's the answer (spoiler alert):


  • 1
    $\begingroup$ To answer the opening question, using brute force when it’s not necessary is less than elegant. $\endgroup$ – Brian M. Scott Dec 4 '12 at 7:50

Note that $abcde=10000a+1000b+100c+10d+e$. Then $10000a+1000b+100c+10d+e=45a*b*c*d*e$. Restrict $\{a,b,c,d,e\}\subset \mathbb{N}$.

  • $\begingroup$ Why was this voted down? $\endgroup$ – Jebruho Dec 4 '12 at 6:03
  • $\begingroup$ I don't know if it was voted down, but if it was the vote has been undone. $\endgroup$ – Jonas Meyer Dec 4 '12 at 6:07
  • 2
    $\begingroup$ Some additional remarks: The restriction should be $\{a,b,c,d,e\}\subset\{0,1,2,3,4,5,6,7,8,9\}$, not just $\mathbb N$. Because the number is a multiple of $5$, $e$ must be $0$ or $5$, but it cannot be $0$, so $e=5$. Thus the number is odd, which implies that $a,b,c,d$ are also odd, and the number is a multiple of $25$, so $d=7$... $\endgroup$ – Jonas Meyer Dec 4 '12 at 6:12
  • $\begingroup$ @JonasMeyer - The set of values should not include $0$ for any of the five digits, since a zero in any position would make the product $0$, which is not a "5-digit number." $\endgroup$ – Jeffrey L Whitledge Dec 4 '12 at 6:46
  • $\begingroup$ @Jeffrey: That's right. I used that to conclude that $e$ is not $0$ in my comment. Subsequently it follows (from $e=5$) that not only are the other numbers not $0$, but they can't be even because the product is odd. $\endgroup$ – Jonas Meyer Dec 4 '12 at 6:47

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.