i got already the fibonacci!! what is wrong with this code????
Private Sub cmdFindPrime_Click()
Dim is_prime() As Boolean
Dim max_number As Long
Dim i, j As Long
Dim txt As String
Screen.MousePointer = vbHourglass
'create the array'
max_number = CLng(txtInput.Text)
ReDim is_prime(2 To max_number)
For i = 2 To max_number
is_prime(i) = True
Next i
For i = 2 To max_number / 2
If is_prime(i) Then
'cross out all the numbers that are multiples of this number.'
For j = 2 To max_number / i
is_prime(j + i) = False
Next j
End If
Next i
'display the primes'
j = 0
For i = 2 To max_number
If is_prime(i) Then
txt = txt & Format(i)
j = j + 1
If (j Mod 5) = 0 Then
txt = txt & vbCrLf
Next i
End If
txtInput.Text = txt
Screen.MousePointer = vbDefault
End If
End Sub
thanx a lot and more powers