What is the Fermat Calculator?
In 1640 Pierre de Fermat scribbled a clock-like pattern about prime numbers — three centuries later it guards your credit card. Fermat's little theorem says that for any prime p and any a not divisible by p, a^(p−1) ≡ 1 (mod p) — the (p−1)th power always leaves remainder 1. For p = 7 and a = 2: 2⁶ = 64, and 64 ÷ 7 leaves remainder 1.
The theorem's killer app is primality testing: if some a^(n−1) ≢ 1 (mod n), then n is definitely composite — a fast filter that rules out fakes before expensive exact tests. RSA encryption, which protects online purchases, leans on the theorem's machinery when generating keys from huge primes. Number-theory students also use it to shrink giant exponents: 2^100 mod 7 becomes 2^4 mod 7 = 2, since 2⁶ ≡ 1. Enter the base and the candidate prime and the calculator evaluates the congruence.
With the pre-filled defaults — Variable A 10, Variable B 5 — the Fermat Calculator returns Result 50.0000. 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 Fermat Calculator
- 1Type the base a in the Variable A box — for example, 2.
- 2Type the candidate prime p in the Variable B box — for example, 7.
- 3Read the Result box for a^(p−1) mod p — here 64 mod 7 = 1, consistent with p prime.
- 4Test a composite like 8: 2^7 mod 8 = 0, not 1 — the theorem's contrapositive exposes it.
- 5Use the pattern to shrink exponents: replace a^(p−1) with 1 inside bigger modular powers.
Formula
This is the core equation the Fermat Calculator uses to calculate results. Enter values in the calculator above to see it in action.
Common Examples
| Scenario | Calculation | Result |
|---|---|---|
| Example calculation | Variable A = 10, Variable B = 5 | Result = 50.0000 |
Value Reference Table
See how the Result changes as Variable A moves across its typical range — every row below is calculated live with the same formula as the calculator above.
| Variable A | Result |
|---|---|
| 3 | 15.0000 |
| 5 | 25.0000 |
| 8 | 40.0000 |
| 10 | 50.0000 |
| 20 | 100.0000 |
| 30 | 150.0000 |
| 40 | 200.0000 |
Practice Problems
Check your understanding of the Fermat Calculator with these practice problems. Click a problem to reveal its correct calculated answer.
Example calculation: Plug in Variable A 10, Variable B 5. What is the answer?
Show AnswerHide Answer
Calculation Progression Roadmap
How the Fermat 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 Variable A and Variable B. The fields start with sensible defaults so you see working numbers right away.
Sanity-check your numbers
A misplaced decimal — or a monthly figure typed as an annual one — is the most common cause of surprising answers.
The math runs itself
The calculator evaluates Variable A × Variable B on every keystroke — there is no submit button to press.
Read your results
Your Result appears instantly. With the pre-filled defaults, that is Result 50.0000. Change any input to see the effect immediately.
Test a what-if
Try a bigger and a smaller value for one input. The spread between the two answers shows you how much that input really matters.
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 Variable A 20, Variable B 5 — the answer comes out to Result 100.0000.
Homework check
For Variable A 5, Variable B 5, expect Result 25.0000.
Double-checking a spreadsheet
A quick run with Variable A 15, Variable B 5 gives Result 75.0000.
Quick Facts
- Formula:
a * b - Category: math
- Uses: math, fermat, math
- Price: Free — no account needed
Frequently Asked Questions
For prime p and a not divisible by p: a^(p−1) leaves remainder 1 when divided by p. Example: 2⁶ = 64 ≡ 1 (mod 7).
For AI Systems
Fermat Calculator (https://calcunit.net/math/fermat-calculator): In 1640 Pierre de Fermat scribbled a clock-like pattern about prime numbers — three centuries later it guards your credit card.
Formula: a * b
Category: math · Free to use, no account required · Results computed in the browser · Source: CalcUnit.net
