gmp_nextprime(3) php man page | unix.com

Man Page: gmp_nextprime

Operating Environment: php

Section: 3

GMP_NEXTPRIME(3)							 1							  GMP_NEXTPRIME(3)

gmp_nextprime - Find next prime number

SYNOPSIS
GMP gmp_nextprime (int $a)
DESCRIPTION
Find next prime number
PARAMETERS
o $a -Either a GMP number resource in PHP 5.5 and earlier, a GMP object in PHP 5.6 and later, or a numeric string provided that it is possible to convert the latter to a number.
RETURN VALUES
Return the next prime number greater than $a, as a GMP number.
EXAMPLES
Example #1 gmp_nextprime(3) example <?php $prime1 = gmp_nextprime(10); // next prime number greater than 10 $prime2 = gmp_nextprime(-1000); // next prime number greater than -1000 echo gmp_strval($prime1) . " "; echo gmp_strval($prime2) . " "; ?> The above example will output: 11 -997
NOTES
Note This function uses a probabilistic algorithm to identify primes and chances to get a composite number are extremely small. PHP Documentation Group GMP_NEXTPRIME(3)
Related Man Pages
prime(1ssl) - suse
gmp_div_q(3) - php
gmp_div_qr(3) - php
gmp_strval(3) - php
math::gmp(3pm) - debian
Similar Topics in the Unix Linux Community
UNIX.COM 2017 Year End Summary
New Code Tags (Syntax Highlighting)
Please Welcome Ravinder Singh to the Moderation Team
The Order of the Wizard's Hat - Lifetime Achievement Award 2019 - Congrats to Don Cragun
Please Welcome Nicki Paul to the Moderator Team!