n × n · a + (k−1)d · a·r^(k−1)
Build a magic square of order 3 to 8 from any starting number, with an optional common difference (arithmetic) or common ratio (geometric).