BigInteger.nextProbablePrime

Returns the first integer greater than this {@code BigInteger} that is probably prime. The probability that the number returned by this method is composite does not exceed 2<sup>-100</sup>. This method will never skip over a prime when searching: if it returns {@code p}, there is no prime {@code q} such that {@code this < q < p}.

@return the first integer greater than this {@code BigInteger} that is probably prime. @throws ArithmeticException {@code this < 0} or {@code this} is too large.

class BigInteger
nextProbablePrime
()

Meta