/* This C program finds all projective planes P(a,b,c) that satisfy the conditions of Theorem 1.5 in "Some non-finitely generated Cox rings" by J. Gonzalez and K. Karu */ #include #include #include #define N 30 int gcd(int a, int b); void main() { int a, b, c, e, f, g, ab, A, B, D, del, S1, S2; for (a=1; a<=N; a++) /* run over a,b,c = 1,...,N with no common divisor */ for (b=1; b<=N; b++) { ab = gcd(a,b); for (c=1; c<=N; c++) if (gcd(ab,c)==1) { /* look for a relation (e,f,-g) */ B = (int) floor(sqrt(a*b/c)); /* B is a bound for g */ for (g=0,D=-1,f=0; g<=B&&D<=0; ) /* run g=1,...,B and f=1,2,... */ for(g+=ab, D=g*c-b, f=1; D>0 && D%a; D-=b, f++); /* stop when D=gc-fb is positive and divisible by a */ if (D>0 && g*g*c<=a*b) { /* we found a relation with w<=1 */ e=D/a; /* find the smallest del>0 (\delta in the paper), where B=b+e*del, A=a-f*del, are both divisible by g */ for (B=b, A=a, del=0; del2 && (A%(f*g))*(S2-1)