I have been looking up the AKS primality test and would like to implement it in code. The algorithm is here: http://teal.gmu.edu/courses/ECE746/p...ington_AKS.pdf
on page 2. The improved algorithm.
I understand most of the steps but some I don't, in particular:
step 4:
for a = 1 to sqrt(r)log(n)
if (( x + a)^n = xn + a (mod f(x), n)), output PRIME
next

I don't know what it means by having two numbers in mod() with a comma between them but I would know what it meant if there was only one number, it would mean that both sides produce the same remainder when divided by that number.
Also it doesn't state a value for x. Later on in the paper it says about how the equation is some kind of polynomial so that a value for x is not needed, but I don't understand how to implement this in code.
I showed the paper to one of my maths teachers but he didn't know what was meant by two numbers in the mod() function and didn't know how to go about proving that one side of the equation in step 4 was equal to the other side.
I'd appreciate any help in this.