gmp_nextprime

PHP 5 >= 5.2.0, PHP 7, PHP 8
gmp_nextprime - Find next prime number
Manual
Code Examples

gmp_nextprime( GMP|int|string$num ): GMP

Find next prime number

Parameters

num

A GMP object, an int or a numeric string.

Return Values

Return the next prime number greater than num, as a GMP number.

Notes

Note:

This function uses a probabilistic algorithm to identify primes and chances to get a composite number are extremely small.

Example of gmp_nextprime

Show all examples for gmp_nextprime

PHP Version: