' 1 2 3 6 9 18 27 54 81 162 243 ... N
' (1) (2) 1 * 3 (3) 2 * 3 (6) : 3 * 3 (9) 6 * 3 (18) :
' 9 * 3 (27) 18 * 3 (54) : 27 * 3 (81) 54 * 3 (162) :
' 81 * 3 (243)
Imports System
Public Class Program
Public Shared Sub Main()
Dim a As Integer = 1, b As Integer = 2, total As Integer = 11
Console.Write("{0} {1} ", a, b)
For i As Integer = 3 To total
If i Mod 2 = 1 Then
a = a * 3
Console.Write("{0} ", a)
Else
b = b * 3
Console.Write("{0} ", b)
End If
Next
End Sub
End Class
' run:
'
' 1 2 3 6 9 18 27 54 81 162 243
'