Primes
is_prime¶
Test whether an integer is prime using the 6k±1 algorithm. Numbers less than 2 are not prime. 2 and 3 are prime. All other primes satisfy n mod 6 == 1 or 5. Accepts optional -v/--verbose flag to print a human-readable verdict.
Arguments¶
- $1 (int): The integer to test (or $2 when -v is given)
Exit codes¶
- 0: Number is prime
- 1: Number is not prime
Output on stdout¶
- When --verbose: "N is [not] a prime"