Find a three digit number that fits the following criteria:
1)The digits are all different.
2)The product of the digits times the largest of the 3 digits equals the original 3 digit number.
3)The digits are either all odd or all even.
There are actually not too many combinations of digits to test (14 to be exact), but I had written a program anyway, so I thought I might as well show all the possible combinations along the way, as if done manually. In each case the result of the computation is shown and then shown again if the product of the smallest, the middle and the square of the largest, digits has the same digits as used in the calculation:
1 3 5 75
1 3 7 147
1 3 9 243
1 5 7 245
1 5 9 405
1 7 9 567
2 4 6 288
2 4 8 512
2 6 8 768
3 5 7 735
735
3 5 9 1215
3 7 9 1701
4 6 8 1536
5 7 9 2835
The solution, 735 is shown, beneath its three digits in numeric sequence.
For a = 1 To 5
For b = a + 2 To 9 Step 2
For c = b + 2 To 9 Step 2
p = a * b * c * c
Text1.Text = Text1.Text & Str(a) & Str(b) & Str(c)
Text1.Text = Text1.Text & " " & Str(p) & crlf
ps$ = Str(p)
If InStr(ps, LTrim(Str(a))) > 0 Then
If InStr(ps, LTrim(Str(b))) > 0 Then
If InStr(ps, LTrim(Str(c))) > 0 Then
Text1.Text = Text1.Text & ps & crlf
End If
End If
End If
DoEvents
Next
Next
Next
The program has a bug (irrelevant to the solution as it turns out). Can you find it?
In declaring a solution the program assures that the three digits are all found in the product but does not check to be sure the result is not a 4digit number with one of those digits a repeat. It just happens that a spurious solution was not found; of course it would have been obvious if a spurious solution had been found.

Posted by Charlie
on 20200805 12:32:40 