------------------------------------------------ --Combinatorial commutative algebra class ------------------------------------------------ ------------------------------------------------ --First example ------------------------------------------------ --If you take a 3 by 3 magic square, and read the --rows as 3 digit number, then the sum of their --squares is the same as the sum of the squares of --the rows read backwards. ------------------------------------------------ --Let the magic square be --a b c --d e f --g h i ------------------------------------------------ R=QQ[a..i]; I=ideal(a+b+c-d-e-f, a+b+c-g-h-i, a+b+c-a-d-g, a+b+c-b-e-f, a+b+c-c-f-i, a+b+c-a-e-i, a+b+c-c-e-g); sums=(100*a+10*b+c)^2+(100*d+10*e+f)^2+(100*g+10*h+i)^2 - (100*c+10*b+a)^2-(100*f+10*e+d)^2-(100*i+10*h+g)^2; <( i=floor(k/n)+1; j=k+1-(i-1)*n; if i+10 then I=I+ideal(R_k*R_(k+3)); ); if i+20 then I=I+ideal(R_k*R_(k+9)); ); )); <<"The ideal for these equations is: "<(J=J+ideal(R_k^2);)); bas=flatten entries basis(mm,R/J); <<"An example of such a configuration is" <