Cyclic or Sandwich-Type Even and Odd Orders Magic Squares
Created by: Inder J. Taneja
Choose the construction below: Cyclic-Type (rotational pinwheel border) or Sandwich-Type (uniform-width bands) — both recursively nested, both work for any order
Cyclic-Type: each layer is 4 rotated (pinwheel) equal-sum magic rectangles wrapping the next layer down. Sandwich-Type: each layer is two 2×n rectangles (top/bottom, full width) plus two (n−4)×2 rectangles (left/right) wrapping the next layer down. Both recurse by peeling 4 at a time and work for any order n ≥ 3 (except n=2, which is impossible under any construction), bottoming out at a plain base of order 3, 4, 5, or 6 depending on n mod 4. Speed note: Cyclic-Type stays fast at every order (well under 5 seconds even at n=108). Sandwich-Type's matching step gets noticeably slower as n grows — a few seconds up to about order 50, but potentially a minute or more beyond order 80. For very large orders, Cyclic-Type is the quicker choice.