Homepage › Solution manuals › Ivan Niven › An Introduction to the Theory of Numbers › Exercise 4.1.35* (Lucas's Theorem)
Exercise 4.1.35* (Lucas's Theorem)
Suppose that and that . Show that . Suppose also that with . Show that . Deduce that if and in base , then
Answers
First proof. (Following the steps of Problem 35.)
Proof.
- (a)
-
Suppose that
, where
. Then
Therefore
Moreover
and, by Wilson’s Theorem,
thus
- (b)
-
Now
so that are respectively the last digits of in base .
-
Suppose first that , so that there is no carry when we add and in base . Put
Then
so
where, by part (a), since ,
We prove
since both members are integers, , so are invertible modulo , so are , and
After simplification by , which is invertible modulo , we obtain the congruence (2). Then the congruence (1) becomes
-
Suppose now that , so that there is a carry when we add and in base . Then there is at least a carry when we add in base . By Problem 34 (Kummer’s Theorem), and , so
In both cases,
-
- (c)
-
We write
, with the same
be introducing possibly some digits
at the left of the writing of
or
in base
. Then
.
We prove by induction on that, for all such that , where and are the writings of in base ,
- If then , so
-
Suppose that the property is true for all integers less that , and take such that . We write in base in the form . Then , where
where for are the digits of in base .
The induction hypothesis applied to gives
Then, by part (b),
- The induction is done, thus the property is true for all .
In conclusion, if , where for all ,
Second proof (From a paper of N.J.Fine, 1947)
Proof. We show first the Lucas’s Theorem:
Theorem.If and are the writings of and in base , then
We expand in , where is the field with elements.
First
and the coefficient of is .
Next, since the characteristic of is , for all , therefore
-
If for all indices , then there is at least a -tuple such that , which is
The unicity of the writing of in base shows that there is exactly one such .
This prove that the coefficient of in is
-
If there is some index for which , then there is no such that , so the coefficient of is zero modulo . Moreover , so
In both cases,
□
Now we can prove the result of Problem 35. Here and are given.
If there is some index such that , then there is at least a carry in the addition of and in base . By Kummer’s Theorem (Problem 34), . Moreover, for the same reason . So
Otherwise for all , so is the -th digit of in base . Therefore, the Lucas’s Theorem gives
□
Note 1: Conversely, if we know the result of Problem 35 by the first proof, we can prove the Lucas’s Theorem. We write , where .
If there is no carry when we add in base , then for all , so
Otherwise, if there is a carry, then
Moreover, if there is a carry at the index , thus , so , and then
This proves Lucas’s Theorem with the result of Problem 35.
The equivalence between Problem 35 and Lucas’s Theorem is not obvious without the Kummer’s Theorem (Problem 34).
Note 2: We can compare with Sage the results of Problem 35 and Lucas Theorem to compute modulo . For instance, for , we obtain in base
so .
With Lucas’s Theorem,
and with the result of Problem 35,
def decomposition(n, p):
l = []
while n != 0:
q, r = n // p, n % p
n = q
l.append(r)
return l
def lucas(n, a, p):
la = decomposition(a, p)
ln = decomposition(n, p)
k = max(len(la), len(ln))
for i in range(len(la), k):
la.append(0)
for i in range(len(ln), k):
ln.append(0)
res = 1
for i in range(k):
res *= binomial(ln[i], la[i])
return res % p
def niven(a, b, p):
la = decomposition(a, p)
lb = decomposition(b, p)
k = max(len(la), len(lb))
for i in range(len(la), k):
la.append(0)
for i in range(len(lb), k):
lb.append(0)
res = 1
for i in range(k):
res *= binomial(la[i]+ lb[i], la[i])
return res % p
n = 17
p = 7
b1, b2, b3 = [], [], []
for a in range(n + 1):
b1.append(binomial(n, a) % p)
b2.append(lucas(n, a, p))
b3.append(niven(a, n - a ,p))
print(b1)
print(b2)
print(b3)
[1, 3, 3, 1, 0, 0, 0, 2, 6, 6, 2, 0, 0, 0, 1, 3, 3, 1]
[1, 3, 3, 1, 0, 0, 0, 2, 6, 6, 2, 0, 0, 0, 1, 3, 3, 1]
[1, 3, 3, 1, 0, 0, 0, 2, 6, 6, 2, 0, 0, 0, 1, 3, 3, 1]