Appendice
Appendice
Appendix
As
an easy consequence of this we note that for n ≥ 1 we have nn /n! <
i n
i≥0 n /i! = e and hence the following bound:
n n
n! > . (A.1.2)
e
The binomial coefficients are defined as follows:
n n! n(n − 1) · · · (n − k + 1)
= = , (A.1.3)
k k!(n − k)! k!
Fact A.1.1. Let A be an arbitrary n-element set. Then for any integer k
there are exactly nk subsets of A with k elements.
M. Dietzfelbinger: Primality Testing in Polynomial Time, LNCS 3000, pp. 133-142, 2004.
Springer-Verlag Berlin Heidelberg 2004
134 A. Appendix
Proof. For k < 0 or k > n, there is no such subset, and nk = 0. Thus,
assume 0 ≤ k ≤ n. We consider the set Sn of all permutations of A, i.e.,
sequences (a1 , . . . , an ) in which every element of A occurs exactly once. We
know that Sn has exactly n! elements. We now count the elements of Sn
again, grouped in a particular way according to the k-element subsets. For
an arbitrary k-element subset B of A, let
SB = {(a1 , . . . , an ) ∈ Sn | {a1 , . . . , ak } = B} .
Sn = SB ,
B⊆A, |B|=k
We note the following important recursion formula for the binomial coeffi-
cients:
n n
= = 1 , for all n ≥ 0 ; (A.1.5)
0 n
n n−1 n−1
= + , for all n ≥ 1, all integers k . (A.1.6)
k k−1 k
(Note that these formulas give another proof of the fact that nk is an integer.)
Formula (A.1.6) is obvious for k ≤ 0 and k ≥ n. For 1 ≤ k ≤ n − 1 it can
be verified directly from the definition, as follows:
n n−1
−
k k−1
n(n − 1) · · · (n − k + 1) k(n − 1)(n − 2) · · · (n − k + 1)
= −
k! (k − 1)! · k
(n − k) · (n − 1) · · · (n − k + 1) n−1
= = .
k! k
A.1 Basics from Combinatorics 135
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1
1 8 28 56 1 70 56 28 8
1 9 36
126 126 8484 36 9 1
1 10 45 120 210 252 210 120 45 10 1
. . . . . . . . . . . . . . . . . . . . . . .
Row n has n + 1 entries nk , 0 ≤ k ≤ n. The first and last entry in each row
is 1, each other entry is obtained by adding the two values that are above it
(to the north-west and to the north-east).
Next we note some useful estimates involving binomial coefficients. They
say that Pascal’s triangle is symmetric; and that in each row the entries
increase
2n up to the center, then decrease. Finally, bounds for the central entry
n in the even-numbered rows are given.
n
Lemma A.1.2. (a) nk = n−k , for 0 ≤ k ≤ n.
(b) If 1 ≤ k ≤ n2 , then k−1 n
< nk .
2n
(c) 2n ≤ 22n ≤ 2n n < 2 , for n ≥ 1.
2n
n
Proof. (a) Note that nk = k!(n−k)!
n! n!
= (n−k)!(n−(n−k))! = n−k .
(b) Observe that
n
n−k+1 n/2 + 1
nk = ≥ > 1.
k−1
k n/2
(c) The last inequality 2n < 22n is a direct consequence of (A.1.4). For
2n
n
the second inequality 22n ≤ 2n observe that by parts (a) and (b) 2n is
n2n 2n 2n n
maximal in the set containing 0 + 2n = 1 + 1 = 2 and i , 0 < i < 2n.
Hence 2n 2n
n is at least the average of these 2n numbers, which is 2 /2n by
(A.1.4). The first inequality is equivalent to 2n ≤ 2n , which is obviously true
for n ≥ 1.
The binomial coefficients are important in expressing powers of sums.
Assume (R, +, ·, 0, 1) is a commutative ring (see Definition 4.3.2). For a ∈ R
and m ≥ 0 we write am as an abbreviation of a · · · a (m factors), and mR
136 A. Appendix
This formula is often called the binomial theorem. It is easy to prove, using
the combinatorial interpretation of the binomial coefficients. The cases n = 0
and n = 1 are trivially true, so assume n ≥ 2 and consider the product
(a + b) · · · (a + b) with n factors. If this is expanded by “multiplying out”
in R, we obtain a sum of 2n products of n factors each, where a product
contains either the a or the b from each factor (a + b). By Fact A.1.1, there
are exactly nk products in which a occurs k times and b occurs n−k times. By
commutativity, each such product equals ak bn−k . Finally, we write ak bn−k +
· · · + ak bn−k as (1 + · · · + 1) · ak bn−k , with nk summands in each case.
a 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
2a mod 17 2 4 6 8 10 12 14 16 1 3 5 7 9 11 13 15
3a mod 17 3 6 9 12 15 1 4 7 10 13 16 2 5 8 11 14
4a mod 17 4 8 12 16 3 7 11 15 2 6 10 14 1 5 9 13
5a mod 17 5 10 15 3 8 13 1 6 11 16 4 9 14 2 7 12
6a mod 17 6 12 1 7 13 2 8 14 3 9 15 4 10 16 5 11
7a mod 17 7 14 4 11 1 8 15 5 12 2 9 16 6 13 3 10
8a mod 17 8 16 7 15 6 14 5 13 4 12 3 11 2 10 1 9
k17 (a) 0 4 3 4 3 3 3 4 4 5 5 5 4 5 4 8
sign of
+ + − + − − − + + − − − + − + +
(−1)k17 (a)
0 ≡ r + t ≡ i · a + j · a ≡ (i + j) · a (mod p).
But p a and p (i + j), since 0 < i + j < p. This is the desired contradiction,
and the claim is proved.
(For an example, the reader may wish to go back to Table A.1 and in the
sequences S17 (a) replace the entries r larger than 8 by 17 − r to see that in
each case the resulting sequence is just a permutation of (1, 2, . . . , 8).)
A.3 Proof of the Quadratic Reciprocity Law 139
Proof. The number kp (2) of elements of size at least p/2 in the sequence
Sp (2) = (2, 4, 6, . . . , p − 1) is the same as the number of elements of size at
least p/4 in (1, 2, 3, . . . , 12 (p − 1)). Since p/4 is not an integer, we have
kp (2) = 12 (p − 1) − p/4 .
For a ∈ Z, p a, let
i · a i · a − (i · a) mod p
λp (a) = (i · a) div p = = . (A.3.9)
p p
i∈Hp i∈Hp i∈Hp
(The last equation in this definition is immediate from (A.2.8). Note that
λp (a) depends on a, not only on the equivalence class of a modulo p.)
140 A. Appendix
Proof. Using the definition of R and T from Lemma A.3.1, and writing H
for Hp again, we calculate in Z:
i·a = (i · a − (i · a) mod p) + r+ t = λp (a) · p + r+ t.
i∈H i∈H r∈R t∈T r∈R t∈T
(A.3.10)
that means
q
, if p ≡ 1 or q ≡ 1 (mod 4) , and
p p
=
q
q
− , if p ≡ 3 and q ≡ 3 (mod 4).
p
A.3 Proof of the Quadratic Reciprocity Law 141
Proof. Let
p−1 q − 1
M = (i, j) 1 ≤ i ≤ , 1≤j≤ . (A.3.13)
2 2
Now define
M1 = {(i, j) ∈ M | j · p < i · q} , and
M2 = {(i, j) ∈ M | i · q < j · p}.
Note that there cannot be a pair (i, j) ∈ M that satisfies i · q = j · p, since
this would mean that p divides i, which is smaller than p. Thus, M1 and M2
split M into two disjoint subsets, and we get
p−1 q−1
|M1 | + |M2 | = |M | = · . (A.3.14)
2 2
Now for each fixed i ≤ p−1
2 the number of pairs (i, j) ∈ M1 is i · q/p . Hence
|M1 | = i · q/p = λp (q).
1≤i≤(p−1)/2
Induction step: Assume r + s ≥ 3, and the claim is true for all n , m that
together have fewer than r + s prime factors. By symmetry, we may assume
that n is not a prime number. We write n = k for numbers k, ≥ 3. By the
induction hypothesis, we have
= (−1) 2 · = (−1) 2 · 2 .
m k k−1 m−1 m −1 m−1
· 2 and ·
k m m
(A.3.15)
n2 − 1 (k 2 − 1)(2 − 1) + k 2 + 2 − 2 k 2 − 1 2 − 1
= ≡ + (mod 2).
8 8 8 8
(A.3.18)
If we plug this into (A.3.17), we obtain the inductive assertion. Thus the
proposition is proved.