• PHP Video Tutorials

PHP - gmp_kronecker() Function



Definition and Usage

The gmp_kronecker() function calculates the Kronecker symbol.

Description

The Kronecker symbol, written (a/n) or (a|n), is a reference taken from the Jacobi symbol to all integers n.

Syntax

gmp_kronecker ( mixed $a , mixed $b ) : 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_kronecker() function returns kronecker symbol for the given GMP numbers.

PHP Version

This function will work from PHP Version greater than 7.3.0.

Example 1

Working of gmp_kronecker() −

<?php
   $ks = gmp_kronecker("1", "3");
   echo "The Kronecker symbol of 1/3 is :".$ks;
?>

This will produce following result −

The Kronecker symbol of 1/3 is :1

Example 2

Working of gmp_kronecker() −

<?php
   $ks = gmp_kronecker("3", "11");
   echo "The Kronecker symbol of 3/11 is :".$ks;
?>

This will produce following result −

The Kronecker symbol of 3/11 is :1
php_function_reference.htm
Advertisements