PHP的gmp_legendre()函数如何计算高斯勒让德符号?
- 内容介绍
- 文章标签
- 相关推荐
本文共计415个文字,预计阅读时间需要2分钟。
`gmp_legendre()` 函数用于计算两个 GMP 数字的 Legendre 符号。它返回的值是 `-1`、`0` 或 `1`,分别代表符号为负、无定义或正。
函数语法为:phpgmp_legendre(n1, n2)其中:- `n1` 是第一个 GMP 编码的数字,即第一个数字。- `n2` 是第二个 GMP 编码的数字,即第二个数字。
该函数在 PHP 5.5 及以上版本可用,具体包括:- PHP 5.5 及其早期版本使用 `gmp_legendre()` 函数。- PHP 5.6 及更高版本可以使用 GMP 对象,此时函数为 `gmp_legendre()`。
例如:php$n1=gmp_init(5);$n2=gmp_init(7);$legendre=gmp_legendre($n1, $n2);echo gmp_strval($legendre);
gmp_legendre() 函数计算两个 GMP 数字的 Legendre 符号。
它返回 -
- GMP 数字- PHP 5.5 及更早版本,或
- GMP 对象- PHP 5.6 及更高版本
语法gmp_legendre(n1, n2)参数
n1 - 第一个 GMP 编号。 PHP 5.6 及更高版本中可以是 GMP 对象。也可以是数字字符串。
n2 - 第二个 GMP 编号。 PHP 5.6 及更高版本中可以是 GMP 对象。也可以是数字字符串。
本文共计415个文字,预计阅读时间需要2分钟。
`gmp_legendre()` 函数用于计算两个 GMP 数字的 Legendre 符号。它返回的值是 `-1`、`0` 或 `1`,分别代表符号为负、无定义或正。
函数语法为:phpgmp_legendre(n1, n2)其中:- `n1` 是第一个 GMP 编码的数字,即第一个数字。- `n2` 是第二个 GMP 编码的数字,即第二个数字。
该函数在 PHP 5.5 及以上版本可用,具体包括:- PHP 5.5 及其早期版本使用 `gmp_legendre()` 函数。- PHP 5.6 及更高版本可以使用 GMP 对象,此时函数为 `gmp_legendre()`。
例如:php$n1=gmp_init(5);$n2=gmp_init(7);$legendre=gmp_legendre($n1, $n2);echo gmp_strval($legendre);
gmp_legendre() 函数计算两个 GMP 数字的 Legendre 符号。
它返回 -
- GMP 数字- PHP 5.5 及更早版本,或
- GMP 对象- PHP 5.6 及更高版本
语法gmp_legendre(n1, n2)参数
n1 - 第一个 GMP 编号。 PHP 5.6 及更高版本中可以是 GMP 对象。也可以是数字字符串。
n2 - 第二个 GMP 编号。 PHP 5.6 及更高版本中可以是 GMP 对象。也可以是数字字符串。

