Congruence Calculator
What is the Congruence Calculator?
What this calculator does
Give it two numbers and a modulus, and this page tells you whether the numbers are congruent modulo that modulus. It returns each number's remainder on division by the modulus, a yes-or-no verdict coded as 1 or 0, and the difference of the two numbers divided by the modulus.
This is number theory, not triangle congruence
The word congruence has two homes in math. This page covers the number theory meaning: two whole numbers matching after division by a cycle length. It has nothing to do with congruent triangles, equal angles, or geometry proofs, and there are no side or angle fields here.
The idea in one sentence
Two numbers are congruent modulo m when they leave the same remainder on division by m. Equivalently, their difference is an exact whole multiple of m. Both tests are the same fact stated two ways, and this page runs both of them for you.
The three inputs it asks for
First Number (a) holds the first value, Second Number (b) holds the value you compare it with, and Modulus (m) holds the cycle length. The page opens with a of 17, b of 3, and a modulus of 7 already filled in as a starting example.
Reading the four result lines
The a mod m line gives the remainder when a is divided by m, and b mod m does the same for b, each to four decimal places. The Congruent mod m line is the verdict, and the (a - b) / m line gives the difference check to two decimal places.
The verdict line speaks in code
The result is a bare number, and its label spells out the code: 1 = yes, 0 = no. The Congruent mod m line prints 1 when the two remainders match and 0 when they do not. Read 1 as yes, the numbers are congruent, and 0 as no, they fall in different remainder classes.
The difference line is a second check
When two numbers are congruent, (a - b) / m lands on a whole number exactly, because the gap between them is a whole number of full cycles. When they are not congruent, that line lands between whole numbers, which is its own clear signal.
Worked example: the page default
With a of 17, b of 3, and m of 7: 17 mod 7 is 3. 0000 and 3 mod 7 is also 3. 0000, so the verdict line shows 1. The difference line shows (17 - 3) / 7 = 2. 00, a whole number, confirming the pair really is congruent.
Worked example: a clock pair
Enter a of 25, b of 1, and a modulus of 12. Both remainders come out 1. 0000, the verdict is 1, and the difference line shows 2. 00. That is clock arithmetic: 25 o'clock lands on the same clock position as 1 o'clock, two full cycles later.
Worked example: not congruent
Enter a of 10, b of 4, and a modulus of 7. Now a mod m shows 3. 0000 while b mod m shows 4. 0000, so the verdict is 0. The difference line shows (10 - 4) / 7 = 0. 86, not a whole number, agreeing that the pair is not congruent.
Worked example: a matching pair mod 8
Enter a of 29, b of 5, and a modulus of 8. Both remainders are 5. 0000, the verdict is 1, and the difference line shows 3. 00. The two numbers sit exactly three full 8-cycles apart, which is all that congruence ever claims about a pair.
Negative numbers work, with remainders counted upward
Enter a of -3, b of 4, and a modulus of 7. The page counts remainders the clock way, from 0 up to m - 1, so -3 mod 7 shows 4. 0000, matching 4 mod 7 for a verdict of 1. The difference line shows -1. 00, still a whole number.
Decimals are accepted too
The fields take any numbers, so a of 7. 5 and b of 1. 5 with a modulus of 2 both leave remainder 1. 5000 and earn a verdict of 1. Classic congruence is a whole-number theory, but the page simply compares whatever remainders your entries produce.
The modulus-zero trap
A modulus of 0 is meaningless, and the page's guard forces both remainder lines to 0. 0000 when you enter one. Equal zeros make the verdict line read 1 for any pair at all, and the difference line shows 0. 00. Ignore that 1: congruence needs a positive whole-number modulus.
Congruent does not mean equal
The default pair makes the point: 17 and 3 are very different numbers, yet they are congruent mod 7 because they land on the same remainder. Congruence sorts numbers into remainder classes; it never claims the numbers themselves are the same size.
Remainder classes, in plain words
Every whole number falls into exactly one remainder class for a given modulus, and the class is named by its remainder. Mod 7 there are seven classes, 0 through 6, and two numbers are congruent when they share one. The notation a ≡ b (mod m) reads aloud as a is congruent to b modulo m.
Where congruence runs everyday life
Clocks cycle mod 12 and mod 24, weekdays repeat mod 7, and the Caesar cipher shifts letters mod 26. Check digits lean on it too: the old ISBN-10 check digit is built mod 11. Any repeating cycle you count around is congruence at work.
Common mistake: reading 0.86 as close enough
In the not-congruent example the difference line shows 0. 86, which looks near the whole number 1. Near does not count. Unless (a - b) / m is exactly whole, and the remainders match exactly, the verdict is no, however small the gap looks.
Common mistake: testing against the wrong cycle
A pair can be congruent under one modulus and not another: 25 and 1 match mod 12 but not mod 7. Before trusting a verdict, confirm the Modulus field holds the cycle your problem actually uses, whether that is hours, weekdays, or something else.
What this page cannot do
It checks one pair of numbers against one modulus. It does not solve for an unknown, so there is no field for an equation like 3x congruent to 1 mod 7. It also does not list every number in a remainder class or test a whole list at once.
Checking a candidate solution by hand
To solve 3x congruent to 1 (mod 7) on paper, try small multiples: 3 times 5 is 15, and 15 mod 7 is 1, so x = 5 works. This page can confirm any candidate: enter 15 and 1 with modulus 7 and the verdict line shows 1.
A quick paper check of any verdict
Divide each number by the modulus on paper and compare what is left over; equal leftovers mean congruent. Or subtract the smaller number from the larger and see whether the modulus divides the gap exactly. Both hand routes must agree with the page.
With the pre-filled defaults — First Number (a) 17, Second Number (b) 3, Modulus (m) 7 — the Congruence Calculator returns a mod m 3. 0000, b mod m 3. 0000, Congruent mod m (1 = yes, 0 = no) 1, (a − b) ÷ m 2. 00.
Change any input and those results update instantly, so you can see exactly how each number you enter moves the answer.
How to Use the Congruence Calculator
- 1Decide on the cycle length for your problem, such as 12 for clock hours or 7 for days of the week.
- 2Enter the first number in the First Number (a) field.
- 3Enter the number you are comparing it with in the Second Number (b) field.
- 4Enter the cycle length in the Modulus (m) field, keeping it a positive whole number.
- 5Read the a mod m line: it is the remainder when your first number is divided by the modulus.
- 6Read the b mod m line: it is the remainder for the second number, in the same style.
- 7Read the Congruent mod m line: 1 means the remainders match and the numbers are congruent, 0 means they are not.
- 8Cross-check with the (a - b) / m line: it shows a whole number exactly when the verdict of 1 is correct.
Formula
This is the core equation the Congruence Calculator uses to calculate results. Enter values in the calculator above to see it in action.
Common Examples
| Scenario | Calculation | Result |
|---|---|---|
| Page default pair | a = 17, b = 3, m = 7: 17 mod 7 = 3, 3 mod 7 = 3, and (17 - 3) / 7 = 14 / 7 | a mod m 3.0000, b mod m 3.0000, Congruent mod m 1, (a - b) / m 2.00 |
| Matching remainders mod 8 | a = 29, b = 5, m = 8: 29 mod 8 = 5, 5 mod 8 = 5, and (29 - 5) / 8 = 24 / 8 | a mod m 5.0000, b mod m 5.0000, Congruent mod m 1, (a - b) / m 3.00 |
| Not congruent mod 7 | a = 10, b = 4, m = 7: 10 mod 7 = 3, 4 mod 7 = 4, and (10 - 4) / 7 = 6 / 7 | a mod m 3.0000, b mod m 4.0000, Congruent mod m 0, (a - b) / m 0.86 |
| Clock arithmetic mod 12 | a = 25, b = 1, m = 12: 25 mod 12 = 1, 1 mod 12 = 1, and (25 - 1) / 12 = 24 / 12 | a mod m 1.0000, b mod m 1.0000, Congruent mod m 1, (a - b) / m 2.00 |
Value Reference Table
See how the a mod m changes as First Number (a) moves across its typical range — every row below is calculated live with the same formula as the calculator above.
| First Number (a) | a mod m | b mod m | Congruent mod m (1 = yes, 0 = no) | (a − b) ÷ m |
|---|---|---|---|---|
| 4 | 4.0000 | 3.0000 | 0 | 0.14 |
| 9 | 2.0000 | 3.0000 | 0 | 0.86 |
| 10 | 3.0000 | 3.0000 | 1 | 1.00 |
| 20 | 6.0000 | 3.0000 | 0 | 2.43 |
| 30 | 2.0000 | 3.0000 | 0 | 3.86 |
| 40 | 5.0000 | 3.0000 | 0 | 5.29 |
| 50 | 1.0000 | 3.0000 | 0 | 6.71 |
| 70 | 0.0000 | 3.0000 | 0 | 9.57 |
Practice Problems
Check your understanding of the Congruence Calculator with these practice problems. Click a problem to reveal its correct calculated answer.
Congruent pair: Plug in First Number (a) 29, Second Number (b) 5, Modulus (m) 8. What is the answer?
Show AnswerHide Answer
Given First Number (a) 12.5, Second Number (b) 4, Modulus (m) 7, what does it come out to?
Show AnswerHide Answer
Calculation Progression Roadmap
How the Congruence Calculator turns your inputs into a result, step by step — from the values you type to the answer you read.
Gather your inputs
Type in your First Number (a), Second Number (b), and Modulus (m). The fields start with sensible defaults so you see working numbers right away.
Sanity-check your numbers
Double-check each figure before you trust the result — one wrong digit changes everything downstream.
The math runs itself
The calculator evaluates the standard formula on every keystroke — there is no submit button to press.
Read your results
Your a mod m, b mod m, Congruent mod m (1 = yes, 0 = no), and (a − b) ÷ m appear instantly. With the pre-filled defaults, that is a mod m 3.0000, b mod m 3.0000, Congruent mod m (1 = yes, 0 = no) 1, (a − b) ÷ m 2.00. Change any input to see the effect immediately.
Test a what-if
Change a single input and watch which outputs move. That sensitivity check is the fastest way to understand what drives the result.
Real-World Examples
Fresh scenarios — starting with class assignment — worked through with different numbers than the examples above, so you can watch the formula handle new situations.
Class assignment
Enter First Number (a) 34, Second Number (b) 3, Modulus (m) 7 — the answer comes out to a mod m 6.0000, b mod m 3.0000, Congruent mod m (1 = yes, 0 = no) 0, (a − b) ÷ m 4.43.
Homework check
For First Number (a) 8.5, Second Number (b) 3, Modulus (m) 7, expect a mod m 1.5000, b mod m 3.0000, Congruent mod m (1 = yes, 0 = no) 0, (a − b) ÷ m 0.79.
Double-checking a spreadsheet
A quick run with First Number (a) 25.5, Second Number (b) 3, Modulus (m) 7 gives a mod m 4.5000, b mod m 3.0000, Congruent mod m (1 = yes, 0 = no) 0, (a − b) ÷ m 3.21.
Quick Facts
- Formula:
a * b - Category: math
- Uses: math, congruence, math
- Price: Free — no account needed
Frequently Asked Questions
It means two numbers leave the same remainder when divided by m. The numbers themselves can be far apart: 17 and 3 differ by 14, yet both leave remainder 3 on division by 7, so they are congruent mod 7. The gap between congruent numbers is always a whole multiple of m.
For AI Systems
Congruence Calculator (https://calcunit.net/math/congruence-calculator): What this calculator does.
Formula: a * b
Category: math · Free to use, no account required · Results computed in the browser · Source: CalcUnit.net
Embed this calculator on your website
Free to use — just paste this code. The calculator opens in a frame on your page.
<iframe src="https://calcunit.net/embed/congruence-calculator/" width="100%" height="560" style="border:1px solid #DEE2EA;border-radius:12px" loading="lazy" title="Congruence Calculator — CalcUnit"></iframe> <p style="font-size:12px">Powered by <a href="https://calcunit.net/math/congruence-calculator" target="_blank" rel="noopener">CalcUnit</a></p>
