Fermat’s little theorem says that if p is prime and an integer a is not divisible by p, then ap−1 ≡ 1 (mod p). The congruence symbol means the two sides leave the same remainder after division by p.
This calculator checks that p is prime, calculates a^(p−1) modulo p and explains whether the remainder-one condition applies. It accepts a negative base too. It does not accept a custom exponent, compute a modular inverse directly or prove primality merely because a single power leaves remainder 1.