目錄
Contents
- 魔術農庄1 Magic Farm 1
- 不變量計算 The calculation of invariants
- 魔術農庄2 Magic Farm 2
- 不變量計算 The computation of invariants
- 后記 Appendix
近來,我在新生群里聽說了這樣一個有趣的問題。
Recently, I heard an interesting problem in freshmen group.
![]() |
很久以前,有三種羊,紅羊,藍羊,黃羊。 Long time ago, there were three kinds of animals, say red sheep, blue goat and yellow lamb. |
![]() |
他們住在一個名為『魔術農庄』的農場。 They lived in a farm called Magic Farm. |
![]() |
如果兩只不同色羊相撞,那么他們變成第三種顏色。 If two different animals collide, then they will convert into the other one species. |
![]() |
有紅藍黃三色羊各15,19,20只,問最后會不會出現 所有綿羊同色的情況? There are 15 red sheep, 19 blue goats and 20 yellow lambs respectively. Can all the animals become of same color at the end? |
問題的解決基於這樣的一個簡單的觀察。
The solution of this problem is based on the simple observation as follow.
![]() |
每一次物種的轉變,兩物種的數量只差$\bmod 3$都是定值。 Each time of convertion of species, the difference of number of any pair of two species is a constant $\bmod 3$. |
但是現在,兩兩的差為$1,1,2\bmod 3$, 所以不論怎么基因突變,都不能有兩種數量同時為零。
But now, the differences are $1,1,2\bmod 3$ respectively, so no matter how the gene mutations occur, there can not have numbers of two species vanishing at the same time.
選擇$\bmod 3$並不是巧合,這背后有一些數學,下面要來揭示這一點。
Our choice of $\bmod 3$ is not a coincidence, and there are some mathematics behind it. We will illustrate it in the following context.
記$a,b,c$分別是三種羊,以他們為基張成一個自由Abel群$a\mathbb{Z}+b\mathbb{Z}+c\mathbb{Z}$.
Denote $a,b,c$ by three kinds of animals, consider $a\mathbb{Z}+b\mathbb{Z}+c\mathbb{Z}$, the free abelian group generated by them.
那么任何羊的數量狀態都是這個群中的一個元素。
Then any state of anmial's numbers is an element in this group.
鑒於物種的變化,我們商掉關系$a+b-2c, a+c-2b, b+c-2a$.
Taking into the consideration the change of species, we need to module the relation $a+b-2c, a+c-2b, b+c-2a$.
這樣,可以轉化的狀態就在商群中相等了。
Then, two states in which one can convert into the other one are equal in the quotient group.
現在,我們需要一些計算。
Now, we need some calculation.
$$\begin{array}{l} \quad a\mathbb{Z}+b\mathbb{Z}+c\mathbb{Z}/(a+b-2c, a+c-2b, b+c-2a) \\ = a\mathbb{Z}+b\mathbb{Z}+(2a-b)\mathbb{Z}/(a+b-2c, a+c-2b, b+c-2a) \\ = a\mathbb{Z}+b\mathbb{Z}/(a+b-2(2b-a),b+(2b-a)-2a) \\ = a\mathbb{Z}+b\mathbb{Z}/(3a-3b) \\ = a\mathbb{Z}+(b-a)\mathbb{Z}/(3b-3a) \\ = a\mathbb{Z}+(b-a)\mathbb{Z}/3\mathbb{Z}\\ = \mathbb{Z}\oplus \mathbb{Z}/3\mathbb{Z} \end{array}$$
在此映射下,$a\mapsto (1,0), b\mapsto (1,1), c\mapsto (1,-1)$.
Under this isomorphism, $a\mapsto (1,0), b\mapsto (1,1), c\mapsto (1,-1)$.
所以$15a+19b+20c\mapsto (54, -1)$, 不能等於任何$na,nb,nc$的像。
Therefore $15a+19b+20c\mapsto (54, -1)$ which cannot equals to any image of $na,nb,nc$.
同時,我們也發現,在這個問題中,有兩個不變量,一個是羊的總數,一個是某兩種羊數量之差$\bmod 3$.
On top of that, we find that, in this problem, there are two invariants, the one is the total number of animals, and the other one is the difference $\bmod 3$ between certain two species.
下面我們來看一個類似的問題。
Now, we turn to anthor similar problem.
![]() |
很久以前,有三種羊,紅羊,藍羊,黃羊。 Long time ago, there were three kinds of animal, say red sheep, blue goat and yellow lamb. |
![]() |
他們住在一個名為『魔術農庄』的農場。 They lived in a farm called Magic Farm. |
![]() |
如果兩只不同的羊相撞,那么他們合體成另一個物種。 If two distinct animals collide, then they will blend into one animal of the other one species. |
![]() |
有紅藍黃三色羊各15,19,20只,最終會全變成哪種顏色的羊? There are 15 red sheep, 19 blue goats and 20 yellow lambs respectively. What kind of species will unify the farm at the end? |
這個問題顯得怪怪的,似乎沒有明顯的線索顯示最終的顏色是確定的。
This problem is weird, because it is not clear that the final color is determined in advance.
如果我們只想知道最后能夠是什么樣子的,只需有下面的觀察。
If we just want to know about one of the possible final stages, the following observation is sufficiant.
![]() |
如果我們有兩只紅羊,可以從鄰居家借來一只藍羊,最后可以變成一只藍羊(然后我們再還回去)。 If we have two red sheep, we can borrow a blue goat from neighbor, then they can finally becomes one blue goat (and we can give it back to our neighbor). |
使用這個技巧,我們可以用不同顏色的羊作為引子,兩個兩個地除去相同顏色的羊。
Using this trick, we can cancell pair by pair of same species ultizing another species as trigger.
最終,15,19,20只變成1,1,0只,於是最終變成的是黃羊。
Finally, 15, 19, 20 becomes 1, 1, 0. So the final species is the yellow lamb.
如果我們沿着上面問題的思路,我們需要作如下計算。
If we follow the clue of the problem above, we need the following computation.
$$\begin{array}{l} \quad a\mathbb{Z}+b\mathbb{Z}+c\mathbb{Z}/(a+b-c,a+c-b,b+c-a) \\ = a\mathbb{Z}+b\mathbb{Z}+(a+b)\mathbb{Z}/(a+(a+b)-b, b+(a+b)-a) \\ = a\mathbb{Z}/2\mathbb{Z} + b\mathbb{Z}/2\mathbb{Z} \\ \cong \mathbb{Z}/2\mathbb{Z} \oplus \mathbb{Z}/2\mathbb{Z}\end{array}$$
其中$a\mapsto (1,0), b\mapsto (0,1), c\mapsto (1,1)$,所以$15a+19b+20c\mapsto (1,1)$.
Where $a\mapsto (1,0), b\mapsto (0,1), c\mapsto (1,1)$. As a result, $15a+19b+20c\mapsto (1,1)$.
注意到$na\mapsto (n,0), nb\mapsto (0,n), nc\mapsto (n,n)$,所以$15a+19b+20c\equiv nc$,且$n$是奇數。
Note that $na\mapsto (n,0), nb\mapsto (0,n), nc\mapsto (n,n)$, hence $15a+19b+20c\equiv nc$, with $n$ odd.
有時無法判斷最終的顏色,即$(0,0)$的情況。
Sometimes, the final speices is not determined, that is the case $(0,0)$.
![]() |
現在,最后剩下的可能是任何顏色。 Now, the remain kind of animals can be any speices. |
不變量令人驚奇地是Klein四元群。
The invariant is amazingly the Klein's group of order 4.
階數為2的體現已在上面『借羊』的例子中體現。
The fact that the order is 2 is demonstrated in the example of `borrowing a goat'.
原始問題是
The original problem is
有紅黃藍三色綿羊各15 19 20只,兩只異色綿羊可以同時變為第三色,問最后會不會出現 所有綿羊同色的情況?
There are 15, 19 and 20 sheep of color red, yellow and blue respectively. Any pair of sheep of different colors can convert into the rest one color simultaneously. Can all the sheep become of same color at the end?
為了趣味起見,我編了一個故事。
To make it of more fun, I made a story.
『類似的問題』是我自己題的。
The `similar problem' is raised by myself.
這個問題的提法啟發自給『孔明棋』。可以利用條帶狀染Klein四元群來確定最終落子位置。
The raising of this problem is inspired by the game `Peg Solitaire' , where we can know the final position by coloring with Klein group in striped pattern.
a | b | c | ||||
b | c | a | ||||
a | b | c | a | b | c | a |
b | c | a | b | c | a | b |
c | a | b | c | a | b | c |
c | a | b | ||||
a | b | c |
圖片是用powerpoint制作的。
The picture is made by powerpoint.
感謝湯一鳴提供最初的做法,感謝劉奔和我討論。
Thank for Tang Yiming for his original solution, and for Liu Ben for discussion.
感謝媽媽的水彩筆。
Thank for my mom's markers.