up previous next
SmallestNonDivisor

find smallest prime which does not divide an integer

Syntax
SmallestNonDivisor(N: INT): INT

Description
This function finds the smallest prime which does not divide an integer. It simply tries dividing by all primes in increasing order until it finds one which does not divide N .

Example
/**/  SmallestNonDivisor(factorial(100));
101

/**/  SmallestNonDivisor(-100);
3

See Also