Divide the set of integers from 1 to 15 into 2 subsets - a subset A of 13 numbers and B of 2 numbers so that the sum of the members of A equals the product of the two numbers in B.
(In reply to
answer by Dej Mar)
DefDbl A-Z
Dim crlf$
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For a = 1 To 14
For b = a + 1 To 15
For c = b + 1 To 15
prod = a * b * c
tot = 120 - a - b - c
If prod = tot Then
Text1.Text = Text1.Text & a & Str(b) & Str(c) & crlf
End If
Next
Next
Next
Text1.Text = Text1.Text & crlf & " done"
End Sub
finds 3 solutions to the 12 and 3 version of this puzzle:
as the three (out of 15) numbers to be multiplied.
|
Posted by Charlie
on 2016-03-01 09:20:29 |