Calculate remainders with step-by-step solutions, modular arithmetic operations, negative number handling, and real-world applications.
Remainder (mod)
2
The number to be divided
The number to divide by (non-zero)
17 mod 5 = 2
17 = 3 x 5 + 2
Given: 17 mod 5
Formula: a = q x b + r, where r is the remainder
Step 1: Divide 17 by 5
17 / 5 = 3.400000
Step 2: Take the integer part (quotient)
Quotient (q) = 3
Step 3: Calculate remainder
Remainder (r) = 17 - (3 x 5)
Remainder (r) = 17 - 15
Remainder (r) = 2
Result: 17 mod 5 = 2
Verification: 3 x 5 + 2 = 17 = 17
Remainder (mod)
2
Quick-start with common scenarios
Test your skills with practice problems
Practice with 3 problems to test your understanding.
The modulo operation (a mod b) finds the remainder when dividing a by b. For example, 17 mod 5 = 2 because 17 = 3 x 5 + 2. The formula is: a = q x b + r, where q is the quotient and r is the remainder. Modulo is used in clock arithmetic (13:00 mod 12 = 1), day calculations, cryptography, hash functions, and checking divisibility.
The modulo operation finds the remainder after division of one number by another. Written as a mod b or a % b, it returns r such that a = q x b + r where 0 <= r < |b|. Modular arithmetic is fundamental in computer science (array indexing, hash functions), cryptography (RSA encryption), and everyday applications like clock time and calendar calculations.
The modulo operation (mod) finds the remainder when dividing one integer by another. For example, 17 mod 5 = 2 because 17 = 3 x 5 + 2, so the remainder is 2.
Different conventions exist. In JavaScript/C/Java (truncated division), -7 mod 3 = -1. In Python (floored division), -7 mod 3 = 2. The Euclidean definition always returns a non-negative remainder.
Clock arithmetic is modulo 12 (or 24). If it's 10 o'clock and you add 5 hours, you get (10 + 5) mod 12 = 3 o'clock. This is why 13:00 = 1:00 PM.
Modular arithmetic is fundamental to RSA and other encryption algorithms. It provides one-way functions that are easy to compute forward but hard to reverse, making encryption secure.
If a mod b = 0, then a is evenly divisible by b. For example, 15 mod 5 = 0 means 15 is divisible by 5. This is useful for checking even/odd (n mod 2), divisibility rules, and more.
Last updated: 2025-01-15
Explore similar calculators
Remainder (mod)
2