NextPrime
The next prime strictly greater than n, or the kth prime after n.
✓ checked against that system · ! checked, with disagreements (hover a chip)Wikipedia
Prime numberMathWorldNextPrimePrimeNumberWikidataQ49008Encyclopedia of MathematicsPrime_numbernLabprime numberBritannicatopic/prime-numberOEISA000040Wolfram LanguageNextPrime✓NextPrime(n)smallest prime strictly greater than .SageMath
next_prime(n)SymPynextprime(n)Julianext_prime(ZZ(n))Rustnext_prime(n)NextPrime(n, k)the th prime after ; negative walks backward.SymPy
nextprime(n, k)NextPrime(n, k?)The next prime strictly greater than n, or the kth prime after n.SymPy
nextprime(n, k?)Typed signatures
| Type | Package | Applies |
|---|---|---|
(integer, integer?) -> integer | compute-engine | always |
(number, number?) -> integer | number-theoryreplaces compute-engine | always |
Details
- NextPrime(n) is the th prime, where is the count of primes .
- NextPrime(n, k) generalizes to the th prime, so a negative steps backward to a prime below .
- n need not be prime or even an integer; compute-engine simply finds the next prime above it.
- Threads element-wise over a list, as Wolfram's Listable heads do.
Plot
Examples
1 more kept as data, checked against the oraclesScope #
Applications #
Properties #
Possible issues #
About
| Examples | 23 |
|---|---|
| Checked against | Wolfram Language 23 agreeSageMath 8 agree1 differ2 errorSymPy 14 agree1 differ2 errorJulia 7 agree1 differ2 errorRust 6 agree5 error |
| Crosswalk | WikipediaMathWorld ×2WikidataEncyclopedia of MathematicsnLabBritannicaOEISWolfram LanguageSageMathSymPy ×2JuliaRust |
Implementation
mapped
sympypackages/oracle/src/mappings.tsnextprime(n) is the least prime above n.
mapped
sympypackages/oracle/src/mappings.tsnextprime(n, i) is the i-th prime above n; i must be positive, where ours takes a negative step to the primes below.
mapped
sagepackages/oracle/src/mappings.tsmapped
juliapackages/oracle/src/mappings.tsmapped
rustpackages/oracle/src/mappings.ts