I am Rohan Kapur. This is my first time posting on the Mathematics site, although I am quite active on StackOverflow, the programming site. I am doing a Islamic Maths assignment at the moment for Humanities, and I came across the historical fact that Ibn al-Haytham proved Wilson’s theorem. I have seen on this wiki page: Wilson's theorem Wiki
a natural number $n > 1$ is a prime number if and only if: 
$(n-1)! \equiv -1 \pmod n$
So I know what $(n-1)!$ means, its a factorial. But what does $\equiv$ with three lines there $(\mathrm{mod}\ n)$ mean. How does that mean its a prime number? $5$ is a prime number, ok.
$5-1!$ is $4 \cdot 3 \cdot 2\cdot 1$
that equals $24$
and then $24$, $\equiv$ with three lines again, $(\mathrm{mod}\ n)$.
What does this mean? Been looking for a simple answer, but can't find one...
UPDATE
Yes, I know what modular arithmetic is. It is a system where a number wraps around after a certain value in a loop. Like a clock time for example, but what does this mean in proving that the number is a prime.