Es gibt laut Internet 78498 zw. 1 und 1000000.
Genau so viele habe ich auch:
Private Sub CommandButton1_Click()
Dim x1, x2, ti, i, max, pri
i = 1
ti = Timer
max = 1000000
For x1 = 2 To max
pri = True
For x2 = 2 To Sqr(x1)
If x1 Mod x2 = 0 Then
pri = False
Exit For
End If
Next x2
If pri Then
Cells(i, 1) = x1
i = i + 1
End If
Next x1
MsgBox Timer - ti
End Sub
|