小學生算術題🧮紛爭第九彈🤕:幻方 & 群論

前天,妞姐問了個好問題——一個簡易版的幻方問題:把 2, 4, 6, 8, 10 填入下面的五個圓圈中,讓橫、竪、環上之和都相等。

⚠️之所以第一眼就認定它是「好問題」,是因為它符合「好問題是下金蛋🥚的雞🐔」這個定義。可以讓小朋友體會到「真的有不可交換的乘法」,也可以深扒和群論的關係⋯⋯

比如,我們先隨便填上:


  • 橫之和是 10 + 8 + 4 = 22
  • 竪之和是 2 + 8 + 6 = 16
  • 環上之和是 2 + 4 + 6 + 10 = 22

那麼,怎麼調整才能讓三個和相等呢?

手工嘗試

1⃣️ 先對調 108

2⃣️ 再對調 24

現在:

  • 橫之和是 8 + 10 + 2 = 20
  • 竪之和是 4 + 10 + 6 = 20
  • 環上之和是 4 + 2 + 6 + 8 = 20

搞定💪🏻。

如何找到一般化解法?

把橫向定義為 x 軸,縱向定義為 y 軸,環向定義為 z 軸:

\begin{cases} S_x = d + o + b \\ S_y = a + o + c \\ S_z = a + b + c + d \end{cases}

