[R] Modular inverses

SJ Robson-Davis sr6827 at bristol.ac.uk
Fri Nov 27 17:52:05 CET 2009


I want to find the inverse of an integer k mod p (prime.) Is there a
function that can do this for me? I know i could simply write (k^(p-2)) %%
p, but i need to do this for large primes (above 100) and this gives the
warning message:
Warning message:
probable complete loss of accuracy in modulus
so this method does not work. Any ideas?

Thanks,

Samuel

--




More information about the R-help mailing list