Determine the (non-leading zero) 3-digit positive integer N such that the product of the digits of N is equal to N/5.
Source: Adapted from a problem appearing in a German Mathematical Olympiad.
*** Computer solutions are welcome, but an analytical solution is preferred.
I did the analytical method first.
pod(N) = N/5
Call N's 3 digits: abc
Since N/5 is an integer, c must be 0 or 5. But c cannot be 0 or pod(N) would be zero.
So c=5
5*pod(N) = 25*a*b = 100a + 10b + 5 which ends in 5
25*a*b ends with 25 or 75 (cannot end in 00 or 50)
b is either 2 or 7
But, because 25*a*b ends with 25 or 75, then a and b are both odd
So b is 7
abc could be 175, 375, 575, 775, 995
for which pod: 35, 105, 175, 245, 315
which times 5: 175, 525, 875, 1225, 1575
So the only match is 175
for i in range(100,1000):
x = str(i)
a=int(x[0])
b=int(x[1])
c=int(x[2])
if 5*a*b*c == i:
print(i)
|
Posted by Larry
on 2022-10-05 05:47:23 |