IsPrime
Tests whether n is a prime number.
Wikipedia
Primality testPrime numberMathWorldPrimalityTestPrimeNumberWikidataQ49008Encyclopedia of MathematicsPrime_numbernLabprime numberBritannicatopic/prime-numberOEISA000040Wolfram LanguagePrimeQ✓Rosetta CodePrimality by trial divisionDetails
- A prime has no positive divisors other than 1 and itself; 1 itself is not prime.
- Returns False unless n is provably prime -- there's no third "unknown" outcome.
- Threads element-wise over a list argument.
- compute-engine's IsPrime requires a positive integer and returns False for negatives.
Examples
See also: FactorInteger, NextPrime