Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function PSieve(ByVal limit As Integer) As Boolean()
- Dim input(limit) As Boolean
- input(0) = True : input(1) = True
- Parallel.For(2, CInt(Math.Sqrt(input.Length)), Sub(i)
- If Not input(i) Then
- Dim j As Integer = 2 * i
- While j <= input.Length - 1
- input(j) = True
- j += i
- End While
- End If
- End Sub)
- Return input
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement