Mathematica 9 is now available
 Documentation / Mathematica / Built-in Functions / Mathematical Functions / Number Theory  /
PowerMod

  • PowerMod[ a , b , n ] gives .
  • For negative b, PowerMod[ a , b , n ] gives modular inverses.
  • Integer mathematical function (see Section A.3.10).
  • For positive b, PowerMod[ a , b , n ] gives the same answers as Mod[ a ^ b , n ] but is much more efficient.
  • For negative b, PowerMod[ a , b , n ] gives the integer such that . If no such integer exists, PowerMod returns unevaluated.
  • See the Mathematica book: Section 3.2.4.
  • See also: Mod, ExtendedGCD.
  • Related package: Algebra`PolynomialPowerMod`.

    Further Examples

    PowerMod is much more efficient than the equivalent combination of Power and Mod.

    In[1]:=

    Out[1]=



    Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
    THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
    SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.