Fermat's Little Theorem Calculator
Fermat's little theorem instantly calculates results using a, apcoprime, p. Use the calculator above for instant answers in your browser.
The Fermat's Little Theorem Calculator allows students, mathematicians, and cryptography enthusiasts to evaluate modular arithmetic expressions quickly and verify prime properties. By leveraging a fundamental result from number theory, this tool simplifies massive exponential calculations down to basic remainders, helping you solve complex modular congruences without manual computation errors.
How Fermat's Little Theorem Works
Fermat's Little Theorem states that if p is a prime number and a is an integer not divisible by p, then a raised to the power of p - 1 is congruent to 1 modulo p. Mathematically, this is expressed as a^(p-1) ≡ 1 (mod p). Furthermore, for any integer a, a^p ≡ a (mod p). This property drastically simplifies computing large powers like a^k mod p by reducing the exponent k modulo p - 1.
Worked Calculation Example
Let us calculate 19^11 mod 11 using Fermat's Little Theorem. First, identify the base a = 19, the exponent k = 11, and the modulus p = 11. Notice that p = 11 is a prime number. According to the theorem, since 19 and 11 are coprime, we can reduce the exponent k modulo p - 1 (which is 10). Dividing 11 by 10 leaves a remainder of 1. Therefore, 19^11 ≡ 19^1 (mod 11). Finally, finding 19 modulo 11 yields a remainder of 8, meaning our final solution is 8.
Best Practices for Modular Arithmetic
Always verify that your modulus p is strictly a prime number before applying the theorem, as composite moduli will yield incorrect results. Ensure that your base a is not a multiple of p; if a is a multiple of p, the remainder is automatically zero. When dealing with very large exponents, always reduce the exponent modulo p - 1 first to keep your manual intermediate calculations manageable.
FAQs
What is Fermat's little theorem?
Fermat's Little Theorem is a foundational concept in number theory stating that if you raise an integer to a prime power and subtract the integer, the resulting number is an integer multiple of that prime. It establishes a shortcut for modular arithmetic and underpins modern cryptographic algorithms like RSA encryption.
How do I find a multiplicative inverse using Fermat's little theorem?
You can find the modular multiplicative inverse of an integer 'a' modulo a prime 'p' by raising 'a' to the power of 'p - 2'. Because the theorem proves that a^(p-1) ≡ 1 (mod p), multiplying both sides by a^(-1) reveals that a^(p-2) is the modular inverse of 'a', provided 'a' is not a multiple of 'p'.
How do I use Fermat's little theorem to test primality?
While not a definitive proof of primality on its own, Fermat's test checks if a^(n-1) ≡ 1 (mod n) for a given integer 'n'. If this congruence fails for any chosen base 'a', 'n' is definitely a composite number. If it passes for multiple bases, 'n' is likely a prime, though rare pseudoprimes can trick the test.
When was Fermat's little theorem proved?
French mathematician Pierre de Fermat first stated the theorem in a 1640 letter to his friend Bernard Frénicle de Bessy. However, Fermat did not provide a written proof in that correspondence. The first published proof was successfully completed by Swiss mathematician Leonhard Euler in the year 1736.
Formula verified against Mathematical standards (ISO 80000-2) — all calculations use deterministic, standards-based formulas.
Related calculators
Remainder
Instantly calculate remainder using dividend, divisor, hidden variables. Free, accurate math calculator with real-world examples.
Math
Slope
Instantly calculate slope using abs b, angle, b. Free, accurate math calculator with real-world examples.
Math
Average
Instantly calculate average using course 1, course 10, course 100. Free, accurate math calculator with real-world examples.
Math
Circumference
Instantly calculate circumference using area, circumference, d. Free, accurate math calculator with real-world examples.
Math
Right triangle side and angle
Instantly calculate right triangle side and angle using a1, a2, a3. Free, accurate math calculator with real-world examples.
Math