Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Modulo
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{About|the binary operation ''mod({{mvar|a,n}})''|the ''(mod {{mvar|n}})'' notation|Modular arithmetic|other uses}} {{short description|Computational operation}} In [[computing]] and [[mathematics]], the '''modulo operation''' returns the [[remainder]] or signed remainder of a [[Division (mathematics)|division]], after one number is divided by another, the latter being called the ''[[modular arithmetic|modulus]]'' of the operation. Given two positive numbers {{math|''a''}} and {{math|''n''}}, {{math|''a''}} modulo {{math|''n''}} (often abbreviated as {{math|''a'' mod ''n''}}) is the remainder of the [[Euclidean division]] of {{math|''a''}} by {{math|''n''}}, where {{math|''a''}} is the [[Division (mathematics)|dividend]] and {{math|''n''}} is the [[divisor]].<ref>{{Cite web|last=Weisstein|first=Eric W.|title=Congruence|url=https://mathworld.wolfram.com/Congruence.html|access-date=2020-08-27|website=Wolfram MathWorld |language=en}}</ref> For example, the expression "5 mod 2" evaluates to 1, because 5 divided by 2 has a [[quotient]] of 2 and a remainder of 1, while "9 mod 3" would evaluate to 0, because 9 divided by 3 has a quotient of 3 and a remainder of 0. Although typically performed with {{math|''a''}} and {{math|''n''}} both being [[integer]]s, many computing systems now allow other types of numeric operands. The range of values for an integer modulo operation of {{math|''n''}} is 0 to {{math|''n'' β 1}}. {{math|''a''}} mod 1 is always 0. When exactly one of {{math|''a''}} or {{math|''n''}} is negative, the basic definition breaks down, and [[programming languages]] differ in how these values are defined.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)