This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
 Documentation / Mathematica / Built-in Functions / Mathematical Functions / Number Theory  /
Mod

  • Mod[ m , n ] gives the remainder on division of m by n.
  • The sign of Mod[ m , n ] is always the same as the sign of n, at least so long as m and n are both real.
  • Mod[ m , n ] is equivalent to m - n Quotient[ m , n ].
  • The arguments of Mod can be any numeric quantities, not necessarily integers.
  • Mod[ x , 1] gives the fractional part of x.
  • For exact numeric quantities, Mod internally uses numerical approximations to establish its result. This process can be affected by the setting of the global variable $MaxExtraPrecision.
  • See the Mathematica book: Section 1.1.3Section 3.2.4.
  • See also: PowerMod, Quotient, FractionalPart, MantissaExponent, PolynomialMod, PolynomialRemainder.

    Further Examples

    Here are a few modular reductions.

    In[1]:=

    Out[1]=

    In[2]:=

    Out[2]=

    In[3]:=

    Out[3]=