Home >Backend Development >PHP Tutorial >gmp_legendre() function in PHP

gmp_legendre() function in PHP

WBOY
WBOYforward
2023-09-05 19:41:06993browse

gmp_legendre() function in PHP

gmp_legendre() function calculates the Legendre sign of two GMP numbers.

It returns -

- GMP Number- PHP 5.5 and earlier, or

- GMP Object- PHP 5.6 and later

Syntax

gmp_legendre(n1, n2)

Parameters

  • n1 - First GMP number. Can be a GMP object in PHP 5.6 and higher. Can also be a numeric string.

  • n2 - Second GMP number. Can be a GMP object in PHP 5.6 and higher. Can also be a numeric string.

Return

gmp_legendre() function returns the GMP number or object.

Example

The following is an example-

<?php
   $n1 = 5;
   $n2 = 5;
   echo gmp_legendre($n1, $n2);
?>

Output

The following is the output-

0

Example

Let’s see another example –

<?php
   $n1 = 4;
   $n2 = 3;
   echo gmp_legendre($n1, $n2);
?>

Output

Below is the output –

1

The above is the detailed content of gmp_legendre() function in PHP. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete