from big x^y modulo function by Michael Neve
provide the solution when the normal mod function can't because the input is to big

All files for big x^y modulo function
/mmod.m

Contact us at files@mathworks.com