Difference between Modulo and Modulus
In the world of Programming and Mathematics we often encounter the two terms “Modulo” and “Modulus”. In programming we use the operator “%” to perform modulo of two numbers. It basically finds the remainder when a number x is divided by another number N.
It is denoted by :
x mod N where x : Dividend N : Divisor
Some important links to find out more about concepts in Modular Arithmetic :
- Modular Arithmetic
- Euler’s Totient Function
- Compute n! under modulo p
- Wilson’s Theorem
- How to compute mod of a big number?
- Find value of y mod (2 raised to power x)
- Modulus Operator in C
- Modulus of Negative Numbers
In this article we are going to see the difference between the two terms, modulo and modulus, used frequently in Modular Arithmetic.
It is basically an operator which is denoted by “mod” and, in programming, uses “%”. It is a function which returns the remainder value when a number is divided by another number.
For example –
1. 12 mod 5 // 12 modulo 5 2. 38 ≡ 14 (mod 12) // 38,14 are congruent modulo 12
It is simply a noun which is the value N in the expression “x mod N”.
We abbreviate it as N is the modulus.
For example –
1. 12 mod 3 // 3 is the modulus
In the previous example, note that the congruent modulo basically means that the difference of the two numbers is an integer multiple of the modulus 12.
The difference of 38 and 14 is 24 and 24 is double of 12.
It is important to note that these two words can’t be interchanged as it will completely change the meaning. It would be bogus to say that –
1. 12 mod 10 // modulo is 10 2. 38 ≡ 14 (mod 12) // 38,14 are congruent modulus
In terms of English, we can conclude that modulo is a preposition, as prepositions are used before a noun to show some spatial and temporal relations of the noun modulus. The relation in modular arithmetic is the remainder when two numbers are added.