$modinv » History » Version 2
Per Amundsen, 02/23/2023 05:12 PM
| 1 | 1 | Per Amundsen | _Added in 4.3_ |
|---|---|---|---|
| 2 | |||
| 3 | *$modinv(base, modulus)* |
||
| 4 | |||
| 5 | Returns the "inverse modulus":https://en.wikipedia.org/wiki/Modular_multiplicative_inverse for the specified base and modulus. |
||
| 6 | |||
| 7 | *Parameters* |
||
| 8 | |||
| 9 | 2 | Per Amundsen | table(ktable). |
| 10 | |*Parameter*|*Description*| |
||
| 11 | | base | The base to calculate for. | |
||
| 12 | | modulus | The modulus to calculate for. | |
||
| 13 | 1 | Per Amundsen | |
| 14 | *Example* |
||
| 15 | |||
| 16 | <pre> |
||
| 17 | //echo -ag The inverse modulus for 2 and 1907 is $modinv(2, 1907) |
||
| 18 | </pre> |