TITLE: What does $\!\bmod(n,x^r-1)$ mean? [in AKS primality test]
QUESTION [11 upvotes]: Where does a layman go to get a basic understanding of AKS primality testing. I am not talking about the optimal choice of $r$ (which I am told is the hardcore number-theoretic part of the algorithm). I mean basic things, like what does $\bmod(n, x^r-1)$ mean (how can something be mod two things?) And what does binomial expansion have to do with anything?  I can't find anything in Wikipedia that is appropriate for my level.

REPLY [6 votes]: I will address the two question that are directly stated. If you ask more, I can change this answer.
To mod by two things, in this case a number and a polynomial, is not as bad as it might seem. Modding by the number n is just as before - treat every coefficient separately. So $16x^2 + 10x + 7 \equiv x^2 + 2 \mod 5$. The polynomial modulus is a little stranger. But in the case where it's $x^k - 1$, this just means that you reduce all exponents greater than $k$ by $k$, effectively dividing polynomials that are "too large" by a smaller polynomial.
Many more sources exist. Here is a great primer. This is a short FAQ aimed at the AKS. And here is a list of other sources or learning about the AKS algorithm.