I’m using BigInteger’s nextProbablePrime in a homework assignment to calculate the next prime number I can use to resize a hash table that uses quadratic probing.
The table stores data items read in from a file. The sample file I’ve been given contains only 100 items, but I can’t assume that this is the maximum data set my program will be tested on.
I’m wondering if there is any relationship between the size of the value that I pass to nextProbablePrime and the likelihood that it will correctly return a prime number? In other words, is there a number below which nextProbablePrime is guaranteed to be accurate? Is it reasonable for me to rely on it?
Since “the probability that the number returned by this method is composite does not exceed
2^-100” I think it is reasonable for you to assume to rely on it returning a prime number.