/***********************************************************
hamming.c -- Hamming (ハミング) の問題
***********************************************************/
Const N = 100
Dim q[ELM(N)] As Long


Sub hamming()

Dim i As Long, j2 As Long, j3 As Long, j5 As Long, min As Long, x2 As Long, x3 As Long, x5 As Long

x2 = 1
x3 = 1
x5 = 1

For i=0 To N-1
min = x2
If x3 < min Then min = x3
If x5 < min Then min = x5
q[i] = min
While x2 <= min : x2 = 2 * q[j2] : j2 = j2 + 1 : Wend
While x3 <= min : x3 = 3 * q[j3] : j3 = j3 + 1 : Wend
while x5 <= min : x5 = 5 * q[j5] : j5 = j5 + 1 : Wend
Next
End Sub

#N88BASIC

Dim i As Long
hamming()
For i=0 To N-1
Print q[i]
Next