Least Positive Residue

The least positive residue of $a$ modulo $n$ is the smallest positive integer $k$ such that $a\equiv k\pmod n$. Similarly (and more commonly), the least nonnegative residue of $a$ modulo $n$ is the smallest nonnegative integer $k$ such that $a\equiv k\pmod n$; they are the same except when $a$ is a multiple of $n$.

As to your actual question, you can simply multiply out the factorials, dividing by the modulus every chance you get to reduce the intermediate calculations to their least positive residues. Or, if you've learned Wilson's Theorem, you can use that in these cases.


Do you already know this?: $a\equiv b \bmod m \implies ac\equiv bc \bmod m$.

You can use this to keep the numbers small as you investigate these results:

$4! = 1\cdot 2\cdot 3\cdot 4 \equiv 24\equiv 3 \bmod 7$
$5! = 4!\cdot 5 \equiv 3\cdot 5 \equiv 15 \equiv 1 \bmod 7$
$6! = 5!\cdot 6 \equiv 1\cdot 6 \equiv 6 \bmod 7$

(and to reassure yourself that this is working, $6!=720 \equiv 20\equiv 6 \bmod 7\ \ \checkmark$)

We can shortcut a little with some precalculation for the $\bmod 13$ question:
$2\cdot 7=14\equiv 1\bmod 13$,
$3\cdot9=27\equiv 1\bmod 13$,
$4\cdot 10 = 5\cdot 8=40\equiv 1 \bmod 13$,
giving us:
$10! \equiv 1^5\cdot 6\equiv 6 \bmod 13$

and so on.