The code for primes is all installed, but is worth mentioning here.
makePrimes/4
makePrimes(From, To, Primes, LastPrime)
Computes all (Primes) primes in the range From to To extremely rapidly, and stores them in an internal.vector. Uses a priority queue to implement the sieve of Eratosthenes.
makePrimes/1
makes all primes to 2**15, which is sufficient to factorize 32 bit integers.
primes/1
primes(Primes)
Primes is the length of the prime vector.
nthPrime/2
nthPrime(Index, Prime)
returns the nth prime (index origin: 1) from the prime vector.
primeFactors/2
primeFactors(N, Factors)
factorizes N, using the prime vector.