I've been trying to implement AKS algorithm, an algorithm that helps to identify if an integer is prime or not. One of the steps mentions the following:
If for all $a$ from 1 to $\lfloor\sqrt{r}\log{n}\rfloor$ it is true, that $(x+a)^n\equiv x^n+a\quad(\mod f(x),n)$, then return "Prime".
I would like to know three things:
1) If $r$ and $n$ are known and are integers, why do we need to find the minimum of their product? Or do these brackets mean something else?
2)I've seen many time modulo being written with something else after the first divisor. Usually it's something simple like $\mod{4}$, but here there is also $n$ after the totient function. What does it mean?