For $a=2$, does $p=561$ pass the Fermat primality test?
$a^{n-1} = 1$ mod $ n$.
I'm confused about this question because $561$ isn't prime in the first place?
For $a=2$, does $p=561$ pass the Fermat primality test?
$a^{n-1} = 1$ mod $ n$.
I'm confused about this question because $561$ isn't prime in the first place?
You need to verify if $2^{560}\equiv 1 \pmod{561}$. I answer this hoping is your true question
$$2^{560}=((2^7)^5)^{16}= (2^{35})^{16}=(34359738368)^{16}=(61247305\cdot561+263)^{16}$$ $$(263)^{16}=((263)^8)^2=(22 890 010 290 541 014 721)^2$$ $$22 890 010 290 541 014 721=40802157380643520\cdot561+1$$ The square of $1$ being $1$ you have in fact $2^{560}\equiv 1 \pmod{561}$ as you desired to verify.
NOTE.-$561$ is a special number (like as if it were a prime satifying Fermat's little theorem) called of Carmichael (there are infinitely many). You have the same congruence for all number coprime with $561=3\cdot11\cdot17$, in particular with your $2$.
Yes, $561=3\times11\times 17$ is the first Carmichaël number. It shows that what Fermat's test allows to say is "if my number is not prime, then it won't pass the test". Nothing allows to say that your number is prime if it passes the test.