Lbl goal desc
| Lbl col step | Lbl col dividend | Lbl col divisor | Lbl col quotient | Lbl col remainder | Lbl col bezout s | Lbl col bezout t |
|---|---|---|---|---|---|---|
| 1 | 24 | 19 | 1 | 5 | 1 | 0 |
| 2 | 19 | 5 | 3 | 4 | -1 | 1 |
| 3 | 5 | 4 | 1 | 1 | 4 | -3 |
| 4 | 4 | 1 | 4 | 0 | -5 | 4 |
19 + 130 \equiv 5 \pmod{24}Modular arithmetic calculator to solve mod equations, modular inverse, powers, and congruences. Step-by-step Euclidean algorithm and clock math visualizer.
Lbl goal desc
| Lbl col step | Lbl col dividend | Lbl col divisor | Lbl col quotient | Lbl col remainder | Lbl col bezout s | Lbl col bezout t |
|---|---|---|---|---|---|---|
| 1 | 24 | 19 | 1 | 5 | 1 | 0 |
| 2 | 19 | 5 | 3 | 4 | -1 | 1 |
| 3 | 5 | 4 | 1 | 1 | 4 | -3 |
| 4 | 4 | 1 | 4 | 0 | -5 | 4 |
19 + 130 \equiv 5 \pmod{24}Stat1 desc
Stat2 desc
Stat3 desc
Modular arithmetic calculator to solve mod equations, modular inverse, powers, and congruences. Step-by-step Euclidean algorithm and clock math visualizer.
Primary integer operand being divided or exponentiated. Can be positive, negative, or zero, handled via BigInt without 64-bit IEEE 754 precision loss.
Positive integer divisor defining the finite residue ring Z_m. Must be an integer greater than 0; moduli m >= 2 form rings, and prime moduli form finite fields GF(p).
The uniquely determined remainder satisfying a = q * m + r where 0 <= r < m under standard mathematical Euclidean division.
An integer x such that (a * x) = 1 (mod m). Exists if and only if gcd(a, m) = 1 (coprime); computed via the Extended Euclidean Algorithm.
The count of positive integers up to m that are relatively prime to m. In modular arithmetic, a^phi(m) = 1 (mod m) for all gcd(a, m) = 1 (Euler's totient theorem).
In C, C++, and JavaScript, the % operator is a remainder operator that retains the sign of the dividend (e.g., -7 % 5 = -2). In discrete mathematics and Python, modulo is Euclidean or floored, always yielding 0 <= r < m (e.g., -7 mod 5 = 3). For mathematical correctness in JavaScript, always normalize with ((n % m) + m) % m.
You cannot divide by an integer b in modular arithmetic by computing a / b mod m. Instead, modular division (a / b) mod m is defined as (a * b^-1) mod m, which exists only when gcd(b, m) = 1. If gcd(b, m) > 1, division is undefined even if b evenly divides a in ordinary arithmetic.
Never calculate (a^b) mod m by first computing a^b and then applying modulo. Even moderate powers like 3^1000 have hundreds of digits and exhaust stack memory. Always use binary square-and-multiply, reducing modulo m at every intermediate squaring step to maintain numbers under m^2.
When solving a * x = b (mod m), if d = gcd(a, m) > 1 and d divides b, there is not just one solution, but exactly d distinct incongruent solutions modulo m, spaced precisely by m / d.
Check the greatest common divisor of operand a and modulus m. The modular multiplicative inverse a^-1 mod m exists if and only if gcd(a, m) = 1. If gcd(a, m) = d > 1, a shares a common prime factor with m, making a * x always a multiple of d, which can never equal 1 mod m.
Switch the Modulo Regime Selector from 'Programming Truncated' to 'Mathematical Non-Negative'. Computer programming languages truncate division toward zero, whereas discrete math requires 0 <= r < m. Our calculator automatically computes ((n % m) + m) % m when set to canonical mode.
Division by zero or modulo zero is mathematically undefined because no unique quotient q exists such that a = q * 0 + r. Ensure your modulus m is an integer strictly greater than or equal to 1 (or >= 2 for non-trivial rings).
CRT requires all moduli m_1, m_2, ..., m_k to be pairwise coprime (gcd(m_i, m_j) = 1 for all i != j). If any two moduli share common factors, check whether the simultaneous congruences are mutually consistent using generalized CRT; otherwise, no integer solution exists.
To calculate the mathematical modulo of a negative number n mod m, use the Euclidean formula r = ((n % m) + m) % m. For example, for -17 mod 5, dividing -17 by 5 gives a quotient of -4 and a remainder of 3, because -4 * 5 + 3 = -17. While programming languages like C++ and JavaScript return -2 due to zero-truncated division, discrete mathematics defines remainder as strictly non-negative: 0 <= r < m.
A modular multiplicative inverse of an integer a modulo m is an integer x satisfying (a * x) = 1 (mod m). It exists if and only if a and m are coprime, meaning gcd(a, m) = 1. When coprime, the Extended Euclidean Algorithm computes integers x and y such that a * x + m * y = 1; the coefficient x reduced modulo m is the unique modular inverse.
The difference lies in how integer division handles rounding: remainder operators (like % in C, C++, and JavaScript) truncate the quotient toward zero (trunc(a / m)), causing negative dividends to produce negative remainders. The mathematical modulo operator floors the quotient toward negative infinity (floor(a / m)), ensuring the remainder is always non-negative and falls within 0 <= r < m.
To solve a * x = b (mod m), first compute d = gcd(a, m). If d does not divide b, no solutions exist. If d divides b, divide the entire equation by d to get (a/d) * x = (b/d) (mod m/d). Then find the modular inverse k = (a/d)^-1 mod (m/d) using the Extended Euclidean Algorithm. The base solution is x_0 = (k * (b/d)) mod (m/d), and the complete set of d distinct solutions modulo m is given by x_i = x_0 + i * (m / d) for i = 0, 1, ..., d - 1.
Calculate OEE (Overall Equipment Effectiveness) instantly. Track Availability, Performance, and Quality, analyze Six Big Losses, and simulate throughput gains.
Calculate crawl space vapor barrier square footage, rolls, seam tape, foundation butyl, and pier wrap. Includes IRC R408.3 code checks, roll optimizer, and costs.
Calculate hydraulic cylinder push and pull force, annular piston area, stroke velocity, cycle time, pump motor HP, and Euler rod buckling limits in real time.
Enterprise-grade SaaS Magic Number, CAC Payback, and Sales Efficiency calculator. Features gross margin adjustment, lagged S&M modeling, reverse target goal solving, and dynamic sensitivity matrix analysis based on Scale Venture Partners and Bessemer benchmarks.
Calculate exact V-belt pitch, inside, and outside lengths, center distance, sheave wrap angles, and snap to nearest standard RMA or ISO catalog sizes.
Professional engineering calculator for wire rope tension, crane multi-part reeving efficiency, bridle sling vector forces, winch snatch blocks, and catenary guy wire sag-tension. Complies with ASME B30.5, ASME B30.9, OSHA 1926.1414, and EN 12385 standards with dynamic D/d bending derates and reverse safety factor sizing.