A [modular multiplicative inverse][1] of an integer $a$ is an integer $x$ such that $a\cdot x$ is congruent to 1 modular some modulus $m$. To write it in a formal way ...
# Algorithm due to M. Joye and J.-J. Quisquater for efficiently computing the Lucas U and V sequences (mod m). my $U1 = Math::GMPz::Rmpz_init_set_ui(1); my ($V1, $V2 ...