# Show that $(27!)^6 \equiv 1 \pmod{899}$

Show: $(27!)^6 \equiv 1 \pmod{899}$. Note: $899=30^2 - 1$.

Could anyone show me how to go through this please? I think I have to use Wilson's theorem which is $(p-1)! \equiv -1 \pmod p$ but not exactly sure how else to tackle this. Thanks!

-
Hints: $30^2-1=(30+1)(30-1)$; $30+1$ and $30-1$ are close enough to $27$ to make Wilson's Theorem an attractive option; $n\equiv-(p-n)\pmod p$. –  Gerry Myerson Dec 18 '12 at 5:28
could you expand on that a little please? I still dont quite grasp the concept –  Jack Dec 18 '12 at 5:31
No, but you could try thinking about it for more than three minutes. –  Gerry Myerson Dec 18 '12 at 5:33

Using Wilson's Theorem, $28!\equiv-1\pmod{29}\implies 27!(28)\equiv-1$ $\implies 27!(-1)\equiv-1\implies 27!\equiv1\pmod {29}$

$\implies (27!)^6\equiv 1\pmod{29}$

Again $30!\equiv-1\pmod{31} \implies 27!(28)(29)(30)\equiv-1$ $\implies 27!(-3)(-2)(-1)\equiv-1\implies 27!(6)\equiv1 \implies 27!(30)\equiv5$ (multiplying either sides by $5$) $\implies 27!(-1)\equiv5\implies 27!\equiv-5\pmod{31}$

So,$(27!)^6\equiv 5^6\pmod{31}$

Now, $5^3=125\equiv1\pmod{31} \implies (27!)^3\equiv -1\pmod{31}$

$\implies (27!)^6\equiv (-1)^2\pmod{31}\equiv1$

So, lcm$(31,29)\mid \{(27!)^6-1\}$ but lcm$(31,29)=31\cdot 29=899$

-
Thank you for insuring that OP will never have to think again. –  Gerry Myerson Dec 18 '12 at 6:05
@AndréNicolas, thanks for your observation. Rectified. –  lab bhattacharjee Dec 18 '12 at 6:11
Wish I knew my fault here that has caused the downvote –  lab bhattacharjee Mar 28 '13 at 9:00
Wasn't me downvoting, but did you give any thought to the comments I left? –  Gerry Myerson Apr 1 '13 at 11:59
@GerryMyerson, I completed the answer it to make things perfect and also because it was not marked 'homework'. But, I got your idea and will try to follow it sincerely. –  lab bhattacharjee Apr 2 '13 at 15:05