getPrime method
Returns the i
th prime number.
WARNING: This will generate and store every prime number below the i
th.
That can be very expensive. That's why the isPrime, primeDecomp etc
are carefully implemented to only request primes up to sqrt(n)
.
Implementation
int getPrime(int i) {
while (_p.length <= i) {
addPrime();
}
return _p[i];
}