Sieve
public struct Sieve : IteratorProtocol
A generator for finding prime numbers
A prime sieve or prime number sieve is a fast type of algorithm for finding primes. It does so by iterating over the natural integers, and returning every number that is indeed prime.
-
Creates a Sieve
IteratorProtocol
/Sequence
Declaration
Swift
public init()
-
Return the next prime number
Declaration
Swift
public mutating func next() -> BigInt?
-
Makes Sieve conforming to the
Sequence
protocolDeclaration
Swift
public func makeIterator() -> Sieve
-
Gives the nth prime
Parameters
n
The nth prime in the list