Determining the Remainder of Large Factorials
Recall from the Wilson's Theorem page that Wilson's theorem states that a natural number $p$ is prime if and only if:
(1)We will now use this theorem to find the remainders of large factorials.
Example 1
Find the remainder of 97! when divided by 101.
First we will apply Wilson's theorem to note that $100! \equiv -1 \pmod {101}$. When we decompose the factorial, we get that:
(2)Now we note that $100 \equiv -1 \pmod {101}$, $99 \equiv -2 \pmod {101}$, and $98 \equiv -3 \pmod {101}$. Hence:
(3)Now we want to find an inverse of $6$ moduloe $101$. Using the division algorithm, we get that:
(4)Hence $17$ can be used as an inverse for $6$ modulo $101$. It thus follows that:
(5)Hence $97!$ has a remainder of $17$ when divided by $101$.
Example 2
Find the remainder of $67!$ when divided by $71$.
Using Wilson's theorem, we have that $70! \equiv -1 \pmod {71}$. Decomposing the factorial we get that:
(6)Now let's find an inverse of $6$ modulo $71$ by the division algorithm:
(7)Hence $12$ can be used as an inverse. Thus:
(8)Hence when $67!$ is divided by $71$, the remainder leftover is $12$.
Example 3
Find the remainder of $53!$ when divided by $61$.
We know that by Wilson's theorem $60! \equiv -1 \pmod {61}$. Decomposing $60!$ and we get that:
(9)We will now use the division algorithm to find an inverse of $52$ modulo $61$:
(10)Hence $27$ can be used as an inverse of $52 $] modulo [[$ 61$. We thus get that:
(11)Hence the remainder of $51!$ when divided by $61$ is $27$.
Example 4
What is the remainder of $149!$ when divided by $139$?
From Wilson's theorem we know that $138! \equiv -1 \pmod {139}$. We are now going to multiply both sides of the congruence until we get up to $149!$:
(12)Hence the remainder of $149!$ when divided by $139$ is $0$.
In fact, this should make sense since $149! = 149 \cdot 148 \cdot ... \cdot 139 \cdot ... \cdot 1$.