This modulo calculator is a handy tool if you need to find the result of modulo operations. All you have to do is input the initial number x and integer y to find the modulo number r, according to
x mod y = r. Read on to discover what modulo operations are, how to calculate modulo and how to use this calculator correctly.
What are modulo operations?
Imagine a clock hanging on a wall. Let's say it is late at night – 11 pm 🕚. You wonder what the time will be when you wake up after 8 hours of sleep. You can't just add 8 to 11, as there is no such time as 19 am. To find the correct answer, you need to perform a modulo operation (mod 12) – you add these two numbers, and keep subtracting 12 until you get a number lower than 12. In this case, 7. You just calculated you will wake up at 7 am 🕖.
Modulo operations in the case of the clock are so intuitive we don't even notice them. In mathematics, there are many types of more elaborate modulo operations that require more thought. We can write down that:
x mod y = r
is true if such an integer
q (called quotient) exists, then:
y * q + r = x.
If the modulo definition doesn't appeal to you, and you're still unsure how to calculate modulo, have a look at the next paragraph, and everything should become crystal clear.
What is modulo congruence?
b are said to be congruent modulo n when their difference
a - b is integrally divisible by
(a - b) is a multiple of
Mathematically, the modulo congruence formula is written as:
a ≡ b (mod n),
n is called the modulus of a congruence.
Alternately, you can say that
b are said to be congruent modulo n when they both have the same remainder when divided by n:
a mod n = r
b mod n = r
r is a common remainder.
So, to put it simply – modulus congruence occurs when two numbers have the same remainder after the same divisor. So for example: 24 modulo 10 and 34 modulo 10 give the same answer: 4. Therefore, 24 and 34 are congruent modulo 10.
Let's have a look at another example:
9 ≡ 21 (mod 6),
21 - 9 = 12 is a multiple of 6. It can also be written in short as
6 | (21 - 9). Or, equivalently, 21 and 9 have the same remainder when we divide them by 6:
9 mod 6 = 3
21 mod 6 = 3
How to calculate the modulo – an example
It's not a difficult task to calculate the modulo by hand. Just follow the steps below!
- Start by choosing the initial number (before performing the modulo operation). Let's say it is 250. This is our dividend.
- Choose the divisor. Let's pick 24. The operation we want to calculate is then
250 mod 24(
250 % 24if using different convention).
- Divide one number by the other, rounding down:
250 / 24 = 10. This is the quotient. Also, you can think of that operation as an integer division – the type of the division, where we aren't concerned about the fractional part of the result.
- Multiply the divisor by the quotient. So it's
10 * 24 = 240in our example.
- Subtract this number from your initial number (dividend). Here:
250 - 240 = 10.
- The number you obtain is the result of the modulo operation. We can write it down as
250 mod 24 = 10.
How to use our mod calculator? 10 mod 3 and other modulo examples
Determining a modulo with our tool is easy and convenient. To find the result of modulo operations between integer numbers, you need to:
- Type the initial number – dividend – into the first box. Let's take the example from the one of previous paragraphs, so enter 250.
- Enter the divisor. It's 24 in our case.
- Tadaaa! Our modulo calculator will return to you your result – the remainder! And that's not a surprise, it's equal to 10 – the same number as we calculated before.
Below, you'll find some typical queries concerning the modulo:
- 1 mod 1 = 0 (as mod 1 is always 0)
- 1 mod 2 = 1
- 1 mod 3 = 1
- 5 mod 2 = 1
- 5 mod 3 = 2
- 6 mod 3 = 0
- 7 mod 3 = 1
- 10 mod 3 = 1
- 18 mod 3 = 0
- 100 mod 3 = 1
- 100 mod 7 = 2
If you don't see the one you want to find here, don't hesitate to use our modulo calculator!
Modular arithmetic is, generally speaking, an arithmetic system for integers, where numbers "wrap around" a certain number. Let's sum up what we've learned about different representations of modulo operations – all those statements below are equivalents:
A ≡ B (mod C)
A mod C = B mod C
C | (A - B)
A = B + K * Cwhere
Kis a some integer.
We can also perform calculations on modulo operations.
1. Modular addition and subtraction
(A + B) mod C = (A mod C + B mod C) mod C
(A - B) mod C = (A mod C - B mod C) mod C
So, the modulo of the sum of two numbers is equal to the sum of the modulo of those numbers calculated separately, then multiplied by the modulo divisor. The first stage is made to get rid of the quotient part, and then the mod operation is used again. Have a look at the example:
A = 11, B = 7, C = 4
(11 + 7) mod 4 = (11 mod 4 + 7 mod 4) mod 4
left part of the equation:
(11 + 7) mod 4 = 18 mod 4 = 2
right part of the equation:
(11 mod 4 + 7 mod 4) mod 4 = (3 + 3) mod 4 = 6 mod 4 = 2
Analogically, the calculations are the same for subtraction.
2. Modular multiplication
(A * B) mod C = (A mod C * B mod C) mod C
Such an equation may be useful when dealing with big numbers, and we don't know the modulo of that large number instantly. Let's have a look at the same example (A = 11, B = 7, C = 4) – can you find the result of
77 mod 4 on the spot?
11 mod 4 and
7 mod 4 are easier to calculate:
(11 * 7) mod 4 = (11 mod 4 * 7 mod 4) mod 4
Left part of the equation:
(11 * 7) mod 4 = 77 mod 4 = 1
Right part of the equation:
(11 mod 4 * 7 mod 4) mod 4 = (3 * 3) mod 4 = 9 mod 4 = 1
3. Modular exponentiation
A^B mod C = ((A mod C)^B) mod C
This formula is even more useful when dealing with large numbers. Consider the same example:
(11 ^ 7) mod 4 = ((11 mod 4)^7) mod 4
Left part of the equation:
(11 ^ 7) mod 4 = 19487171 mod 4 = 3
Right part of the equation:
((11 mod 4)^7) mod 4 = (3^7) mod 4 = 2187 mod 4 = 3
The usefulness of this formula may be not so obvious in this example, as we still need to use the calculator to find the exponentiation result (assuming that you don't know the result of 3^7 immediately). So have a look at another problem: we want to calculate the
A^B mod C for large values of B – like, e.g., 100. Unfortunately, our calculator can't handle numbers as big as this due to overflow – only numbers up to 2^60 can be held. You can, however, use the multiplication properties to get around this problem:
2^100 = 2^50 * 2^50
2^100 mod 3 = (2^50 mod 3 * 2^50 mod 3) mod 3
2^100 mod 3 = (1 * 1) mod 3 = 1
Even faster modular exponentiation methods exist for some specific cases (if B is a power of 2). If you want to read about them and practice modular arithmetic, check out our dedicated power mod calculator.
Modulo definition ambiguity
The word modulo comes from a Latin word modus meaning a measure. Usually, when we use the word modulo, we mean the modulo operation, like, e.g., 11 mod 3 equals 2 – so it's simply finding the remainder. In a strict definition, the modulo means:
With respect to specified modulus
A is the same as B modulo C, except for differences accounted for or explained by C
Which is the definition we wrote about in congruence modulo paragraph.
However, modulo is not only used in a mathematical context. Sometimes you may hear it in everyday conversation, where it probably means ignoring, not accounting for something, with due allowance for something, e.g.,
The design was best so far, modulo that parts that still need some modification.
Percent – a symbol of a modulo operation
The modulo operation is often used in programming languages. For this, % – percent – is used to denote this operation (or sometimes the remainder operator, for negative numbers). If you're curious about the origins of the % sign, we strongly encourage you to read the short paragraph we put together about the.
You do need to be careful, as there's some ambiguity with the modulo definition when negative values are taken into account. There are two possible choices for the remainder – one negative and the other positive – and the result depends on the implementation in the chosen programming language.
They might not be obvious at first glance, but there are many applications of modulo – from everyday life to math and science problems!
- The most obvious and well-known example is the so-called clock arithmetic 🕞. It may be adding the hours, like in the explanation of modulo above, or minutes, or seconds as well!
Nobody will say that "you have 40 minutes and 90 seconds left", right? The only option is to perform a modulo operation and find the quotient and remainder –
60 * 1 + 30 = 90. 41 minutes and 30 seconds sounds much better.
- Modulo operations are used to calculate the checksums of serial numbers. Check digits are used mostly in long numbers, and they are the digits computed by an algorithm. They are there to inform you about errors arising, e.g., from mistyping. You can find the application of modulo in:
- GTIN, UPC, EAN check digits are used to confirm the integrity of a barcode. The formula for the check digits use modulo 10.
- ISBN and ISSN numbers, which are unique periodic and book identifiers, have modulo 11 or modulo 10, and an average weighting applied in check digit formula.
- IBAN — International Bank Accounts Numbers - make use of modulo 97 to check whether a client didn't mistype the number.
- NPI — US National Provider Identifier use the modulo 10 operation to calculate the tenth digit.
As the check digits are used to capture human transcription errors, they are often used for long serial numbers. Other examples of check digits algorithms using modulo operations:
- National identification number (e.g. in Iceland, Turkey, Poland)
- Fiscal identification number (Spain)
- Vehicle identification number (US)
- ...and many, many more.
It is applied in many scientific areas, like computer algebra, cryptography, computer science, or simple school math – like in a Euclidean algorithm for greatest common factor calculation.
Modulo is useful whenever you need to split something. A real-life example may be sharing a pizza with your friends or family.
There's even uses for modulo in Minecraft.
mod 64will tell you how many full stacks of cobblestone you'll need to build that creeper statue.
Assuming that there are 10 slices in a big party pizza, and you are a group of three. How many slices are left when you share the pizza equally?
That's exactly the case when you can use modulo!
10 mod 3 = 1. In other words, 10 divided by 3 equals 3, but it remains 1 slice left 🍕. That was not the most difficult example, but we hope you can see the usefulness of modulo.
By the way, have you seen our collection of pizza calculators? We have the amazing pizza party calculator, which can help to estimate how much pizza you need to order, but also the tools helping to compare pizza sizes – if you ever wondered if it's better to buy two medium pizzas or just one large, the pizza comparison calculator is a safe bet. We've also prepared calculators for those who'd like to bake the perfect pizza themselves!
Oh, no! We're getting hungry. Let's leave this yummy distraction and go back to Earth. If you're interested in finding more funny applications of modular arithmetic, check out thisblog post.
Learn more about modulo
What is a modulo operator?
The modulo operator is used to find the remainder during a division of two numbers. The operator is represented by the symbol
% in most programming languages. It is also known as the remainder operator. As an example,
How to calculate modulo division?
To calculate modulo division:
- Subtract the divisor from the dividend until the resultant is less than the divisor.
What are the components of modulo division?
The components of modulo division are dividend, divisor, quotient, and remainder. The remainder is the answer or end result of the operation.
How much is 17 mod 3?
17 mod 3 is equal to 2.