over alum more atom
6578 3109 9687 3469
The sum is more and the difference is atom.
from
DefDbl A-Z
Dim crlf$, wd$(4), n(4)
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
wd(1) = "alum"
wd(2) = "atom"
wd(3) = "more"
wd(4) = "over"
s$ = "0123456789": h$ = s ' alumtover
Do
alum = Val(Mid(s, 1, 4))
atom = Val(Left(s, 1) + Mid(s, 5, 2) + Mid(s, 4, 1))
more = Val(Mid(s, 4, 1) + Mid(s, 6, 1) + Mid(s, 9, 1) + Mid(s, 8, 1))
over = Mid(s, 6, 4)
ord$ = "1234": h2$ = ord
n(1) = alum
n(2) = atom
n(3) = more
n(4) = over
Do
w1 = n(Val(Mid(ord, 1, 1)))
w2 = n(Val(Mid(ord, 2, 1)))
w3 = n(Val(Mid(ord, 3, 1)))
w4 = n(Val(Mid(ord, 4, 1)))
If w1 + w2 = w3 And w1 - w2 = w4 Then
Text1.Text = Text1.Text & wd(Val(Mid(ord, 1, 1))) & " "
Text1.Text = Text1.Text & wd(Val(Mid(ord, 2, 1))) & " "
Text1.Text = Text1.Text & wd(Val(Mid(ord, 3, 1))) & " "
Text1.Text = Text1.Text & wd(Val(Mid(ord, 4, 1))) & " " & crlf
Text1.Text = Text1.Text & n(Val(Mid(ord, 1, 1))) & " "
Text1.Text = Text1.Text & n(Val(Mid(ord, 2, 1))) & " "
Text1.Text = Text1.Text & n(Val(Mid(ord, 3, 1))) & " "
Text1.Text = Text1.Text & n(Val(Mid(ord, 4, 1))) & " " & crlf & crlf
End If
DoEvents
permute ord
Loop Until ord = h2
permute s
Loop Until s = h
Text1.Text = Text1.Text & crlf & " done"
End Sub
|
Posted by Charlie
on 2017-05-05 13:47:42 |