note 124889 added to function.gmp-invert
| From: | athamidn at gmail dot com | Date: | Mon, 06 Apr 2020 11:31:04 +0000 |
| Subject: | note 124889 added to function.gmp-invert | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-214427@lists.php.net to get a copy of this message | ||
Example #2 gmp_invert() example
<?php
echo gmp_invert("5", "10"); // no inverse, outputs nothing, result is FALSE
It means (5 * x ) mod 10 = 1. And with this function we want a value for x, because of mod 10, x
should be {1.. 10-1(9)}, so :
5 * 1 mod 10 = 5
5 * 2 mod 10 = 0
5 * 3 mod 10 = 5
5 * 4 mod 10 = 0
5 * 5 mod 10 = 5
5 * 6 mod 10 = 0
5 * 7 mod 10 = 5
5 * 8 mod 10 = 0
5 * 9 mod 10 = 5
We don't have any 1 in the results. so it will be False.
$invert = gmp_invert("5", "11");
echo gmp_strval($invert) . "\n";
?>
The above example will output:
9
5 * 9 mod 11 = 1
----
Server IP: 45.112.84.4
Probable Submitter: 185.85.3.195 (proxied: 185.2.82.49)
----
Manual Page -- http://php.net/manual/en/function.gmp-invert.php
Edit -- https://master.php.net/note/edit/124889
Del: integrated -- https://master.php.net/note/delete/124889/integrated
Del: useless -- https://master.php.net/note/delete/124889/useless
Del: bad code -- https://master.php.net/note/delete/124889/bad+code
Del: spam -- https://master.php.net/note/delete/124889/spam
Del: non-english -- https://master.php.net/note/delete/124889/non-english
Del: in docs -- https://master.php.net/note/delete/124889/in+docs
Del: other reasons-- https://master.php.net/note/delete/124889
Reject -- https://master.php.net/note/reject/124889
Search -- https://master.php.net/manage/user-notes.php