This function is only available in PHP 7.3.0 or later
Kronecker Symbol - from Wikipedia
Jacobi Symbol - from Wikipedia
<?php
int gmp_kronecker ( GMP|int|string $num1,
GMP|int|string $num2 )
where,
$num1 = The GMP number
$num2 = Another GMP number
?>
<?php $pa01 = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ]; ?>
<table width="100%" cellspacing="5" cellpadding="5" border="1"
align="center"><tbody><tr><td>p\a</span></td><td>0</td><td>1</td>
<td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td>
<td>9</td><td>10</td><td>11</td><td>12</td></tr>
<?php foreach ($pa01 as $p01)
{
echo '<tr>';
?>
<td>
<?php echo $p01; ?></td>
<?php
for($a01 = 0; $a01 <= 12; $a01++)
{
$j01 = gmp_kronecker($a01, $p01);
echo '<td>' . $j01 . '</td>';
}
}
?>
</tr><tr><td colspan="14">ed48</td></tbody></tr></table>
Kronecker symbol | |||||||||||||
p\a | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
2 | 0 | 1 | 0 | -1 | 0 | -1 | 0 | 1 | 0 | 1 | 0 | -1 | 0 |
3 | 0 | 1 | -1 | 0 | 1 | -1 | 0 | 1 | -1 | 0 | 1 | -1 | 0 |
4 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 |
5 | 0 | 1 | -1 | -1 | 1 | 0 | 1 | -1 | -1 | 1 | 0 | 1 | -1 |
6 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 |
7 | 0 | 1 | 1 | -1 | 1 | -1 | -1 | 0 | 1 | 1 | -1 | 1 | -1 |
8 | 0 | 1 | 0 | -1 | 0 | -1 | 0 | 1 | 0 | 1 | 0 | -1 | 0 |
9 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 0 |
10 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | -1 | 0 | 1 | 0 | -1 | 0 |
11 | 0 | 1 | -1 | 1 | 1 | 1 | -1 | -1 | -1 | 1 | -1 | 0 | 1 |
12 | 0 | 1 | 0 | 0 | 0 | -1 | 0 | 1 | 0 | 0 | 0 | -1 | 0 |
ed48 |
<?php
echo "gmp_kronecker(23, 12) = " .
gmp_kronecker(23, 12) . '<br><br>';
echo "gmp_kronecker(gmp_init(23), 12) = " .
gmp_kronecker(gmp_init(23), 12) . '<br><br>';
echo "gmp_kronecker(23, gmp_init(12)) = " .
gmp_kronecker(23, gmp_init(12)) . '<br><br>';
echo "gmp_kronecker(gmp_init(23), gmp_init(12)) = " .
gmp_kronecker(gmp_init(23), gmp_init(12)) . '<br><br>';
echo "gmp_kronecker(\"23\", 12) = " .
gmp_kronecker("23", 12) . '<br><br>';
echo "gmp_kronecker(23, \"12\") = " .
gmp_kronecker(23, "12") . '<br><br>';
echo "gmp_kronecker(\"23\", \"12\") = " .
gmp_kronecker("23", "12") . '<br><br><br>';
echo "gmp_kronecker(23, -12) = " .
gmp_kronecker(23, -12) . '<br><br>';
echo "gmp_kronecker(-23, 12) = " .
gmp_kronecker(-23, 12) . '<br><br>';
echo "gmp_kronecker(-23, -12) = " .
gmp_kronecker(-23, -12) . '<br>';
?>