The complex number are calculated by exponentation from the botton to the top modulo the input number.
I have sorted the complex numbers: b>a, otherwise I have replaced (a,b) by (b,a)
The listed green complex numbers have norm (a,b)=a²+b²=1 mod p
The listed red complex numbers have norm (a,b)=a²+b²=-1 mod p
The factorisation depends of the number modulo 4:
Let p be an odd prime, then
for p = 1 mod 4 the factorisation depends on p-1
for p = 3 mod 4 the factorisation depends on p+1
The green elements a+bi are quadratic residues and have jacobi (a²+b², f)=1
The red elements a+bi are non quadratic residues and have jacobi (a²+b², f)=-1