Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re^4: magic squares

by Limbic~Region (Chancellor)
on Apr 08, 2009 at 15:28 UTC ( #756364=note: print w/replies, xml ) Need Help??

in reply to Re^3: magic squares
in thread magic squares

Yes, this is exactly what I was guessing at. There are also constraints as to what x, y and z can be within the confines of this puzzle. I didn't have a chance last night to work on this though because the following entered my mind as I was leaving work
X+Y X+Z X-Y-Z X-2Y-Z X X+2Y+Z X+Y+Z X-Z X-Y Terms: X, X+Y, X-Y, X+Z, X-Z, X+Y+Z, X-Y-Z, X-2Y-Z, X+2Y+Z X+Y X-2Y+Z X+Y-Z X-Z X X+Z X-Y+Z X+2Y-Z X-Y Terms: X, X+Y, X-Y, X+Z, X-Z, X+Y-Z, X-Y+Z, X+2Y-Z, X-2Y+Z Terms in common: X, X+Y, X-Y, X+Z, X-Z Terms not in common: X+Y+Z VS X+Y-Z AND X-Y-Z VS X-Y+Z X-2Y-Z VS X-2Y+Z AND X+2Y+Z VS X+2Y-Z

I haven't convinced myself that you don't need to iterate over other series of equations. Still thinking on it though.

Update: In fact, I think I can show that your statement "By rotating and reflecting we can make the largest corner be x+y" is not in fact true - consider the following square:

You have X+Y and X+Z both in a corner so you need to make a relationship between them to determine which is the largest value. Also, I noticed that I showed it is possible to have X+Y+Z in a corner and am now convinced that multiple series of equations must be iterated (though you can re-use the values for X, Y and Z).

Cheers - L~R

Replies are listed 'Best First'.
Re^5: magic squares
by tilly (Archbishop) on Apr 08, 2009 at 16:08 UTC
    It is ugly, but I used the above logic to code up a reasonably efficient solution. On my machine it runs in about 0.01s:
      Thanks! After having read your code and your proof I see why it wasn't immediately obvious to me. I was stuck looking at it a different way. I stubbornly had to convince myself that my way was in fact correct. After I did, I realized we were saying the same thing. This is the frustrating part - I sometimes can't get out of my own way.

      Unfortunately, I now lack all ambition to implement my solution.

      I only got interested in the problem because glancing at the commentary of existing posts - a number thought brute forcing was necessary. I had a hunch that this wasn't true.

      Cheers - L~R

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://756364]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (12)
As of 2017-06-23 21:54 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (555 votes). Check out past polls.