BigInt.PowM (gb.gmp)

Function PowM ( Exp As BigInt, Mod As BigInt ) As BigInt

Return the number raised to Exp modulo Mod.

Negative Exp is supported if InvM(Mod) exists. If an inverse doesn't exist then a divide by zero is raised.