nextprime - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


nextprime

determine the next largest prime

prevprime

determine the next smallest prime

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

nextprime(n)

prevprime(n)

Parameters

n

-

integer

Description

• 

The nextprime function returns the smallest prime that is larger than n. The prevprime function returns the largest prime that is less than n.

Examples

> 

nextprime⁡1

2

(1)
> 

nextprime⁡0

2

(2)
> 

prevprime⁡2

Error, (in prevprime) there are no primes less than 2

> 

nextprime⁡25

29

(3)
> 

prevprime⁡3

2

(4)
> 

prevprime⁡25

23

(5)
> 

nextprime⁡31243

31247

(6)
> 

prevprime⁡2338714

2338703

(7)
> 

nextprime⁡26

67

(8)

See Also

isprime

ithprime

Nextpoly