Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

A variant of Fermat's Little Theorem states that $a^{p - 1} \equiv 1~mod~p$ if $a$ is not divisible by $p$.

Why is this last condition important? Why must $a$ and $p$ be relatively prime?

share|improve this question
2  
If $a$ is divisible by $p$, then $a^{p-1}\equiv 0\pmod p$. –  Brian M. Scott May 12 '13 at 4:19
    
Beat me by 20 seconds @BrianM.Scott ;) –  Alex Wertheim May 12 '13 at 4:21

2 Answers 2

up vote 6 down vote accepted

If $p$ divides $a$, then $a\equiv 0\bmod p$, so you will have $$a^{p-1}\equiv 0^{p-1}\equiv 0\not\equiv 1\bmod p.$$ If you prefer a statement of Fermat's little theorem that doesn't have this restriction: $$a^p\equiv a\bmod p$$ for any integer $a$ (regardless of whether it's relatively prime to $p$).

share|improve this answer

If $a$ is divisible by $p$, then $a^{p-1} \equiv 0$ (mod $p)$.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.