Continuing the same line of thought (Fibonacci MSBA) I wondered what would be required to find a neat algorithm for creating families of larger MSs. I quickly found out I was limited in terms of tools, because I had only 3×3, which meant I could try only to extend to larger odd-sided squares. Even-sided and Odd-sided squares do not allow the same methods. At least – not all methods allowed by each are the same.
So… I chose my first even-sided to be 4×4, instead of 2×2.
It took a bit of fiddling around. I wanted to follow the same general principal – create the ‘0’ square, then use it to build a family above it.
It does not take any significant amount of time to find that Tribonacci does not work.
The general formula is T1 + T2 + T3 = T4
The fact that you have not 2 but 3 smaller values (T1 to T3) means that for each subset that you want to create, you have 3 values to reuse, instead of 2. And you can alternate signs only so far. Each value can be only negative or positive, so you are bound to repeat a signed value.
Sidetrack:
If you do not care about repeating values, you can easily create a 4×4 using Tribonacci:
| 7 | -13 | 2 | 4 |
| -24 | 4 | 7 | 13 |
| 13 | 7 | 4 | -24 |
| 4 | 2 | -13 | 7 |
I did not bother so generalize the table here, cause I myself do care about the repeats.
But it’s worth looking at, because some useful things become apparent.
So… What do we learn from the failed square above?
– First, we need another equivalence grouping in order to ensure unique sides (as opposed to ~bonacci).
– Second, we don’t have center cell, nor we have center row and column, but that does not get in the way of our reflections.
The happy thought was that a very easy way of creating an even number of values that can be brought to 0 is to just use an even number of consecutive values and couple them outwards-in. As in:
1, 2, 3, 4, 5, 6
The sum of the outer ones is the same as the sum of the intermediate ones, is the same as the sum of the inner ones. 1+6 = 2+5 = 3+4. Which means that if you have 2 couples (a total of 4 values) – you can subtract one of the couples from the other to get the desired 0.
The first dead reckoning attempt started with the numbers 1 through 16. I started combining them from both ends. Why 16? Clearly too large of a range, but I did not want to think at this point about clashing couples in the middle, so… Somewhere along the way I messed up a sum, so I had to start over, but I have already noticed the pattern that would form:
| 1 | -3 | 8 | -6 |
| -2 | 4 | -7 | 5 |
| -5 | 7 | -4 | 2 |
| 6 | -8 | 3 | 1 |
Notice that? I was quite pleased when I did. There’s in fact a bit too much pattern in that square. Notice the way each small 2×2 square is filled in. Top-left and top-right corners, for example. You start with 1 and go down when going Odd-Even, but for 5-8 it is the other way around? Do you have to? Also, for the smaller values (1-4) you go outside-in and the same for 5-8. Do you have to?
No, of course not.
Here is an equally valid and much more clean looking variation of the square (Ok, not the square, only the cell pattern):
| 1 | 3 | 5 | 7 |
| 2 | 4 | 6 | 8 |
| - | - | - | - |
| - | - | - | - |
See?
The generalization is obvious now. The fact that I started with consecutive integers obscures the important properties a bit (what I mentioned about too much of pattern a moment ago).
The true pattern (and algorithm) is the following:
Ingredients: A sequence of 8 integers, such that the difference between each 2 consecutive integers is a constant. (in the above example it is the trivial ‘1’).
Steps: Fill in one of the sides and the underlying row/column in a zig-zag pattern with the ingredients (keeping their order).
This should result in rows (or columns) where neighbouring cells have the same difference. And this will also be the difference between a cell and the corresponding one from the next row/column.
Meaning:
V1, V2 .. V7, V8
where Vn = Vn-1 + X
| V1 | V3 | V5 | V7 |
| V2 | V4 | V6 | V8 |
When you do that, you have the base to crate a ‘0’ square:
– Mirror the values
– Dispense the negatives
The way to do the second of those last steps is the following:
Start row by row (or columns by column; I should stop clarifying that, it is obvious). On each row alternate – either the largest and smallest or the two intermediate values remain positive, while the rest become negative.
Like this:
| -V1 | V3 | V5 | -V7 |
| V2 | -V4 | -V6 | V8 |
| -V8 | V6 | V4 | -V2 |
| V7 | -V5 | -V3 | V1 |
Um… I am sure there was something else. It will get back to me later, I guess. For now – that is it. You create your seed sequence, you fill in, reflect, then negate half the values. You get a 4×4 ‘0’ square and you are free to build upon it as you wish. Again, as with the 3×3 before and as it is with all ‘0’ squares – the possible magic constants are always a multiple of the length of the sides. So 4 in this case.