MAGIC SQUARE
Magic square, all lines sum to 15.
Every row, column and diagonal sums to 15. Random fill-in quizzes with auto-grading, plus the classic Lo Shu square.
Everything runs locally in your browser
Solution animation · Siamese method
1 sits top-middle: place 1 at row 1, col 2
What is this?
A 3×3 magic square (Lo Shu) places 1–9 so every row, column and diagonal sums to 15. We randomly rotate/reflect it and blank a few cells for you to fill.
示例与注意事项Example & notes
一个例子A worked example
用罗伯法填 1–9:从顶部中间开始,每次都往右上走,出上边回到最下边、出右边回到最左边,遇阻则下移一格,最终每行每列每条对角线和都是 15。Fill 1–9 by the Siamese method: start top-centre, always move up-right, wrap around the edges, and drop one cell when blocked. Every line then sums to 15.
注意事项Things to watch
- 三阶幻方的中心必为 5、幻和必为 15,可用来快速自检。A 3×3 magic square always has 5 in the centre and sums to 15 — a quick sanity check.
- 这套口诀只适用于奇数阶;四阶要用对角交换法。The recitation only works for odd orders; order 4 needs the diagonal-swap method.
- 旋转和镜像视为同一个幻方,统计解法数量时要去重。Rotations and reflections count as the same square when enumerating solutions.
相关问答More Q&A
幻和怎么算?How is the magic sum computed?
n 阶幻和 = n×(n²+1)/2;三阶即 3×10/2 = 15。For order n it is n×(n²+1)/2 — for order 3 that is 3×10/2 = 15.
四阶幻方也能填吗?Can it build a 4×4 square?
可以,但要用对角交换法,罗伯法口诀不适用。Yes, with the diagonal-swap method — the Siamese recitation does not apply.