PHP - gmp_legendre() Function
Definition and Usage
The gmp_legendre() function calculates the Legendre symbol.
Description
The gmp_legendre() function will return the legendre symbol for the given GMP numbers. The second GMP number p has to be odd and positive.
Syntax
gmp_legendre ( GMP $a , GMP $p ) : int
Parameters
| Sr.No | Parameter & Description |
|---|---|
| 1 |
a It can a GMP resource number , a gmp object or a numeric string. |
| 2 |
b It can a GMP resource number , a gmp object or a numeric string. The value of b has to be positive and odd. |
Return Values
PHP gmp_legendre() function returns legendre symbol for the given GMP numbers.
PHP Version
This function will work from PHP Version greater than 5.0.0.
Example 1
Working of gmp_legendre() −
<?php
$ls = gmp_legendre("1", "3");
echo "The Legendre symbol of 1/3 is :".$ls;
?>
This will produce following result −
The Legendre symbol of 1/3 is :1
Example 2
Working of gmp_legendre() −
<?php
$ls = gmp_legendre("3", "11");
echo "The Legendre symbol of 3/11 is :".$ls;
?>
This will produce following result −
The Legendre symbol of 3/11 is :1
php_function_reference.htm
Advertisements