Octagon Algorithm for Wheel Magic Squares (Part III)

Picture of a wheel

The Eight Node Way - 9×9 Squares

The previous section Part II introduced the Octagon A algorithm for the construction of 7×7 Wheel Squares. This section will cover the 9th order squares. The square will be built according to Part I starting with the initial node at top left of the octagon.


Picture of an octagon

The squares will be constructed, however, with only partial coding for the wheel portion but not for the complete magic square since the octagon method requires an inordinate amount of code. The reason being that while and for loops cannot be used to fill in the cells as discussed in Part I.

Six 9×9 examples are shown below. Starting with the construction of the Wheel 9(0)-1 one may use the Octagon A algorithm to fill in the rest of the white cells a number of ways. Magic Square 9(0)-1 is generated by initially placing the number 13 in the second top cell [position (0,1)] then adding the rest of the numbers as shown. Note that position is defined here as (row,column) where the first cell is (0,0) and the grey cells are sums, where every row, column and diagonals must add up at the end to the magic sum 369.

Wheel 9(0)-1
77 1 45 123
76 2 44 122
75 3 43 121
744 42 120
910 1112 4170 7172 73369
4078 8 122
39 79 7 121
38 80 6 124
37 81 5 123
123124125 126 369120 121122123 369
   ⇒
Magic Square 9(0)-1
771317 211 61656945 369
167625 292 53 5744 67369
202875 333 494355 63369
243236 744 4247 5159 369
910 1112 4170 7172 73369
585046 4078 8353123 369
625439 4879 34727 19369
663856 528030 266 15369
376864 6081 2218145 369
369369369 369 369369 369369369 369

Magic Square 9(0)-2 is generated by initially placing the number 13 in the fourth top cell [position (0,3)] then working backwards to fill in the cells. Magic Square 9(0)-3 is generated by placing the 13 internally in a green cell [position (2,3)] and working outward towards the perimeter of the square.

Magic Square 9(0)-2
772117 131 69656145 369
247629 252 57 5344 59369
203275 333 494351 63369
162836 744 4247 5567 369
910 1112 4170 7172 73369
665446 4078 8352715 369
625039 4879 34731 19369
583852 568026 306 23369
376064 6881 1418225 369
369369369 369 369369 369369369 369
    
Magic Square 9(0)-3
772529 331 49535745 369
287617 212 61 6544 55369
322075 133 694363 51369
362416 744 42675947 369
910 1112 4170 7172 73369
465866 4078 8152335 369
506239 6879 14719 31369
543864 608022 186 27369
375652 4881 3430265 369
369369369 369 369369 369369369 369

Magic Square 9(1)-1 and 9(2)-1 are generated using a different wheel for each square (computer code below) and then filling in the square starting at position (0,1) with the number 13 as was done with Magic Square 9(0)-1.

Magic Square 9(1)-1
75117 213 61658145 369
167425 294 53 5744 67369
202873 335 494355 63369
243236 726 4247 5159 369
1112 1314 4168 6970 71369
585046 4076 10353123 369
625439 4877 34927 19369
663856 527830 268 15369
378064 6079 221827 369
369369369 369 369369 369369369 369
    
Magic Square 9(2)-1
73117 215 61658145 369
47225 296 53 5744 79369
202871 337 494355 63369
243236 708 4247 5159 369
1314 1516 4166 6768 69369
585046 4074 12353123 369
625439 4875 341127 19369
783856 527630 2610 3369
378064 6077 221829 369
369369369 369 369369 369369369 369

Computer Coding for 9×9 Squares

This part contains only the wheel portions Wheel 9(1) and Wheel 9(2) used for the last two magic squares.

(a) Wheel 9(1)
(b) Wheel 9(2)

This completes the Octagon A method. To go back to Part II. Go to Part IV. Go back to homepage.


Copyright © 2022 by Eddie N Gutierrez. E-Mail: enaguti1949@gmail.com