Least Positive Residue How would I find the least positive residue of
say
$6! \bmod 7$
or
$12! \bmod 13$
I just learned modular arithmetic and my book doesn't explain what least positive residues are so I'm a bit lost.
 A: 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.
A: 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.
A: As both 7 and 13 are prime, simply apply Wilson's Theorem.  This tells us that $(p-1)!\equiv -1$ modulo $p$, for $p$ a prime.  So in the two specific cases in the posted question:
$6!\equiv -1 \equiv 6 \pmod 7$
and
$12!\equiv -1 \equiv 12\pmod {13}$.
