So I was wondering about magic squares (pattern hunting, obv) and I tried going the way of the tipping table.
Meaning: There are infinite magic squares with the magic constant X. The most boring of all is the trivial one, where each square holds value X/3. So… How about a way of getting from the trivial square to a non-trivial one? Obviously there are many ways and obviously many of those ways have already been described somewhere, but it’s worth digging (I have mentioned the value of rediscovering the wheel, haven’t I?).
So I started poking at a ’15’ square and got something that at the time looked surprising (now – may be not so much).
Disclaimer One – I have only had time to look so far at the X/3 trivial case. Meaning – MS (tired of typing the whole thing out) with a constant (MC) divisible by 3.
Disclaimer One-and-a-Half: I would love to dig into rational MSs some day!
So… I took this MS from the internet:
| 8 | 1 | 6 |
| 3 | 5 | 7 |
| 4 | 9 | 2 |
That’s a ’15’ square, so it’s base case is all 5s.
And the question is: how do you get from all 5s to the one above?
It is clear that adding the same value to each of the cells does not break the MS, so first I thought of cutting down the slack – the lowest value is 1, so if we reduce each cell by 1… nothing special pops up.
Back there I mentioned the tipping table. Crude analogy, I admit, but bare with me.
If you have a trivial case and you push one of the values down, others will have to go up to compensate, right?
So… Let’s look at the difference table – a grid with the deviation of the actual MS from a trivial case I cooked up:
| 3 | -4 | 1 |
| -2 | 0 | 2 |
| -1 | 4 | -3 |
This only showed how… small and tame the MS is – the biggest absolute difference is barely below the trivial base value (5). It looked good. I needed a tame case to dismantle in peace.
So I played around in an electronic table (I was gonna say Excel, but it is not Excel), trying to see if I can find similar difference table or at least explain what makes this one work. Why 1 to 4? What other values would do the trick? Obviously, the rules of the MS will strictly dictate the arrangement of the values (and those rules should be examined further), but why those values?
Intermittent observation – this MS is of a family of MSs, where the center has 0 deviation. More on that later.
Not many minutes playing around later I stumbled upon a good family of MSs – the Fibonacci MSs. They are a subfamily of a larger one, of which the above example is a member of. The sequence 1, 2, 3, 4 is not a Fibonacci subsequence, but follows the same 0-center rule, so… until I dig into that particular example further, I consider them cousins to the Fibonaccis.
So! Yeah, the Fibonaccis (FMS)! Here is the end result, directly. Analysis – later.
Take the following schema (rotate as you please):
| C | - | B |
| - | 0 | A |
| - | D | - |
A, B, C and D here are four consecutive Fibonacci numbers. Once you place them, fill in the opposite cells with their negative counterparts.
At this point you have a ‘0’ MS. Also, you have negative values. To get rid of the negative values, add the largest (D) to each cell. This will set you up with a 0 at -D. If you dislike the zero, no worries – add any positive number to all the cells to produce any member of an infinite number of FMSs with the same difference table. Or ‘difference profile’. Yeah, that sounds better.
Example:
’34, 55, 89, 144′ turns into:
| 89 | - | 55 |
| - | 0 | 34 |
| - | 144 | - |
then into
| 89 | -144 | 55 |
| -34 | 0 | 34 |
| -55 | 144 | -89 |
Add 144 to raise the MS above the negatives:
| 233 | 0 | 199 |
| 110 | 144 | 178 |
| 89 | 288 | 55 |
You’ve got yourself a ‘432’ MS.
Add 1 to each cell and you’re up to 435.
And so on.
You’ve got an infinite family of magic squares, identified by the ’34, 55, 89, 144′ sequence. One caveat, though – since producing another family requires to add/remove 1 from each cell, the magic constants of all the families are divisible by 3, so… you’ll cover only the ‘/3’ infinity of magic sums.
All I need to do is write up the justification behind the arrangement of the seed Fibonacci numbers and… well, the link to the Fibonacci sequence is cool as well, so digging into that will also be fun.
Next:
– Why does Fibonacci work here?
– What’s behind the 1, 2, 3, 4 MS up there?
– Can we do rational MSs?