' 1 3 4 8 15 27 50 92 169 311 572 ... N
' (1) (3) (4) : 1 + 3 + 4 (8) : 3 + 4 + 8 (15) : 4 + 8 + 15 (27) :
' 8 + 15 + 27 (50) : 15 + 27 + 50 (92) : 27 + 50 + 92 (169) :
' 50 + 92 + 169 (311) : 92 + 169 + 311 (572)
Imports System
Public Class Program
Public Shared Sub Main()
Dim a As Integer = 1, b As Integer = 3, c As Integer = 4, total As Integer = 11
Console.Write("{0} {1} {2} ", a, b, c)
Dim sum As Integer = 0
For i As Integer = 4 To total
sum = a + b + c
Console.Write("{0} ", sum)
a = b
b = c
c = sum
Next
End Sub
End Class
' run:
'
' 1 3 4 8 15 27 50 92 169 311 572
'