Skip to content

Fermat’s Little Theorem Calculator

This calculator helps you verify Fermat’s Little Theorem or compute modular exponentiation based on it. It’s useful in number theory, cryptography (like RSA), and math competitions. Enter a base number and a prime modulus to see if the theorem holds.

Check Fermat’s Theorem or Compute Modulo Powers

Input Fields
a
Enter an integer a where 1 ≤ a < p
p
Enter a prime number p
If enabled, the result will update automatically when you change any value.

Fermat’s Little Theorem Formula

Formula
$$\text{If } p \text{ is prime and } a \not\equiv 0 \pmod{p}, \text{ then:} \quad a^{p-1} \equiv 1 \pmod{p}$$

Explanation:
Fermat’s Little Theorem states that if $$p$$ is a prime number and a is any integer not divisible by $$p$$, then $$a^{p-1} \mod p = 1$$. It is often used in modular arithmetic and cryptographic algorithms.

Fermat’s Theorem – Calculation Example

Let
$$a = 3,\quad p = 7$$

Check

  1. $$a^{p – 1} \mod p = 3^{7 – 1} \mod 7 = 3^6 \mod 7$$
  2. $$3^6 = 729,\quad 729 \mod 7 = 1$$

Result:
$$\Rightarrow\ 3^6 \equiv 1 \pmod{7} \quad \text{✓ Fermat’s Little Theorem holds}$$

Fermat’s Little Theorem is fundamental in number theory and is commonly used to simplify calculations in modular arithmetic, primality testing, and cryptographic systems. This calculator helps verify results or compute modular powers efficiently using this property.

Previous
Floor Division

Leave a Reply

Your email address will not be published. Required fields are marked *