Fermat's Little Theorem Calculator
Fermat's little theorem calculator is here to help you understand what this famous theorem says and how to use it correctly.
Result43^100 mod 7
Squaring steps used7instead of 100 multiplications
Modulus is prime?Yes
Base mod m3
The method
base^exponent mod m, by repeated squaring
Why repeated squaring matters
Computing 3^100 directly gives a 48-digit number. Reducing mod m at every step keeps everything small, and squaring rather than multiplying one factor at a time cuts the work from n multiplications to about log₂(n) — seven instead of a hundred here. This is the operation at the heart of RSA and Diffie-Hellman.