Image for Fermat's Little Theorem

Fermat's Little Theorem

Fermat's Little Theorem states that if a number \( p \) is a prime (a number only divisible by 1 and itself), then for any number \( a \) that isn't divisible by \( p \), multiplying \( a \) by itself \( p-1 \) times will leave a remainder of 1 when divided by \( p \). In simple terms, \( a^{p-1} \equiv 1 \ (\text{mod } p) \). This theorem helps in fields like cryptography by providing a way to check for prime numbers and to perform secure calculations efficiently.