/** * Returns the smallest integer x > {@code this} which is probably prime as * a {@code BigInteger} instance. The probability that the returned {@code * BigInteger} is prime is beyond (1-1/2^80). * * @return smallest integer > {@code this} which is robably prime. * @throws ArithmeticException * if {@code this < 0}. */ public static BigInteger NextProbablePrime(BigInteger value) { if (value.Sign < 0) { // math.1A=start < 0: {0} throw new ArithmeticException(String.Format(Messages.math1A, value)); //$NON-NLS-1$ } return(Primality.NextProbablePrime(value)); }
/** * Returns the smallest integer x > {@code this} which is probably prime as * a {@code BigInteger} instance. The probability that the returned {@code * BigInteger} is prime is beyond (1-1/2^80). * * @return smallest integer > {@code this} which is robably prime. * @throws ArithmeticException * if {@code this < 0}. */ public static BigInteger NextProbablePrime(BigInteger value, CancellationToken argCancelToken) { argCancelToken.ThrowIfCancellationRequested(); if (value.Sign < 0) { // math.1A=start < 0: {0} throw new ArithmeticException(String.Format(Messages.math1A, value)); //$NON-NLS-1$ } return(Primality.NextProbablePrime(value, argCancelToken)); }