Unverified Commit 6e8fbf39 authored by 蔡廷漳's avatar 蔡廷漳 Committed by GitHub
Browse files

添加了平衡三进制唯一性的证明

个人认为是有必要证明唯一性的,比如给出的例题就用上了这一点,保证移动的唯一性。
parent 0fd28d33
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -79,6 +79,26 @@ $$
\texttt{ 100Z10} = 243 \cdot 1 + 81 \cdot 0 + 27 \cdot 0 + 9 \cdot (-1) + 3 \cdot 1 + 1 \cdot 0 = 237_{10}
$$

## 平衡三进制的唯一性

对于一个平衡三进制数$X_3$来说,其可以按照每一位$x_i$乘上对应的权值$3^i$来唯一得到一个十进制数$Y_{10}$。那对于一个十进制数$Y_{10}$,是否 **唯一对应一个平衡三进制数** 呢?

答案是肯定的。

我们利用**反证法**来求证:

假设一个十进制数$Y_{10}$,存在两个**不同的平衡三进制数**$A_3,B_3$转化成十进制时等于$Y_{10}$,即证$A_3 = B_3$。分情况讨论:

> 1. 当$Y_{10}=0$,显然$A_3 = B_3 = 0_3$,与假设矛盾。
> 2. 当$Y_{10}>0$:
>
>    - 将位按低位到高位编号,$A_3,B_3$必存在位$i$使得$a_i\neq b_i$。可以发现低位$i-1,i-2,...,0$与证明无关,将$A_3,B_3$按位右移$i$位后得到$A_3',B_3'$,原问题等价于证明$A_3'=B_3'$。
>
>     - 对于$A_3',B_3'$第$0$位,$a_0 \neq b_0$。假设$b_0 > a_0$($a_0>b_0$时结果相同),易知$b_0 - a_0 \in [1,2]$。$A_3'$的位$i=1,2,3,...$对于$A_3'$的值的贡献为$S_1 = a_1 \times 3^1 + a_2 \times 3^2+ \dots$,$B_3'$的位$i=1,2,3,...$对于$B_3'$的值的贡献为$S_2 = b_1 \times 3^1 + b_2 \times 3^2 + \dots$。由于$A_3' = B_3'$,得$S_1 - S_2 = b_0 - a_0$。$S_1,S_2$有公因子$3$,而$b_0 - a_0$显然不能被$3$整除,与假设矛盾。
> 3. 当$Y_{10}<0$,证法与$Y_{10}>0$相同。

故对于任意十进制$Y_{10}$,均有唯一对应的平衡三进制$X_3$。

## 练习题

 [Topcoder SRM 604, Div1-250](https://community.topcoder.com/stat?c=problem_statement&pm=12917&rd=15837)