A
magic square of order n is a square array of n² consecutive integer numbers (usually, but not neccessarily, from 1 to n²) arranged so the sum of the numbers in any horizontal, vertical, or
main diagonal line is always the same number, called the magic constant.
For which values of n are there magic squares of order n, with a magic constant of 2007?
I was working on a general solution for magic squares with sum of m for positive integers m when I noticed that it is purely coincidental that 3,6, and 9 all provide solutions for the case of m=2007.
if we want magic squares with constant sum of m then we have
Ó(k+t) (t=1 to n^2) = mn
kn^2+(n^2(n^2+1)/2)=mn
2kn^2+n^2(n^2+1)=2mn
obiviously n is not zero so we can divide it out
2kn+n(n^2+1)=2m
n(2k+n^2+1)=2m
so clearly n is a divisor of 2m
now let 2m=r*n for some positive integer r then we have
n(2k+n^2+1)=rn
2k+n^2+1=r
2k=rn^21
k=(rn^21)/2
so for k to be an integer we need that rn^21 be even
now since rn=2m then if n is odd then r must be even otherwise rn^21 would be odd
on the other hand if n is even then rn^21 is even only if r is even as well so we can only have solutions for n when n is a divisor of 2m, less than the cube root of 2m, and if n is odd then 2m/n must be even.
So for example if m=100 then we have 2m=200, cube root of 2m is 5.84 so n must be less than or equal to 5 and a divisor of 2m, that leaves 1,2,4, and 5. obviously 1 is a solution and 2 is not as shown by K Sengupta. But 4 is not a solution because 200/4=50 and we would have 4(2k+17)=200 or 2k+17=50 or 2k=33 or k=16.5 and thus does not give an integer solution for k. So for m=100 there are magic squares that sum to 100 only for n=1 and n=5.

Posted by Daniel
on 20090202 21:36:51 