I have recently begun self-studying Number Theory, and am working on proving:
Show that every integer $n>0$ can be uniquely written as $$n = \sum_{i=0}^mc_i3^i$$ where $c_i \in \{ -1,0,1\}$ and $c_m \neq 0$.
I believe I have already shown the existence portion of this proof correctly, and now I am looking for some hints on the uniqueness part. So far what I have tried is:
Suppose for the sake of contradiction that there is an alternate representation of $n$ besides $n = \sum_{i=0}^mc_i3^i$, say $n = \sum_{i=0}^pb_i3^i$ where we still have $b_p \neq 0$ and $b_i \in \{-1,0,1\}$.
At this point I felt that I first need to establish that $m=p$, and second show $c_i=b_i$ for each $i \in \{1,2,\dots, m\}$. To show the former, I left off in my proof by contradiction with
Without loss of generality suppose $p>m$. We know there is an integer $q$ such that $m+q=p$. We have two ways of writing $n$, which means $$ \sum_{i=0}^pb_i3^i-\sum_{i=0}^mc_i3^i=0 \\ \implies \left(\sum_{i=0}^mb_i3^i+\sum_{i=m+1}^{m+q}b_i3^i\right)-\sum_{i=0}^mc_i3^i=0 \\ \implies \sum_{i=0}^m(b_i-c_i)3^i+\sum_{i=m+1}^{m+q}b_i3^i=0 \\ \implies \sum_{i=m+1}^{m+q}b_i3^i=\sum_{i=0}^m(c_i-b_i)3^i$$
At this point I am stuck. If anyone has any hints to help me find the contradiction or feel that there is a better way to establish uniqueness, please let me know!