First let's make (ii) more manageable by writing the recursion in more usual terms:
A(n) = A(n-1)*(A(n-2) + A(n-3)) for n = 4, 5, 6 and 7
DefDbl A-Z
Dim crlf$, a(7)
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For a1 = 1 To 36
a(1) = a1
For a2 = 1 To 36
a(2) = a2
For a3 = 1 To 36
DoEvents
a(3) = a3
For i = 4 To 7
a(i) = a(i - 1) * (a(i - 2) + a(i - 3))
Next i
If a(6) = 144 Then
For i = 1 To 7
Text1.Text = Text1.Text & Str(a(i))
Next i
Text1.Text = Text1.Text & crlf
End If
Next
Next
Next
Text1.Text = Text1.Text & crlf & " done"
End Sub
resulting in:
2 1 2 6 18 144 3456
7 1 1 8 16 144 3456
The results show that A(6) is 144 only if A(1), A(2) and A(3) are either 2, 1 and 2; or 7, 1 and 1, respectively. Either way A(7) is 3456.
|
Posted by Charlie
on 2016-07-22 10:34:02 |