🔮 幻方生成器Magic Square Generator
生成 n 阶幻方(n = 3-20):奇数阶用暹罗法,4 的倍数用对角线互补法,其余偶数用 LUX 法;每行、每列、两条对角线之和都相等。本地处理。Generate an n×n magic square (n = 3-20): Siamese method for odd n, diagonal complement for multiples of 4 and the LUX method for other even n. Every row, column and both diagonals have the same sum. Processed locally.
使用说明与常见问题How-to & FAQ
「幻方生成器」是什么?What is the Magic Square Generator tool?
生成 n 阶幻方(n = 3-20):奇数阶用暹罗法,4 的倍数用对角线互补法,其余偶数用 LUX 法;每行、每列、两条对角线之和都相等。本地处理。Generate an n×n magic square (n = 3-20): Siamese method for odd n, diagonal complement for multiples of 4 and the LUX method for other even n. Every row, column and both diagonals have the same sum. Processed locally.
如何使用「幻方生成器」?How do I use the Magic Square Generator tool?
在「幻方生成器」中,填写「阶数 n」等参数,结果会随输入实时计算并显示在下方。In the Magic Square Generator: Fill in "Order n"; results are recalculated instantly as you type.
为什么没有 2 阶幻方?Why is there no order-2 magic square?
2 × 2 的幻方不存在:若 a + b = a + c 则 b = c,数字会重复。所以本页的阶数从 3 开始(3 到 20),1 阶只是平凡的单个数。A 2 × 2 magic square is impossible: a + b = a + c forces b = c, repeating a number. That is why the order here starts at 3 (3 to 20); order 1 is just a single number.
能举个计算实例吗?Can you show a worked example?
例如在「幻方生成器」中填 阶数 n = 3,结果区显示:幻和:15;校验:✔ 行、列、对角线都等于幻和;幻方:8 1 6 3 5 7 4 9 2For example, entering Order n = 3 in the Magic Square Generator gives: Magic constant: 15; Check: ✔ rows, columns and diagonals all match; Square: 8 1 6 3 5 7 4 9 2
哪些输入会被检查?Which inputs are validated?
「幻方生成器」会检查这些输入——「阶数 n」:必须填写,须为整数;绝对值超过 10¹⁵ 的数也会被拒绝。不符合时结果区显示具体提示,不会给出数字。The Magic Square Generator checks its inputs — "Order n": required, must be a whole number; numbers above 10¹⁵ in absolute value are rejected too. When a value fails, the result area names the problem instead of showing a number.
有哪些选项可以调整?What options can I adjust?
「幻方生成器」的设置:「阶数 n」默认 3。每次生成结果都按当前设置处理。Settings in the Magic Square Generator — "Order n" default 3. The result always uses the current settings.
计算精度如何?How precise are the results?
「幻方生成器」使用 JavaScript 双精度浮点数(约 15–16 位有效数字);极大或极小的数值可能存在精度误差。The Magic Square Generator uses double-precision floating point (about 15–16 significant digits); very large or very small values may lose precision.
「幻方生成器」免费吗?需要注册吗?Is the Magic Square Generator free? Do I need an account?
「幻方生成器」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The Magic Square Generator is completely free with no sign-up or install and works on phones and desktops; what you enter is processed only in your browser.