Javatpoint Logo
Javatpoint Logo

PHP gmp_prob_prime() function

The PHP gmp_prob_prime() function checks the probability of the given input GMP number to being prime. This function determines if the given GMP number is a prime or not. This function is used for large and complicated numerical values.

Syntax

The given syntax shows the GMP function for identifying the probability of the prime number.

Parameters

  • As shown in the above GMP syntax, this function takes a GMP numerical value as a required parameter. The parameter is written as a $num_parameter.
  • The PHP version 5.6 and afterword versions use the gmp_prob_prime() function. we can use numeric data, or the string that can turn into a number.

Return Value

  • The function shows output in numerical format to give the possibility of the given number being a prime.
    • The given input is not a prime number if the output shows the "0" value.
    • If the output shows the "1" value, then the given input is probably (not fixed) a prime number.
    • If the output shows the "2" value, then the given input is a prime number.

Examples

The given examples show the probability of the prime number of the various GMP parameters.

Example1: The given example finds the probability of prime number of the given positive input value.

Output:

The following output identifies the probability of the prime number of the given value.

PHP gmp_prob_prime() function

Example2: The given example identifies probability of prime number of the negative input value.

Output:

The following output identifies the probability of the prime number of the given value.

PHP gmp_prob_prime() function

Example3:

Output:

The following output identifies the probability of the prime number of the given value.

PHP gmp_prob_prime() function

Example4: The given example identifies probability of prime number of the given GMP string value.

Output:

The following output identifies the probability of the prime number of the given value.

PHP gmp_prob_prime() function

Example5: The given example shows probability of prime number of the given GMP binary value.

Output:

The following output identifies the probability of the prime number of the given value.

PHP gmp_prob_prime() function

Conclusion

The gmp_prob_prime() function shows whether the given number is prime or not with a probability of the prime number. It works on lengthy and complicated mathematical operations.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA