The alphametic
ABC*CBA = DEF*FED (i)
has 3 distinct (excluding symmetry) solutions.
Find them all.
Assume A being the smallest of all digits and D the smallest
on the right side of (i).
abc def def fed
156 651 273 372
168 861 294 492
276 672 384 483
from
DefDbl A-Z
Dim crlf$
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For a = 1 To 9
For b = 0 To 9
For c = 1 To 9
abc = 100 * a + 10 * b + c: cba = 100 * c + 10 * b + a
If abc < cba Then
For d = 1 To 9
For e = 0 To 9
For f = 1 To 9
def = 100 * d + 10 * e + f: fed = 100 * f + 10 * e + d
If def > abc And fed > abc And def < fed And abc * cba = def * fed Then
Text1.Text = Text1.Text & abc & Str(cba) & " " & def & Str(fed) & crlf
End If
DoEvents
Next
Next
Next
End If
DoEvents
Next
Next
Next
Text1.Text = Text1.Text & crlf & " done"
End Sub
|
Posted by Charlie
on 2017-04-02 12:40:21 |