Exercise 1.3.6 ($n = 2^rm$, where $m$ is odd)

Show that every positive integer n has a unique expression of the form n = 2 r m , r 0 , m a positive odd integer.

Answers

Proof. Let n be a positive integer. Consider the subset A of defined by

A = { s : 2 s n } .

  • A since 0 A .
  • A is bounded above. Indeed, if m n , then 2 m 2 n > n , thus 2 m n , so m A .

    This shows that every element of A is less than n , so n is an upper bound for A .

Since A is bounded above, A has a largest element

r = max ( A ) .

By definition of a largest element, r A , so 2 r n . Thus there is some m such that n = 2 r m .

Assume for contradiction that m is even. Then 2 m , thus 2 r + 1 n , and r + 1 A . Then r + 1 max ( A ) = r . This is absurd, therefore m is odd.

n = 2 r m , 2 m .

Now we prove the unicity of this expression of n . If n = 2 r m = 2 t q , where m , q are odd, then 2 r 2 t q , and 2 r q = 1 , thus 2 r 2 t , so r t . Similarly t r , therefore r = t . From 2 r m = 2 t q , we deduce m = a . The expression is unique. □

Note: Alternatively, we can use the full decomposition in prime numbers of n = p p α ( p ) . Then r = α ( 2 ) , and m is the product of p α ( p ) for odd p . From a computational point of view, the above solution is preferable. It suggests the following algorithm to obtain r , m :

def niven136(n):
    r = 0
    m = n
    while m % 2 == 0:
        r = r + 1
        m = m // 2
    return (r,m)

print(niven136(3328))
(8, 13)

User profile picture
2024-10-03 08:06
Comments