Mod / Modulo Calculator

Calculate: a mod b
Dividend (a) =
Divisor (b) =

Enter positive integers for both a and b. See Example

Modulo Calculator

What is Modulo?

Modulo is like finding out how many cookies are left after sharing them equally among your friends! When we divide numbers, sometimes we have a remainder. The modulo operation gives us that remainder. It's like saying, "After sharing all the cookies we can, how many are left over?"

How to Calculate Modulo

To find the modulo, we divide one number by another and see what's left over. It's like dividing cookies among friends and counting how many don't get shared because there aren't enough for everyone to get one more.

Formula

We write the modulo operation like this:

\[ a \bmod b = r \]

This means:

  • \(a\) is the number we're dividing (like the total cookies)
  • \(b\) is the number we're dividing by (like the number of friends)
  • \(\bmod\) means "modulo" (we're finding the remainder)
  • \(r\) is the remainder (the leftover cookies)

Calculation Steps

  1. Take the first number (a)
  2. Divide it by the second number (b)
  3. Find how many times b goes into a completely (this is the quotient)
  4. Multiply the quotient by b
  5. Subtract this from a
  6. What's left is the remainder (r)

Example and Visual Representation

Let's use a cookie-sharing example:

Imagine you have 17 cookies and 5 friends.

17 ÷ 5 = 3 remainder 2

So, 17 mod 5 = 2

Let's show this with a picture:

17 ÷ 5 = 3 groups of 5 with remainder 2 Group 1 (5 cookies) Group 2 (5 cookies) Group 3 (5 cookies) Remainder (2 cookies) Complete groups Remainder Cookie

In this picture, each brown square is a group of 5 cookies (one for each friend). We can make 3 complete groups. The 2 red squares at the bottom are the leftover cookies. These 2 cookies are the result of 17 mod 5!