Modulo Calculator [Mod Examples] (2024)

Last updated:

Table of contents

What are modulo operations?What is modulo congruence?How to calculate the modulo – an exampleHow to use our mod calculator? 10 mod 3 and other modulo examplesModular arithmeticModulo definition ambiguityPercent – a symbol of a modulo operationModulo applicationsFAQs

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 and modulo congruence 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

if there exists an integer q (called quotient) that satisfies the equation

y × q + r = x

Otherwise, the number r is the remainder of the division, where x is the dividend, and y is the divisor (our remainder calculator explains how to obtain the remainder of a division).

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?

Two numbers, a and b, are said to be congruent modulo n when their difference a - b is integrally divisible by n (so (a - b) is a multiple of n).

Mathematically, the modulo congruence formula is written as:

a ≡ b (mod n),

and n is called the modulus of a congruence.

Alternately, you can say that a and 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

where 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)

because 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!

  1. Start by choosing the initial number (before performing the modulo operation). Let's say it is 250. This is our dividend.
  2. Choose the divisor. Let's pick 24. The operation we want to calculate is then 250 mod 24 (250 % 24 if using a different convention).
  3. 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.
  4. Multiply the divisor by the quotient. So it's 10 × 24 = 240 in our example.
  5. Subtract this number from your initial number (dividend). Here: 250 - 240 = 10.
  6. 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:

  1. Type the initial number – dividend – into the first box. Let's take the example from the previous paragraphs, so enter 250.
  2. Enter the divisor. It's 24 in our case.
  3. 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

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 × C where K is 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 take the modulo of this result. 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 not be 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 37 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 the 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

or

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 the 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 history of the percent sign.

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.

Modulo applications

They might not be obvious at first glance, but there are many applications of modulo – from everyday life to math and science problems!

  1. 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.

  2. 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 the following:

    • In our check digit calculator:
      • GTIN, UPC, and EAN check digits are used to confirm the integrity of a barcode. The formula for the check digits uses modulo 10.
      • ISBN and ISSN numbers, which are unique periodic and book identifiers, have modulo 11 or modulo 10.
    • 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 uses 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.
  3. It is applied in many scientific areas, like computer algebra, cryptography, computer science, or simple school math – like in a Euclidean algorithm for the greatest common factor calculation.

  4. Modulo is useful whenever you need to split something. A real-life example may be sharing a pizza with your friends or family.

  5. There are even uses for modulo in Minecraft. mod 64 will 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.

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 this betterexplained.com blog post.

FAQs

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, 5 mod 2 returns 1.

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 equals 2 since dividing 17 by 3 gives a quotient of 5 and a remainder of 2. The remainder is the result of the modulus operation. In simpler terms, 17 mod 3 = 2.

Least Common Multiple CalculatorAbsolute Value Calculator
Modulo Calculator [Mod Examples] (2024)

FAQs

What is 40 77 mod 119? ›

40^77 mod 119 ~=(93*72*97)mod 119 ~= 10. (72 comes from 40^4 and 97 comes from 40^3.).

Why is 5 mod 7 5? ›

Modular arithmetic is only concerned with integer divisions, so here we'd just write 5=0×7+5., so the remainder is 5. 5/7 doesn't have a remained of one. 7 goes into 5 zero times, with a remainder 5.

Why is 3 mod 4 3? ›

p≡3(mod4) means that p=4k+3 for some k, or in other words that the remainder when you divide p by 4 is 3. Note that if you take an odd number and divide it by 4, you'll either get 1 or 3 as a remainder, because if you got 0 or 2 as a remainder then the original number would have had to have been even.

What does 144 reduce to mod 11? ›

To reduce a number to mod 11, divide it by 11. The remainder will be the mod 11 result. 144/11 = 13 with a remainder of 1, so it reduces to 1 mod 11.

What is 3 97 mod 353? ›

Calculate 3 to the power of 97 and get 19088056323407827075424486287615602692670648963. Divide 19088056323407827075424486287615602692670648963 by 353 to get the remainder 40.

