Coprime Test

Dec 2009
226
90
I read two numbers \(\displaystyle a\) and \(\displaystyle b\) are coprime if \(\displaystyle b^{a - 1} = 1\) (mod a). Is it me or does this test not hold when a = 6 and b = 5, which are coprime?

\(\displaystyle 5^{6 - 1} = 1\) (mod 6)
\(\displaystyle 5^5 = 1\) (mod 6)
\(\displaystyle 3125 = 1\) (mod 6)

3125 mod 6 is 5, which does not equal 1, so the test fails. Is it me or the test?