直覺告訴我們,這是個群,所有交換操作都可以由少數幾個基操組合得到。我們不妨先看看「逆時針輪轉一位環上的數」(暫且把這個操作叫做 \sigma_{z}^{counterclockwise}

\begin{cases} \overline{S_x} = a + o + c &= S_y \\ \overline{S_y} = b + o + d &= S_x \\ \overline{S_z} = b + c + d + a &= S_z \end{cases}

∵ x 軸和 y 軸是對稱的,∴必然可以用 x 軸上的交換操作和 \sigma_{z}^{counterclockwise} 組合而成 y 軸上的交換操作。我們不妨把交換 x 軸上右側兩個數的操作記作 \sigma_{x}^{+}

\begin{cases} \overline{S_x} = d + b + o &= S_x \\ \overline{S_y} = a + b + c &= S_y - (o - b) \\ \overline{S_z} = a + o + c + d &= S_z + (o - b) \end{cases}

⚠️觀察到:動 x 軸不會改變 x 軸之和;同時,另外兩軸會加減某一差值。這個觀察非常關鍵——本來我們需要同時考慮 3 個軸上的調整,有了這個觀察,現在只需要考慮按住中間值那根軸,調減最大和,調增最小和,就行了。可見,發掘問題的結構,可以有效降低問題空間的搜索維度

其他的交換操作想必用 \sigma_{z}^{ccw}\sigma_{x}^{+} 組合就能得到。驗證一下,比如沿 y 軸翻轉(記為 \sigma_{y}^{flip} ):

可以拆解為:

1⃣️ \sigma_{x}^{+}

2⃣️ \sigma_{z}^{ccw}

3⃣️ \sigma_{z}^{ccw}

4⃣️ \sigma_{x}^{+}

5⃣️ \sigma_{z}^{ccw}

6⃣️ \sigma_{z}^{ccw}

7⃣️ \sigma_{x}^{+}

∴ \sigma_{y}^{flip} = \sigma_{x}^{+} \cdot \sigma_{z}^{ccw} \cdot \sigma_{z}^{ccw} \cdot \sigma_{x}^{+} \cdot \sigma_{z}^{ccw} \cdot \sigma_{z}^{ccw} \cdot \sigma_{x}^{+}

找到套路

把所有的操作影響分析一遍:

x 軸上的交換:\sigma_{x}^{+} v.s. \sigma_{x}^{-}

\begin{cases} \overline{S_x} = d + b + o &= S_x \\ \overline{S_y} = a + b + c &= S_y - (o - b) \\ \overline{S_z} = a + o + c + d &= S_z + (o - b) \end{cases}

\begin{cases} \overline{S_x} = o + d + b &= S_x \\ \overline{S_y} = a + d + c &= S_y - (o - d) \\ \overline{S_z} = a + b + c + o &= S_z + (o - d) \end{cases}

y 軸上的交換:\sigma_{y}^{+} v.s. \sigma_{y}^{-}

\begin{cases} \overline{S_x} = d + a + b &= S_x - (o - a) \\ \overline{S_y} = o + a + c &= S_y \\ \overline{S_z} = o + b + c + d &= S_z + (o - a) \end{cases}

\begin{cases} \overline{S_x} = d + c + b &= S_x - (o - c) \\ \overline{S_y} = a + c + o &= S_y \\ \overline{S_z} = a + b + o + d &= S_z + (o - c) \end{cases}

\Delta \stackrel{def}{\Longrightarrow} o - 環上的交換點

象限 \overline{S_x} \overline{S_y} \overline{S_z}
\sigma_{x}^{+} S_x S_y - \Delta S_z + \Delta
\sigma_{x}^{-} S_x S_y - \Delta S_z + \Delta
\sigma_{y}^{+} S_x - \Delta S_y S_z + \Delta
\sigma_{y}^{-} S_x - \Delta S_y S_z + \Delta

環上的交換:\sigma_{z}^{I} v.s. \sigma_{z}^{II} v.s. \sigma_{z}^{III} v.s. \sigma_{z}^{IV}

\begin{cases} \overline{S_x} = d + o + a &= S_x - (b - a) \\ \overline{S_y} = b + o + c &= S_y + (b - a) \\ \overline{S_z} = b + a + c + d &= S_z \end{cases}

\begin{cases} \overline{S_x} = a + o + b &= S_x + (a - d) \\ \overline{S_y} = d + o + c &= S_y - (a - d) \\ \overline{S_z} = d + b + c + a &= S_z \end{cases}

\begin{cases} \overline{S_x} = c + o + b &= S_x - (d - c) \\ \overline{S_y} = a + o + d &= S_y + (d - c) \\ \overline{S_z} = a + b + d + c &= S_z \end{cases}

\begin{cases} \overline{S_x} = d + o + c &= S_x + (c - b) \\ \overline{S_y} = a + o + b &= S_y - (c - b) \\ \overline{S_z} = a + c + b + d &= S_z \end{cases}

\Delta \stackrel{def}{\Longrightarrow} 逆時針計起點 - 逆時針計終點

象限 \overline{S_x} \overline{S_y} \overline{S_z}
I S_x - \Delta S_y + \Delta S_z
II S_x + \Delta S_y - \Delta S_z
III S_x - \Delta S_y + \Delta S_z
IV S_x + \Delta S_y - \Delta S_z

翻轉:\sigma_{x}^{flip} v.s. \sigma_{y}^{flip}

\begin{cases} \overline{S_x} = d + o + b &= S_x \\ \overline{S_y} = c + o + a &= S_y \\ \overline{S_z} = c + b + a + d &= S_z \end{cases}

\begin{cases} \overline{S_x} = b + o + d &= S_x \\ \overline{S_y} = a + o + c &= S_y \\ \overline{S_z} = a + d + c + b &= S_z \end{cases}

象限 \overline{S_x} \overline{S_y} \overline{S_z}
沿 x 軸翻轉 S_x S_y S_z
沿 y 軸翻轉 S_x S_y S_z

⚠️即翻轉操作均不會改變各軸之和。

程序驗證

太麻煩了,還是寫程序驗證吧:

class Cycle
    attr_reader :ring, :center, :sum_x, :sum_y, :sum_z

    def initialize(a, b, c, d, o)
        @ring, @center = [a, b, c, d], o
        @sum_x = b + o + d
        @sum_y = a + o + c
        @sum_z = a + b + c + d      # sum_z = sum_x + sum_y - 2*o
    end

    def op_counterclockwise 
        @sum_x, @sum_y = @sum_y, @sum_x
        @sum_z = @sum_z

        header = @ring.shift
        @ring.push header
    end

    def op_clockwise
        self.op_counterclockwise
        self.op_counterclockwise
        self.op_counterclockwise
    end

    def op_x
        @sum_x = @sum_x
        delta = @center - @ring[1]
        @sum_y = @sum_y - delta
        @sum_z = @sum_z + delta

        @center, @ring[1] = @ring[1], @center
    end

    def op_y
        self.op_counterclockwise
        self.op_counterclockwise
        self.op_counterclockwise
        self.op_x
        self.op_counterclockwise
    end

    def op_swap_II
        self.op_y
        self.op_counterclockwise
        self.op_counterclockwise
        self.op_x
        self.op_counterclockwise
        self.op_counterclockwise
        self.op_y
    end

    def op_swap_I
        self.op_counterclockwise
        self.op_swap_II
        self.op_clockwise
    end

    def op_swap_III
        self.op_clockwise
        self.op_swap_II
        self.op_counterclockwise
    end

    def op_swap_IV
        self.op_counterclockwise
        self.op_counterclockwise
        self.op_swap_II
        self.op_clockwise
        self.op_clockwise
    end

    def op_flip_y
        self.op_x
        self.op_counterclockwise
        self.op_counterclockwise
        self.op_x
        self.op_counterclockwise
        self.op_counterclockwise
        self.op_x
    end

    def op_x_minus
        self.op_flip_y
        self.op_x
        self.op_flip_y
    end

    def op_flip_x
        self.op_counterclockwise
        self.op_flip_y
        self.op_clockwise
    end

    def op_y_minus
        self.op_flip_x
        self.op_y
        self.op_flip_x
    end

    def display
        puts "\t" + " "*4 + " y"
        puts "\t" + " "*4 + " ↑"
        puts "\t" + " "*4 + " "
        puts "\t" + " "*4 + " #{@ring[0]}"
        puts "\t" + " "*4 + " |"
        puts "#{@ring[3]}\t---- #{@center} ---- #{@ring[1]}   ➡︎ x"
        puts "\t" + " "*4 + " |"
        puts "\t" + " "*4 + " #{@ring[2]}"
        puts
        puts "x:\t#{@ring[3]} + #{@center} + #{@ring[1]} \t\t= #{@sum_x}"
        puts "y:\t#{@ring[0]} + #{@center} + #{@ring[2]} \t\t= #{@sum_y}"
        puts "z:\t#{@ring[0]} + #{@ring[1]} + #{@ring[2]} + #{@ring[3]} \t= #{@sum_z}"
    end
end

c = Cycle.new(2, 4, 6, 10, 8)
c.display

puts "-"*20 + " operator ... " + "-"*20
c.op_x_minus
c.op_swap_I
c.display

輸出:

         y
         ↑
         
         2
         |
10  ---- 8 ---- 4   ➡︎ x
         |
         6

x:  10 + 8 + 4      = 22
y:  2 + 8 + 6       = 16
z:  2 + 4 + 6 + 10  = 22
-------------------- operator ... --------------------
         y
         ↑
         
         4
         |
8   ---- 10 ---- 2   ➡︎ x
         |
         6

x:  8 + 10 + 2      = 20
y:  4 + 10 + 6      = 20
z:  4 + 2 + 6 + 8   = 20

跑了一下,5! = 120 種可能中,只有 8 種滿足約束。

好了,現在的問題是「怎麼教會小朋友?」了😅?


附上 TikZ 畫圖代碼:

\documentclass[tikz]{standalone}
%\usepackage{draculatheme}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
    % 定义全局参数
    \def\radius{2cm}       % 大圆半径
    \def\nodeRadius{0.5cm} % 节点圆半径
    \def\xShift{8cm}       % 水平偏移量
    
    % 定义绘制魔法圈的宏
    \newcommand{\drawMagickCircle}[9]{
        % 绘制节点
        \coordinate (O) at (0, 0);
        \coordinate (A) at (0, \radius);
        \coordinate (B) at (\radius, 0);
        \coordinate (C) at (0, -\radius);
        \coordinate (D) at (-\radius, 0);
        
        % 绘制外部的大圆
        \draw [thick, teal] (O) circle (\radius);
        
        % 绘制中间的十字线
        \draw [thick, teal] (A) -- (C);
        \draw [thick, teal] (D) -- (B);
        
        % 绘制各小圆
        \foreach \i/\v in {O/#1, A/#2, B/#3, C/#4, D/#5} {
            \draw [fill, teal] (\i) circle (\nodeRadius);
            \draw [fill, white] node at (\i) {$\v$};
        }
        
        % 绘制高亮小圆
        \foreach \i/\v in {#6/#7, #8/#9} {
            \filldraw [thick, yellow!30] (\i) circle (\nodeRadius);
            \draw [fill, black] node at (\i) {$\v$};
        }
    }
    
    \begin{scope}
        \drawMagickCircle{O}{A}{B}{C}{D}{O}{O}{A}{A};
    \end{scope}
    
    \node at (\xShift / 2, 0) { $ \stackrel{\sigma_{y}^{+}}{\Longrightarrow} $ };
    
    \begin{scope}[xshift=\xShift]
        \drawMagickCircle{A}{O}{B}{C}{D}{O}{A}{A}{O};
    \end{scope}
\end{tikzpicture}
\end{document}

Ref:

  1. 一道小学二年级算术题🧮引发的纷争🤣
  2. 一道小学四年级算术题🧮引发的纷争🤣
  3. 小学生算术题🧮纷争第三弹🤕
  4. 一道算术题🧮背后的算法迭代
  5. 小学生算术题🧮纷争第四弹🤕
  6. 小学生算术题🧮纷争第五弹🤕
  7. 小学生算术题🧮纷争第六弹🤕
  8. 小学生算术题🧮纷争第七弹🤕];
  9. 小學生算術題🧮紛爭第八彈🤕:我是在 4 堆變 3 堆嗎?我是在教小朋友群同構🤬!
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。