How to calculate 11 23 mod 187? ›

Answer and Explanation:

Let's find a power of that is less than the original power in modulo . We can use since 11 17 ≡ 11 mod 187 . It means that we have 23 = ( 17 ) + 6 . Therefore, 11 23 ≡ 88 mod 187 .

Why is 3 mod 7 3? ›

Well we know that modulo returns the remainder.

3 / 7 = 0.428 means the highest number that can be multiplied by 7 to get 3 or a value close to 3 is 0. which leaves 3 as our remainder value (0+3=3) so 3 is our answer.

Why is 3 mod 5 3? ›

3mod 5 is divide the first number by the second number and so the remainder. It is an integer value. Since 5 goes into 3 zero times, the answer is 3.

What is the answer to 17 mod 5? ›

The modulus is another name for the remainder after division. For example, 17 mod 5 = 2, since if we divide 17 by 5, we get 3 with remainder 2.

How to calculate mod manually? ›

That's simple,
  1. Divide the two numbers ( eg. 7/3 = 2.333333)
  2. eliminate the decimal part (i.e., make the 2.33333 → 2) ( If there is no decimal part, the MOD value is 0, eg. ...
  3. multiply the divisor with the number you just found out ( 3 * 2 = 6)
  4. now subtract the result from the dividend (7 - 6 = 1, which is your MOD value)
Dec 5, 2020

How to solve mod problems? ›

How to calculate the modulo – an example
  1. Start by choosing the initial number (before performing the modulo operation). ...
  2. Choose the divisor. ...
  3. Divide one number by the other, rounding down: 250 / 24 = 10 . ...
  4. Multiply the divisor by the quotient. ...
  5. Subtract this number from your initial number (dividend).

Why is 2 mod 4 equal to 2? ›

MOD is remainder operator. That is why 2 mod 4 gives 2 as remainder. 4*0=0 and then 2-0=2. To make it more clear try to do same with 6 mod 4 or 8 mod 3.

What is the modulo 11 trick? ›

The status quo divisibility rule for 11 is to take the alternating sum of the digits to see if that's also divisible by 11 (e.g. 517 is divisible by 11 because 5-1+7=11 is divisible by 11). The proof comes from the observation that 10k mod 11 alternates between 1 and -1.

What does Mod 10 do to a number? ›

Mod 10 will give the remainder when a number will be devided by 10. It will be always between 0 to 9 inclusive. Mod can also be calculated for negative numbers.

What is 2 125 mod 127? ›

So, 2 125 mod 127 is equal to 64.

How do I calculate the mod? ›

The modulo is defined as a remainder value when two numbers are divided. The mathematical representation of the modulo function is given as a mod b, where a and b are two numbers. When 16 is divided by 3, the quotient obtained is 5, and it leaves the remainder 1. Hence, the 16 mod 3 is equal to 1.

What does mod of a number mean? ›

Given two positive numbers a and n, a modulo n (often abbreviated as a mod n) is the remainder of the Euclidean division of a by n, where a is the dividend and n is the divisor.

What is the formula for mod number? ›

Example
FormulaDescriptionResult
=MOD(3, 2)Remainder of 3/21
=MOD(-3, 2)Remainder of -3/2. The sign is the same as divisor1
=MOD(3, -2)Remainder of 3/-2. The sign is the same as divisor-1
=MOD(-3, -2)Remainder of -3/-2. The sign is the same as divisor-1

Top Articles
Latest Posts
Article information

Author: Kimberely Baumbach CPA

Last Updated:

Views: 6190

Rating: 4 / 5 (41 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Kimberely Baumbach CPA

Birthday: 1996-01-14

Address: 8381 Boyce Course, Imeldachester, ND 74681

Phone: +3571286597580

Job: Product Banking Analyst

Hobby: Cosplaying, Inline skating, Amateur radio, Baton twirling, Mountaineering, Flying, Archery

Introduction: My name is Kimberely Baumbach CPA, I am a gorgeous, bright, charming, encouraging, zealous, lively, good person who loves writing and wants to share my knowledge and understanding with you.