From Mexico to China Solve 2 independent alphametics:
MEXICO/CHINA=IF
and
MEXICO/CHINA=GO
Evaluate F/G.
MEXICO CHINA IF
387120 24195 16 6
963140 48157 20 2
GO
F/G = 6/2 = 3
DefDbl A-Z
Dim crlf$, dig(9)
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
d$ = "0123456789": h$ = d$
Do
DoEvents
If InStr(d, "0") > 1 And InStr(d, "0") <> 4 Then
mexico = Val(Left(d, 6))
china = Val(Mid(d, 5, 1) + Mid(d, 7, 1) + Mid(d, 4, 1) + Mid(d, 8, 2))
q = Mid(d, 4, 1) + Mid(d, 10, 1)
If q * china = mexico Then Text1.Text = Text1.Text & mexico & Str(china) & Str(q) & " " & q Mod 10 & crlf
End If
permute d
Loop Until d = h
Do
DoEvents
If InStr(d, "0") > 1 And InStr(d, "0") <> 10 Then
mexico = Val(Left(d, 6))
china = Val(Mid(d, 5, 1) + Mid(d, 7, 1) + Mid(d, 4, 1) + Mid(d, 8, 2))
q = Mid(d, 10, 1) + Mid(d, 6, 1)
If q * china = mexico Then Text1.Text = Text1.Text & mexico & Str(china) & Str(q) & " " & q \ 10 & crlf
End If
permute d
Loop Until d = h
Text1.Text = Text1.Text & crlf & " done"
End Sub
|
Posted by Charlie
on 2015-11-18 16:12:10 |