IsPrime
Tests whether n is a prime number.
✓ checked against that system · ! checked, with disagreements (hover a chip)Wikipedia
Primality testPrime numberMathWorldPrimalityTestPrimeNumberWikidataQ49008Encyclopedia of MathematicsPrime_numbernLabprime numberBritannicatopic/prime-numberOEISA000040Wolfram LanguagePrimeQ!Rosetta CodePrimality by trial divisionIsPrime(n)tests whether is prime.IsPrime(n, Over -> GaussianIntegers)tests whether is prime in ; a complex is always tested thereIsPrime(n, Over -> QuadraticIntegers(d))tests whether is prime in the ring of integers of , where an irreducible need not be primeTyped signatures
| Type | Package | Applies |
|---|---|---|
(number | quadratic_integer, any*) -> boolean | number-theoryreplaces compute-engine | always |
(number) -> boolean | compute-engine | always |
Details
- 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.
- A negative n is not prime: compute-engine rules
IsPrime(-7)False, a prime being a natural number. Wolfram's PrimeQ counts a prime's associates and answers True.
Examples
28 more kept as data, checked against the oraclesScope #
-7 is not prime: a prime is a natural number, though Wolfram's PrimeQ counts its associate 7
live ↗InOut
Applications #
Neat examples #
About
| Examples | 61 |
|---|---|
| Checked against | Wolfram Language 58 agree3 differSageMath 42 agree1 errorSymPy 26 agree17 errormathlib4 23 agree12 errorOscar 15 agree5 errorJulia 30 agree12 errorRust 24 agree8 error |
| Crosswalk | Wikipedia ×2MathWorld ×2WikidataEncyclopedia of MathematicsnLabBritannicaOEISWolfram LanguageSageMathSymPyOscarJuliaRustRosetta Code |
Implementation
mapped
wolframpackages/oracle/src/mappings.tsmapped
sympypackages/oracle/src/mappings.tsmapped
sagepackages/oracle/src/mappings.tsmapped
oscarpackages/oracle/src/mappings.tsmapped
juliapackages/oracle/src/mappings.tsmapped
mathlib4packages/oracle/src/mappings.tsmapped
rustpackages/oracle/src/mappings.ts See also: FactorInteger, NextPrime