here

Practice Final Solutions
1. Find integers x and y such that
13x + 15y = 1
SOLUTION: By the Euclidean algorithm:
15 = 1 · 13 + 2
13 = 6 · 2 + 1
One can work backwards to obtain
1 = 13 − 6 · 2 = 13 − 6 · (15 − 1 · 13) = 7 · 13 − 6 · 15
Hence one can take x = 7 and y = −6.
2. (a) Let i ≥ 1. Show that
10i − 1
9
is an integer.
SOLUTION: 10i − 1 ≡ 1i − 1 ≡ 0 mod 9.
(b) Let p 6= 2, 3, 5 be a prime number. Show that p divides
10p−1 − 1
9
SOLUTION: Since for p 6= 2, 5 the number 10 is co-prime to p it follows from
Fermat’s little theorem that
10p−1 − 1 ≡ 0
Since p 6= 3 it follows that p actually divides
mod p
10p−1 −1
.
9
(c) Show that every prime p 6= 2, 3, 5 divides a number of the form
11 · · · 1
1
SOLUTION:
10p−1 − 1
= 11 · · · 1
9
where there are p − 1 digits of 1’s.
3. Let p be an odd prime. Find a formula for the Legendre symbol
SOLUTION: One has
−2
p
−2
p
=
−1
p
2
p
Let us find a formula for when this is equal to 1. The two cases are 1 · 1 = 1 and
(−1) · (−1) = 1. The first is the case if p ≡ 1 mod 4 and p ≡ ±1 mod 8. This means
that one needs p ≡ 1 mod 8. The second is the case if p ≡ 3 mod 4 and p ≡ 3 or 5
mod 8. This means that p ≡ 3 mod 8. Hence
−2
p
=1
if and only if p ≡ 1 or 3 mod 8.
4. Let p ≡ 1 mod 4 be a prime and a a quadratic residue mod p. Decide with justification
if then automatically p − a is quadratic residue mod p.
SOLUTION: Since p − a ≡ −a mod p it suffices to decide if −a is a quadratic residue.
But
−a
−1
a
=
= (−1)(p−1)/2 · 1 = 1
p
p
p
since a is a quadratic residue and p ≡ 1 mod 4.
5. (a) Calculate φ(7!).
SOLUTION: Note that
7! = 1 · 2 · 3 · 22 · 5 · 2 · 3 · 7 = 24 · 32 · 5 · 7
Hence
φ(7!) = φ(24 )φ(32 )φ(5)φ(7) = 23 3 · 2 · 4 · 6 = 27 32
(b) Suppose p and q are twin primes, i.e. q = p + 2. Show that
φ(q) = φ(p) + 2
2
SOLUTION: Since p and q are primes one has
φ(q) = q − 1 = p + 2 − 1 = (p − 1) + 2 = φ(p) + 2
(c) Suppose
e
n = 22
Find ν(n) and σ(n).
SOLUTION:
ν(n) = 2e + 1
e
σ(n) = 22
+1
−1
6. Find the least non-negative residue of 32011 modulo 22.
SOLUTION: Note that φ(22) = 10. Therefore, since 3 is co-prime to 22 it follows from
Euler’s theorem
32011 = (3201 )10 · 3 ≡ 3 mod 22
Hence the answer is 3.
2
7. Suppose p is prime and n ≥ 2 and ap ≡ 1 mod n. Show that ordn a = p2 if and only
if ap 6≡ 1 mod n.
2
SOLUTION: Since ap ≡ 1 mod n it follows that the order of a divides p2 . It is hence
one of 1, p, p2 since p is a prime. It is then clear that the order is p2 precisely when
ap 6≡ 1 mod n.
8. Let n ≥ 1. Find
gcd(n, 2n2 + 1)
SOLUTION: Note that
(2n2 + 1) − 2n · n = 1
It follows that the gcd is 1.
9. Find the collection of all integers that are of the form ord151 (a) where a ranges through
the integers co-prime to 151.
SOLUTION: Note that 151 is a prime so there is a primitive root b and every a co-prime
to 151 is of the form bi . The order of b is 150 = 2 · 3 · 52 . Since
ord(bi ) = ord(b)/gcd(i, ord(b))
it follows that the set of orders is the set of divisors of 150. This set is
{1, 2, 3, 5, 6, 10, 15, 30, 25, 50, 75, 150}
3
10. (a) State the Mobius inversion formula.
(b) Show that for all n ≥ 1 one has
X
ν(d)µ(n/d) = 1
d|n
SOLUTION: Let
f =ν∗µ
By Mobius inversion one has
ν =f ∗1
But one also has
ν =1∗1
Hence
(f ∗ 1) ∗ µ = (1 ∗ 1) ∗ µ
and hence
f ∗δ =1∗δ
and hence
f =1
and this implies the desired result.
11. (a) Find all primitive roots modulo 13.
SOLUTION: There are φ(φ(13)) = φ(12) = 4 primitive roots (mod 1)3. We check
and find that 2 is a primitive root, meaning its order is 12 mod 13. Hence, if i is
relatively prime to 12, 2i is also of order 12. Thus 25 , 27 , and 21 1 are also primitive
roots, and these are 6, 11, 7 (mod 1)3. Thus we have found all 4 primitive roots,
and they are 2, 6, 11, 7.
(b) How many primitive roots are there modulo 171?
SOLUTION: 171 is 9 · 19, and by the primitive root theorem there are no primitive
roots modulo a number of this form (since it is not a power of a prime, or twice
the power of a prime).
(c) How many primitive roots are there modulo 173?
SOLUTION: 173 is prime, so there are φ(φ(173)) = φ(172) = φ(4 · 43) = 2 · 42 = 84
primitive roots (mod 1)73.
12. Find a primitive root modulo 11100 .
SOLUTION: We know that if r is a primitive root (mod 1)1 such that rp−1 6≡ 1
4
(mod 112 ), then we have
100−2
r11
(11−1)
6≡ 1
(mod 11100 ),
and hence we must have r is a primitive root modulo 11100 . (Let p = 11. We know the
order of r has to be at least p − 1, or else r is not a primitive root (mod p). The order
of r has to divide φ(p100 ) = p99 (p − 1), and hence it must be of the form pi (p − 1). If
98
i
9
i < 99, then we have that rp (p−1) = (rp (p−1) )p 8−i ≡ 1 (mod p100 ), contradiciting the
above.)
Consider 2. It is a primitive root (mod 1)1, but 210 6≡ 1 (mod 121). Hence 2 is a
primitive root (mod 1)1100 by the above argument.
13. Find the order of 12 modulo 25.
SOLUTION: This order must divide φ(25) = 20, so it can only be 2, 4, 5, 10, or 20.
Taking these powers of 12 modulo 25, we get that 12 is in fact a primitive root (mod 2)5,
and so its order is 20.
√
14. Write down the continued fraction expansion for 29. Find its first five convergents.
√
SOLUTION: b 29c = 5, so the first term of the expansion is 5. The next term is
%
$√
1
29 + 5
√
=
= 2.
4
29 − 5
The next term is
% % $√
%
$
√
$ √
29 + 5
4
4 29 + 12
29 + 3
− 2) = √
=
=
= 1.
1/(
4
20
5
29 − 3
The next term is
% % $√
%
$
√
$ √
5
29 + 3
29 + 2
5 29 + 10
− 1) = √
=
= 1.
1/(
=
5
25
5
29 − 2
The next term is
$
% % $√
%
√
$ √
29 + 2
5
5 29 + 15
29 + 3
1/(
− 1) = √
=
=
= 2.
5
20
4
29 − 3
The next term is
$
% %
√
$ √
j√
k
29 + 3
4
4 29 + 20
1/(
− 2) = √
=
=
29 + 5 = 10.
4
4
29 − 5
5
The next term is
√
1
=2
29 − 5
from before. Clearly, from now on the terms will repeat the period 2, 1, 1, 2, 10, so the
continued fraction expansion is
√
29 = [5, 2, 1, 1, 2, 10].
The first five convergents are
5, [5, 2], [5, 2, 1], [5, 2, 1, 1], [5, 2, 1, 1, 2],
which are 5, 11/2, 16/3, 27/5, 70/13.
15. Which quadratic number does the continued fraction [4, 2, 1] correspond to?
SOLUTION: First we note that if β = [2, 1], then
β =2+
so
1=
1
1+
1
β
,
2
1
+
β
β+1
, so
β 2 + β = 2β + 2 + β = 3β + 2
, and so β 2 − 2β − 2 = 0, meaning
√
4+8
2− 4+8
β=
or β =
2
2
√
It cannot be the latter, as it is positive, so β = 1 + 3. Now, we have
2+
√
1
1
√ =4+
[4, 2, 1] = 4 + = 4 +
β
1+ 3
16. Find two continued fraction expansions for
13
5 .
√
3−1
=
2
3+7
.
2
Are there others? Why or why not?
SOLUTION: Run the Euclidean algorithm on (13, 5) and get
13 = 2 · 5 + 3
5=1·3+2
3=1·2+1
6
√
2 = 2 · 1.
Thus one continued fraction expansion of 13/5 is [2, 1, 1, 2], and another is [2, 1, 1, 1, 1],
since 1/2 = 1/(1 + 1/1). These are the only two expansions, since rational numbers
always have exactly two expansions, as proven on the homework.
√
17. Show that 5042
3 = 1.7320508075 . . . .
2911 is a convergent of
This isn’t a great practice problem, because its best done with a calculator. If you
√
compute | 3 − 5042
2911 |, this is
0.000000034066 · · · <
1
= 0.000000059005,
2(2911)2
and so this must be a convergent by a theorem shown in class.
18. Which of the following can be written as a sum of two squares? A sum of three squares?
Four squares?
(a) 39470
(b) 55555
(c) 34578
(d) 12!
(e) A number of the form p2 + 2, where p is a prime.
SOLUTION: For the first three of these, one first writes down the prime factorizations: they are 2 · 5 · 3947, 5 · 41 · 271, 2 · 32 · 17 · 113. All of these contain primes
in the prime factorization which are 3 mod 4 but not taken to an even power, so
none are sums of two squares. Also, 3 is a prime divisor of 12!, but it divides 12!
exactly up to the fifth power, which is not even, and hence 12! is also not a sum of
two squares. Finally, for the last example, if p is even, p2 + 2 = 6 which is not a
sum of two squares, and p2 + 2 ≡ 3 (mod 4) if p is odd, so this is never a sum of
two squares.
Now we check for sums of three squares. The only numbers not expressible as
sums of three squares are of the form 4m (8n + 7). None of the first three examples
are divisible by a power of 4, so we just check them mod 8. The first example is
even mod 8, the second example is 3 mod 8, so it can be written as a sum of three
squares. The third example is again even mod 8, and so it also can be written as
a sum of three squares. The fourth example is 45 · 35 · 52 · 7 · 11, where 35 · 52 · 7 · 11
is 7 mod 8, so it cannot be written as a sum of three squares. The last example
can always be written as p2 + 12 + 12 .
All of these can be written as a sum of four squares, since all integers can be.
7
19. Suppose x ∈ Z>0 can be written as a sum of two squares. What is the necessary and
sufficient condition on y ∈ Z>0 for xy to be expressible as a sum of two squares?
SOLUTION: The necessary and sufficient condition is that y is a sum of two squares.
It is sufficient because the product of two integers that are sums of two squares is also
a sum of two squares. To see that it is necessary, suppose y cannot be written as a
sum of two squares, but x can. FIrst of all, this means that there is a prime that is 3
mod 4 and such that the highest power of p dividing y is an odd power. Second of all,
whenever p is such a prime, the highest power of p dividing x is even (maybe 0). So
the highest power of p dividing xy is odd, and so xy cannot be written as a sum of two
squares.
20. Show that the area of any right triangle with all integer sides is divisible by 6.
SOLUTION: Given the parametrization of primitive Pythagorean triples (x, y, z), we
have that
x = m2 − n2 , y = 2mn, z = m+ n2
for some integers m, n which are relatively prime, and such that exactly one of them is
even. Since one of them is even, y is divisible by 4. Suppose m is even, n is odd, and
neither is divisible by 3. Then both m2 and n2 have to be 1 mod 3, and so x is divisible
by 3, and the area, xy/2, is divisible by 12/2 = 6. If one of m, n is divisible by 3, then
y is divisible by 12 and so the area is divisible by 6.
8