Modulo Calculator

Discover the remainder after division with our intuitive Modulo Calculator. Enter two numbers and explore the magic of 'a mod n' in real-time!

a =

Dividend - the number to be divided.

n =

Divisor - the number that divides 'a'.

Result:

Calculation Steps:

Error:

Understanding Modulo Operation

The modulo operation, often denoted as mod or %, is a fundamental concept in mathematics and computer science. It essentially finds the remainder when one number is divided by another.

Formula

For two numbers, a (dividend) and n (divisor or modulus), the modulo operation is expressed as:

$$ a \mod n = r $$

Where r is the remainder, such that a = qn + r, and 0 ≤ |r| < |n|. Here, q is the quotient.

Examples

  • 17 mod 5 = 2 because when 17 is divided by 5, the remainder is 2. (17 = 3 × 5 + 2)
  • 25 mod 5 = 0 as 25 is perfectly divisible by 5 with no remainder. (25 = 5 × 5 + 0)
  • -11 mod 3 = 1. For negative numbers, the remainder is adjusted to ensure it's non-negative when the divisor is positive. (-11 = -4 × 3 + 1)

Use Cases

  • Computer Science: Widely used in hashing, cryptography, and array indexing.
  • Time and Angles: Useful for calculations involving cycles, like time in 12-hour format or angles in degrees.
  • Mathematics: Fundamental in number theory, modular arithmetic, and various mathematical proofs.