Next Safe Prime - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

# Online Help

###### All Products    Maple    MapleSim

NumberTheory

 NextSafePrime
 least safe prime greater than a number

 Calling Sequence NextSafePrime(n)

Parameters

 n - positive integer

Description

 • The NextSafePrime(n) command computes the smallest safe prime greater than n.
 • A prime number p is said to be a safe prime if p is of the form $2q+1$ where $q$ is also prime.

Examples

 > $\mathrm{with}\left(\mathrm{NumberTheory}\right):$
 > $\mathrm{NextSafePrime}\left(1\right)$
 ${5}$ (1)
 > $\mathrm{NextSafePrime}\left(5\right)$
 ${7}$ (2)
 > $\mathrm{NextSafePrime}\left(327653\right)$
 ${327707}$ (3)
 > $\mathrm{isprime}\left(\frac{327707-1}{2}\right)$
 ${\mathrm{true}}$ (4)

Compatibility

 • The NumberTheory[NextSafePrime] command was introduced in Maple 2016.
 • For more information on Maple 2016 changes, see Updates in Maple 2016.

 See Also