\\Compute the group H from Problems 11-13 of the problem list \\Subgroup of Z/n[sqrt(d)]^* where (a+b*sqrt(d))^n = a-b*sqrt(d) \\sqrt(d) is given by z below. Output is a vector of vectors [a,b]. { set_h(n,d)=local(v,z);v=[];z=Mod(Mod(1,n)*x,Mod(1,n)*(x^2-d)); forvec(a=vector(2,j,[0,n-1]), if(gcd(a[1]^2-d*a[2]^2,n)==1&& (Mod(a[1],n)+z*Mod(a[2],n))^n==(Mod(a[1],n)-z*Mod(a[2],n)), v=concat(v,[a])) );v } \\The test in the AKS conjecture { test(n,r)= if(Mod(Mod(1,n)*(x+1),Mod(1,n)*(x^r-1))^n==Mod(Mod(1,n)*(x^(n%r)+1),Mod(1,n)*(x^r-1)),1,0) }