Query: gmp_nextprime
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
GMP_NEXTPRIME(3) 1 GMP_NEXTPRIME(3) gmp_nextprime - Find next prime numberSYNOPSISGMP gmp_nextprime (int $a)DESCRIPTIONFind next prime numberPARAMETERSo $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 VALUESReturn the next prime number greater than $a, as a GMP number.EXAMPLESExample #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 -997NOTESNote 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 |
---|
gmp_gcdext(3) - php |
gmp_init(3) - php |
gmp_random(3) - php |
gmp_strval(3) - php |
math::gmp(3pm) - debian |