Welcome to the Monastery  
PerlMonks 
Re: magic squaresby blokhead (Monsignor) 
on Apr 05, 2009 at 13:47 UTC ( #755560=note: print w/ replies, xml )  Need Help?? 
The Siamese method you linked to seems to be only applicable for n x n squares made up of the numbers 1 through n^{2}. In this problem you are asked about 3 x 3 magic squares made up of numbers 1 through 26. So there is much less structure and the Siamese method (even augmented as you have done) will likely not find all such squares. Unless you happen to fall upon an ingenious simple mathematical simplification, there may be nothing much simpler than trying all possible arrangements of 9 numbers chosen between 1 and 26. So I would start the other direction, so that there is less to search. Start with the person's name, say PAUL, and figure out which sets of 5 letters could be added to make a magic square. There are some simple constraints that limit the amount of search, for instance the sum of all the entries should be a multiple of 3. Then see if you can make a magic square out of it. It will be less work than searching the entire space. blokhead
In Section
Seekers of Perl Wisdom

