1809202318:28 tags: # Little Fermat's Theorem Little Fermat's Theorem is a theorem invented by Pierre de Fermat. ## Theorem Let $p$ a prime number and $a$ be any integer. Then $a^{p-1} \equiv 1 \pmod {p}$ $if$ $p \nmid a$ **or** $a^{p-1} \equiv 0 \pmod p$ $if$ $p \mid a$ ### Equivalent theorem Let $p$ a prime number. Then $a^p \equiv p \pmod p$ ## Example of usage This theorem is used in the [[3. Permanent notes/Miller-Rabin Test|Miller-Rabin test]] that leverages probabilities to check if a number is a prime number or not. --- ## References 1. [[2. Literature notes/Little Fermat's Theorem|Little Fermat's Theorem]]