The integers
x(1), x(2), x(3), x(4), x(5), x(6), x(7)
comply with the recursive formula:
x(n+3)=x(n+2)*(x(n+1)+x(n)) If x(6)=144 what is the value of x(7)?
DefDbl A-Z
Dim crlf$, fct(20, 1), x(7)
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For tot = 3 To 500
For a0 = 0 To tot
For b0 = 0 To tot
DoEvents
For a = -a0 To a0 Step 2 * a0
For b = -b0 To b0 Step 2 * b0
c = tot - a - b
x(1) = a: x(2) = b: x(3) = c
If a = -7 And b = -1 And c = -1 Then
xx = xx
End If
For s = 4 To 7
x(s) = x(s - 1) * (x(s - 2) + x(s - 3))
Next
If x(6) = 144 Then
For i = 1 To 7
Text1.Text = Text1.Text & Str(x(i))
Next
Text1.Text = Text1.Text & crlf
End If
If b = 0 Then Exit For
Next
If a = 0 Then Exit For
Next
Next
Next
Next
Text1.Text = Text1.Text & crlf & " done"
End Sub
find the possible sequences
-2 4 2 4 24 144 4032
2-4 6-12-24 144-5184
2 1 2 6 18 144 3456
5 3-1-8-16 144-3456
5-4 6 6 12 144 2592
7 1 1 8 16 144 3456
The puzzle doesn't say that only positive integers are allowed, but only with that restriction is there a unique answer: 3456.
|
Posted by Charlie
on 2017-02-01 10:55:25 |