PowerMod

PowerMod[x, y, m] computes Mod[x^y, m]

Attributes[PowerMod] := {Listable, Protected, ReadProtected}

Simple examples

In[1]:= PowerMod[5, 9999, 7]
Out[1]= 6