This function computes the inverse i of x (mod m) such that i*x is congruent to 1 (mod m).
I ported this from a Javascript implementation of the RSA encryption algorithm.  The Javascript was written by Carry Sullivan & Rummy Makmur and can be found online at http://www.orst.edu/dept/honors/makmur/.  I ported the 'extend(E,PHI)' function to TI-BASIC to create modinv.  I needed it for my Discrete Mathematics class but it comes in very handy for anything involving modular arithmetic (like the RSA algorithm) because modular inverses are a bit time consuming to find (or maybe I'm just lazy).

********************************************************************************************

To use it, just enter modinv(x,m) on the TI-89 and it will return the inverse of x (mod m).

Enjoy!

Wes Morgan, Calvin College, Fall 2000.
