Representation of Integers in Balanced Ternary

Theorem
Let $n \in \Z$ be an integer.

$n$ can be represented uniquely in balanced ternary:


 * $\displaystyle n = \sum_{j \mathop = 0}^m r_j 3^j$


 * $\left[{r_m r_{m-1} \ldots r_2 r_1 r_0}\right]$

such that:

where:
 * $m \in \Z_{>0}$ is a strictly positive integer such that $3^m \le \size n < 3^{m + 1}$
 * all the $r_j$ are such that $r_j \in \set {\underline 1, 0, 1}$, where $\underline 1 := -1$.