Homepage › Solution manuals › Ivan Niven › An Introduction to the Theory of Numbers › Exercise 1.2.45 (Strange decomposition into base $3$)
Exercise 1.2.45 (Strange decomposition into base $3$)
Prove that any positive integer is uniquely expressed in the form
where each or .
Answers
Proof. This is not the usual decomposition of into base , because some digits may be negative (and ).
We prove the existence of such a decomposition. If , then , and if , then , thus and have the waited representation.
Let . Reasoning by in induction, assume that every positive integer has a decomposition in the form
where depends on .
By Problem 20, is of the form , where (the integers are of the form , where ). Then , thus , and , since . We may apply the induction hypothesis to , so
where , if , and .
The induction is done, so every positive integer is expressed in the form
Now we prove the unicity of this decomposition. Suppose that
Then
and similarly
Therefore
thus
thus , so , where are integers, so that . Exchanging the roles of and , we obtain similarly , so is proved. Then
Assume for the sake of contradiction that , and let be the least index for which . Then
and
Then , where , hence , in contradiction with the definition of . This contradiction shows that . This proves that the decomposition is unique. □
Note : These python functions return the representation of an integer , following the algorithm of this solution. The first is recursive, the second iterative. The function ”value” computes the inverse operation.
def representation(n):
if n == 1:
return [1]
else:
r , q = n % 3, n // 3
if r == 2:
r -= 3
q += 1
l = representation(q)
l.append(r)
return l
def value(l):
s = 0
power = 1
while l != []:
s += power * l.pop()
power *= 3
return s
n = 1234567891
l = representation(n); print(l)
print(value(l))
[1, 0, 1, -1, -1, 0, 0, 1, 0, 1, -1, -1, -1, 0, -1, 1, 0, -1, 0, 1]
1234567891
def repr(n):
l = []
while n != 0:
r , q = n % 3, n // 3
if r == 2:
r -= 3
q += 1
l.append(r)
assert (n-r) % 3 == 0
n = (n - r) // 3
l.reverse()
return l
n = 1234567891
print(repr(n))
[1, 0, 1, -1, -1, 0, 0, 1, 0, 1, -1, -1, -1, 0, -1, 1, 0, -1, 0, 1]
Comments
-
Hi Richard, this looks good with 2 typos after words "apply the induction hypothesis to k, so" a = etc ... there are powers to m-2 and m-1 that should be l-2 and l-1, respectively. Those are the only typos I can see.BretSherfinski • 2025-03-08
-
Observation: 0(3^1)+0=3^{0}-1 = 0. Therefore, the result may not apply to 0. No information about m is declared in the statement of the problem.BretSherfinski • 2025-03-08
-
Thank you Richard for proving that m=n for the uniqueness. I have spent more time on this problem than expected. There is a small problem further along in the proof. In particular, how do we know that m-1-i>0 in showing 3 divides b_i-c_i ? This can be easily fixed but I wanted to make you aware of this. We don't need to introduce the word degree(of a polynomial) but the representation is indeed unique which I will attempt to complete by an induction argument. I apoligize for not being able to type mathematically here. I am very new to this website.BretSherfinski • 2025-03-08
-
The typos are corrected.richardganaye • 2025-03-10
-
The statement specifies that $a$ is a positive integer, which means generally (and particularly in NKM) that $a>0$, so we don't have to consider the case $a = 0$. Your interesting counterexample shows that one cannot extend the uniqueness result to $a \in \mathbb{N} = \{0, 1, 2,\ldots\}$, but note that in the statement, all powers of $3$ are distinct, and this is not the case in the representation $0 = 3^0 - 1 = 3^0 - 3^0$. (If $a = 0$, the algorithm given in the note returns an empty list).richardganaye • 2025-03-10
-
If $m - i - 1 = 0$, then the sums contains a unique term $b_i$ in the left member and $c_i$ in the right member, so $3 \mid b_i - c_i = 0$. If we write the sum with a symbol $\sum$, then the sum is written $\sum\limits_{j= 0}^{m-i+1} b_{m-1-j}3^{m-1-i-j} \equiv b_i \pmod 3$. Here I prefer to write $b_{m-1} 3^{m-1-i} + b_{m-2} 3^{m-2-i} + \cdots + b_i$ which is more readable, being understood that this sum contains only the term $b_i$ if $m-1-i = 0$. I don't think this is an obstacle to understanding the solution.richardganaye • 2025-03-10
-
The proof of existence or unicity by induction in the usual representations of integers may start from the lower powers or start from the higher powers (teachers in primary school may use one method or the other). The defect of my solution is that it mixed the two approaches. I think that $3^m$ is not a particular term, as we see in the algorithm which computes the coefficients $b_i$. It turns out that $b_m = 1$ is always true, even if we don't explicitly ask it in the program. So I will rewrite another shorter proof of unicity, without showing first that $n = m$.richardganaye • 2025-03-10
-
I have no exclusive rights to these solutions! If you want to give an alternative solution, it is easy to insert it on the site "solverer". It suffices to click on the button "add new solution", and paste some latex code (without "begin document", "end document"). I have been visiting this website for less than a year, and, although I am a "boomer", I was able to use it easily.richardganaye • 2025-03-10
Another proof for the part "unicity".
Proof. Suppose that and
where .
We may assume without loss of generality that (otherwise, we exchange the roles of and ). Then
where , and if (if such indices exist).
We prove by induction that for all .
Consider the proposition
defined for .
First
thus , where , so .
Suppose now that is true for some integer , so that
is true. Then the equality (1) becomes
and after division by , the equality (1) gives
or equivalently, with the change of index ,
Then
thus , where , so . This shows that is true.
The induction is done, which proves that for all .
Since , we obtain , so , and the two representations are identical. □
Comments
-
Richard, I appreciate all the work you are doing here and thankful to have this resource. This is helping me pickup Number Theory Studies in a serious way again. I will take back the comment about there being a problem. I will make my first attempt to contribute by expanding your ideas and adding another proof on my own.BretSherfinski • 2025-03-13
The author has not declared any information about
, but when
there can be no representation of
.
....so m=n. Then
If then the above equation becomes ensuring uniqueness. If assume for the sake of contradiction that and let be the least index for which . Then
and
If
then
, contrary to the choice of
. Therefore, for such an
the inequality
must hold. Furthermore, if
for every
, the equation above would still force
, so for some
where
we must conclude
. Nevertheless, even with such
the equation above yields
where
hence
, contradicting the definition of
. This argument shows that no such
exists and establishes that
. This proves that the decomposition is unique.
Another proof of unicity: Assume we had
two different representations of the same number and have it be the example that has the smallest maximal power of , say . Looking at each side, all summands are divisible by except and . Therefore, . But since these two numbers are each , or , that shows that in fact . Subtracting them from each side and dividing by gives
,
and this example has a smaller maximal power of , namely . This contradiction shows there cannot be two different representations of the same number.
Comments
-
Hi Bret. I agree with your writing. Your contributions are welcome.richardganaye • 2025-03-13