= Modulo operation
{title2=$a\bmod m$}
= Modulo
{synonym}
= Mod
{synonym}
For an <integer> $a$ and a positive <integer modulus> $m$, the modulo operation returns the unique <least nonnegative residue> $r$ satisfying $a=qm+r$ for an <integer> $q$ and $0\leq r<m$. Equivalently, $r=a-m\lfloor a/m\rfloor$. For example, $-3\bmod5=2$. Some programming languages instead use a remainder with the sign of the dividend, so their negative-input convention must be checked before identifying an operator with this mathematical definition.
Back to article page