Skip to content

Fermats Little Theorem

Result

Calculated result 1 Based on the values entered.
↗ Math

Fermats Little Theorem — free online calculator.

Formula

a^(p-1) ≡ 1 (mod p) where p is prime and gcd(a,p)=1
  • Fermats Little Theorem calculates its result from a, Prime p. It uses the formula a^(p-1) ≡ 1 (mod p) where p is prime and gcd(a,p)=1. Change any input to recalculate the result instantly.
  • The main inputs are a, Prime p. Enter them in the units and format shown in the calculator.
  • Keep comparable quantities in compatible units whenever the formula combines or compares them.
  • Changing any input above recalculates the result with the same calculation engine used by this page.

Example: Fermats Little Theorem

Inputs
  • a: 2
  • Prime p: 7

Using a = 2, Prime p = 7, the calculated result is 1.

Sample result: Calculating…

Frequently asked questions

What does the Fermats Little Theorem calculate?

Fermats Little Theorem — free online calculator.

Which values should I enter?

Enter a, Prime p using the units and format shown beside each field.

What formula does this calculator use?

The calculator uses the following relationship: a^(p-1) ≡ 1 (mod p) where p is prime and gcd(a,p)=1.

Why might my result differ from another source?

Results can differ when another source uses different units, rounding rules, conventions or assumptions. Compare the inputs and definitions before comparing results.

Does the result update automatically?

Yes. Changing an input updates the result using the same calculation engine shown on this page.

Page information

Updated: October 7, 2026