Each of P, Q and R are positive integers that together use the base ten digits 1 to 9 exactly once.
What are P, Q and R, given that P:Q:R = 3:7:8?
Could be either
213:497:568 or
321:749:856
DefDbl A-Z
Dim crlf$, used(9)
Private Sub Form_Load()
ChDir "C:\Program Files (x86)\DevStudio\VB\projects\flooble"
Text1.Text = ""
crlf$ = Chr(13) + Chr(10)
Form1.Visible = True
DoEvents
n$ = "123456789": hold$ = n$
Do
p = Val(Mid(n$, 1, 3))
q = Val(Mid(n$, 4, 3))
r = Val(Mid(n$, 7, 3))
If 7 * p = 3 * q And 8 * q = 7 * r Then
Text1.Text = Text1.Text & Str(p) & Str(q) & Str(r) & crlf
DoEvents
End If
permute n$
Loop Until n$ = hold$
Text1.Text = Text1.Text & crlf & "done"
End Sub
|
Posted by Charlie
on 2014-08-13 15:50:53 |