CalcUnit Logo

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

  1. 1Type the base a in the Variable A box — for example, 2.
  2. 2Type the candidate prime p in the Variable B box — for example, 7.
  3. 3Read the Result box for a^(p−1) mod p — here 64 mod 7 = 1, consistent with p prime.
  4. 4Test a composite like 8: 2^7 mod 8 = 0, not 1 — the theorem's contrapositive exposes it.
  5. 5Use the pattern to shrink exponents: replace a^(p−1) with 1 inside bigger modular powers.

Formula

a * b

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

ScenarioCalculationResult
Example calculationVariable A = 10, Variable B = 5Result = 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 AResult
315.0000
525.0000
840.0000
1050.0000
20100.0000
30150.0000
40200.0000

Practice Problems

Check your understanding of the Fermat Calculator with these practice problems. Click a problem to reveal its correct calculated answer.

Q1

Example calculation: Plug in Variable A 10, Variable B 5. What is the answer?

Show Answer
Entering Variable A 10, Variable B 5 gives Result 50.0000.

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.

01

Gather your inputs

Type in your Variable A and Variable B. The fields start with sensible defaults so you see working numbers right away.

02

Sanity-check your numbers

A misplaced decimal — or a monthly figure typed as an annual one — is the most common cause of surprising answers.

03

The math runs itself

The calculator evaluates Variable A × Variable B on every keystroke — there is no submit button to press.

04

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.

05

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.

1

Class assignment

Enter Variable A 20, Variable B 5 — the answer comes out to Result 100.0000.

2

Homework check

For Variable A 5, Variable B 5, expect Result 25.0000.

3

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

Share this Calculator

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