0% found this document useful (0 votes)
74 views178 pages

Notes and Problems in Number Theory Volu

This document is the preface and table of contents for Volume II of 'Notes and Problems in Number Theory' by Taha Sochi. It emphasizes the importance of the previous volume, introduces new topics, and focuses on developing essential skills for solving number theory problems, including cryptography and computing. The book is designed for both instructional and general reading purposes, encouraging readers to engage with the problems before consulting the solutions.

Uploaded by

kendrariawan62
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views178 pages

Notes and Problems in Number Theory Volu

This document is the preface and table of contents for Volume II of 'Notes and Problems in Number Theory' by Taha Sochi. It emphasizes the importance of the previous volume, introduces new topics, and focuses on developing essential skills for solving number theory problems, including cryptography and computing. The book is designed for both instructional and general reading purposes, encouraging readers to engage with the problems before consulting the solutions.

Uploaded by

kendrariawan62
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 178

Notes and Problems

in Number Theory
Volume II
p
p6 | a lcm (p − 1)! + 1 = 0
(k) k
φ φ
pkak

nn m = 1
n
m = p a1 p a2 · · ·

p−1 p
=
2

τ (n) =
a 1
1

∏ik=1 (a c
i + 1) =
b y

gc d σ ax
+
µ
(dn . . . d2 d1 d0 )b

Taha Sochi
Preface
This is the second volume of my book “Notes and Problems in Number Theory”. It is important to note
the following points (which are largely about this volume):
• We take all the results and materials in the previous volume of this book for granted. Therefore, the
reader should consult the previous volume when necessary. For this purpose (and to help the reader) we
refer frequently to the previous volume.
• We focus in this volume on the type of problems that develop the basic and most essential skills which
are required for dealing with number theory problems.
• We introduced some new topics in the first chapter (i.e. Introduction), while the remaining chapters
are largely dedicated to solved problems from the main topics of elementary number theory (which are
introduced in V1 or in the Introduction chapter of the present volume). We also introduced the subject
of cryptography and computing in number theory in the last two chapters. So in brief, the materials in
this volume are largely a mix of applications to the materials of V1 and some theoretical background of
new topics as well as applications to the new topics. This is to ensure the continuity and graduality and
reduce the gradient of the learning curve.
• For the sake of originality, we deliberately reduced the amount of solved problems which have been
previously investigated by others (especially the widely circulating problems) to the bare minimum. In
fact, even when we investigate problems of this type we mostly follow novel or improved approach or/and
presentation.
• As in my previous books, my topmost priority in the structure and presentation is clarity and graduality
so that the readers have the best chance of understanding the content with minimum effort and with
maximum enjoyment. For this purpose (as well as for other obvious purposes) the book is full of cross
references (which are hyperlinked in the electronic versions although the hyperlinks are not highlighted
with color or other marking techniques to avoid distortion and ugliness). As indicated earlier, we also
refer frequently to the previous volume.
• The readers who want to benefit maximally from this book should try solving the Problems in this book
before reading their solutions. They should resist the temptation to read the solutions immediately or
just after a few attempts. Mathematical knowledge and skill cannot be acquired by just reading without
practice.
• As indicated, the last chapter of the present volume is dedicated to computing in number theory and
hence computer codes (in C++ language) represent the main part of the solutions of the Problems of the
last chapter. These codes are available from my webpage on ResearchGate. We recommend inspecting
these codes carefully and trying to figure out the algorithms behind them. These codes (as well as the
algorithms behind them) are mostly very simple and hence they do not require specialized knowledge
in computing or in C++. However, they can be very useful in acquiring the essential knowledge and
developing the basic skills in dealing with essential topics in number theory by computational methods
and tools.
• The book can be used as a text or as a reference for an introductory course on number theory and
may also be used for general reading in mathematics (especially by those who have the hobby of problem
solving). The book may also be adopted as a source of pedagogical materials which can supplement, for
instance, tutorial sessions (e.g. in undergraduate courses on mathematics or computing or cryptography
or related subjects).
Taha Sochi
London, May 2024

1
Contents
Preface 1

Table of Contents 2

Nomenclature 4

1 Introduction 6
1.1 Continued Fractions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2 Pell’s Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.3 The Order of Integer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.4 Primitive Root . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.5 The Index of Integer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.6 Quadratic Residue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.7 The Quadratic Congruence Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.8 Legendre’s Symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.9 Euler’s Criterion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
1.10 Quadratic Reciprocity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
1.11 Jacobi’s Symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
1.12 Mobius Inversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

2 Miscellaneous 39

3 Primes, Composites and Coprimes 44

4 Representation of Numbers 50

5 Diophantine Equations 55
5.1 General Issues about Diophantine Equations . . . . . . . . . . . . . . . . . . . . . . . . . . 55
5.2 Polynomial Diophantine Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
5.3 Exponential Diophantine Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
5.4 Mixed Polynomial-Exponential Diophantine Equations . . . . . . . . . . . . . . . . . . . . 73
5.5 Diophantine Equations Involving Roots . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
5.6 Diophantine Equations Involving Fractions . . . . . . . . . . . . . . . . . . . . . . . . . . 78
5.7 Diophantine Equations Involving Roots and Fractions . . . . . . . . . . . . . . . . . . . . 81
5.8 Diophantine Equations Involving Factorials . . . . . . . . . . . . . . . . . . . . . . . . . . 82
5.9 Trigonometric Diophantine Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

6 Diophantine Systems 85
6.1 General Issues about Diophantine Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
6.2 Systems of Diophantine Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
6.3 Solving Systems of Diophantine Equations Graphically . . . . . . . . . . . . . . . . . . . . 91
6.4 Final Thought about how to Solve Diophantine Problems . . . . . . . . . . . . . . . . . . 93

7 Inequalities 96
7.1 General Issues about Inequalities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
7.2 Univariate Inequalities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
7.3 Multivariate Inequalities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

2
8 Congruence Equations 101
8.1 General Issues about Congruence Equations . . . . . . . . . . . . . . . . . . . . . . . . . . 101
8.2 Univariate Congruence Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
8.3 Multivariate Congruence Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109

9 Congruence Systems 112


9.1 General Issues about Congruence Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
9.2 Univariate Congruence Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
9.2.1 Single Modulo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
9.2.2 Multiple Moduli . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
9.3 Multivariate Congruence Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
9.3.1 Single Modulo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
9.3.2 Multiple Moduli . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

10 Common Functions 124

11 Interesting Theorems 130


11.1 Wilson’s Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
11.2 Euler’s Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
11.3 Fermat’s Little Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
11.4 Lagrange’s Polynomial Roots Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
11.5 Other Theorems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

12 Floors and Ceilings 135

13 GCD and LCM 140

14 Last Digits 145

15 Divisibility 149

16 Sequences and Series 159

17 Cryptography 167

18 Number Theory and Computing 171


18.1 Simple Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
18.2 The Chinese Remainder Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
18.3 Congruence Equations and Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172

Index 174

3
Nomenclature
In the following list, we define the common symbols, notations and abbreviations which are used in the
book as a quick reference for the reader.
∀ for all
×, · multiplication sign
{· · · } set
! factorial
∈ in (or belong to)
∋ (backward) in (or belong to)

/ not in
[A; B] continued fraction symbol
⌊a⌋ floor function (the greatest integer less than or equal to a)
⌈a⌉ ceiling function (the smallest integer greater than or equal to a)
|a| absolute value of a
a negation of a
C the set of complex numbers
n
Cm binomial coefficient (number of combinations of m in n with no repetition)
Cnn1 ,n2 ,...,nk multinomial coefficient
E the set of even numbers
Eq., Eqs. Equation, Equations
Fk Fermat number (i.e. k th Fermat number where k = 0, 1, . . .)
gcd(m, n) greatest common divisor of m and n
iff if and only if
Ik,r n index of integer n relative to primitive root r (modulo k)
lcm(m, n) least common multiple of m and n
LHS, RHS left hand side, right hand side
m|n m divides n
m6 | n m does not divide n
m↑n tetration of m to n
(m)n the number m in base n
k
m=n m and n are congruent modulo k
k
m 6= n m and n are not congruent modulo k
m, n, k, . . . integers
m∗ modular multiplicative inverse of m
m∗k modular multiplicative inverse of m modulo k
max(a, b) the maximum of a and b
min(a, b) the minimum of a and b
mod modulo (or modulus)
Mp Mersenne prime
b
n factorial power of n
N the set of natural numbers (i.e. 1, 2, 3, . . .)
N0 the set of non-negative integers (i.e. 0, 1, 2, 3, . . .)
n

Jacobi’s symbol
 N
n
p Legendre’s symbol

4
O the set of odd numbers
Ok n the order of integer n (modulo k)
p prime number
P the set of prime numbers
Pe even perfect number
n
Pm number of permutations of m in n (with no repetition)
Q the set of rational numbers
r, r1 , r2 , r3 position vectors (in 3D space)
R the set of real numbers
s(n) the restricted divisor function
Sc complete residue system
Sr reduced residue system
Srk reduced residue system modulo k
Un the n-digit repunit number
V1 volume 1 (of this book)
x, y, z variables (mostly integers)
Z the set of integers
∆ discriminant of quadratic polynomial
µ(n) the Mobius function
Π the product symbol (for repeated multiplication)
σ(n) the divisor function
Σ the summation symbol
τ (n) the tau function
φ(n) the totient (or phi or Euler) function

5
Chapter 1
Introduction
In this chapter we briefly investigate some new topics in number theory which we did not investigate (at
least sufficiently) in V1 and which are needed for our future investigations (in this and upcoming volumes).

1.1 Continued Fractions


In this section we define the continued fraction representation of a given positive real number and illustrate
the main technique used to obtain this representation and how it is employed to approximate numbers
as rational fractions (i.e. as ratios of integers). In brief, this is the representation of the number as a
sum of an integer part and a recursive fraction part. The latter part is a fraction ladder obtained by
recursively taking the reciprocal of the reciprocal of the fraction part in the previous step in the ladder.
However, various tricks and techniques are usually used some of which may obscure or not reflect this
pattern explicitly (noting that they are usually employed to obtain this representation in a more efficient
way or more neat form).
The best way to understand the continued fraction representation and √ the techniques used to obtain it is
to apply these techniques to specific numbers. So, let us do this now to 2 (noting that more illustrating
examples will follow). We have (by adding and subtracting 1):
√ √
2=1+ 2−1

So, the fraction part in the first step is ( 2 − 1). Now, if we take the reciprocal of the reciprocal of this
fraction part and repeat this in the next steps then we get the following:
√ √ 1 1 1 1
2 = 1+ 2−1=1+ =1+ √ =1+ √ =1+ √
1 2+1 2+1 2+ 2−1

2−1 2−1
1 1 1 1
= 1+ =1+ =1+ =1+
1 1 1 1
2+ 2+ √ 2+ √ 2+ √
1 2+1 2+1 2+ 2−1

2−1 2−1
1 1
= 1+ =1+
1 1
2+ 2+
1 1
2+ 2+
1 .
√ 2 + ..
2−1

1
As we see, this pattern of 1 + will repeat itself for ever and hence we can symbolize this
1
2+
.
2 + ..
succinctly as: √  
2 = 1; 2
where 1 represents the integer part while 2 represents the fractional part (noting that the bar indicates
that 2 is repeated infinitely).

6
1.1 Continued Fractions 7

√Regarding the use of continued fraction to approximate the number that is expressed in this form (i.e.
2 in this case), we can say that we can truncate the ladder of continued fraction at any step on the ladder
.
by ignoring the last fraction (i.e. . . ) at that step and hence we get a rational
√ fraction approximation to
the given number as illustrated in the following (using our example of 2):

√ 1 3
2≃1+= = 1.5
2 2
√ 1 2 7
2≃1+ = 1 + = = 1.4
1 5 5
2+
2
√ 1 1 5 17
2≃1+ =1+ =1+ = ≃ 1.42
1 2 + 52 12 12
2+
1
2+
2
It is obvious that we get better and better approximations as we go further down on this fraction
√ ladder
(as can be seen in the above example where we get persistently better approximations to 2 as we go
further down on the ladder). In other words, the successive rational fractions obtained from successive
stepping down on this ladder converge persistently towards the given number.
Finally, it is useful to take notice of the following remarks:
• Rational numbers are represented by finite (or terminating) continued fraction ladder, while irrational
numbers require infinitely long (or infinitely deep or non-terminating) continued fraction ladder.
• As indicated above, the continued fraction expression is symbolized by [A; B] where A is the integer
part (which is a single integer) while B is the (continued) fraction part which can be a single integer (e.g.
1.2 = [1; 5]) or a number of integers separated by commas (e.g. 1.23 = [1; 4, 2, 1, 7]) where these integers
are the successive integer parts in the ladder. Now, we have 3 main cases with regard to the fraction part
B:
Case 1: the given number is rational and hence B is a single integer like 1.2 = [1; 5] or B is a block of
finitely-many integers like 1.23 = [1; 4, 2, 1, 7].
Case 2: the given number is irrational and B is a single integer or a block of integers which
√ is repeated

cyclically. In this case we put a bar on the top of B to indicate this cyclic behavior, e.g. 2 = 1; 2 and
√  
3 = 1; 1, 2 .
Case 3: the given number is irrational and B is a block of integers with no cyclic pattern (within the
number of acquired steps or for ever). In this case the block of integers is trailed with an ellipsis (i.e.
three dots . . .), e.g. π = [3; 7, 15, 1, 292, . . .].
Problems

1. Obtain the continued fraction of 2 using this time the technique of substitution.
Solution: In the technique of substitution we obtain the fraction ladder by recursive substitution of the
first step in the ladder for each occurrence of the given number in this ladder (as will be demonstrated
in the following), that is:

√ √ 2−1 1
2=1+ 2−1=1+ √ =1+ √
2+1 1+ 2
√ 1
So, the first step of the ladder is 2 = 1 + √ . What we do next is to substitute this expression of
  1+ 2
√ 1 √
2 i.e. 1 + √ recursively for each occurrence of 2 in each successive step in the ladder, that
1+ 2
1.1 Continued Fractions 8

is:
√ 1 1 1
2=1+ √  = 1 + !=1+
1+ 2 1 1
1+ 1+ √ 2+ √
1+ 2 1+ 2
√ 1 1 1
2=1+ =1+ =1+
1 1 1
2+ √  2+ ! 2+
1+ 2 1 1
1+ 1+ √ 2+ √
1+ 2 1+ 2

1 √
As we see, this pattern of 1 + will repeat itself for ever (as seen previously) because 2=
1
2+
.
2 + ..
1 1
1+ √ (as seen above) and hence when we substitute the expression 1 + √ recursively for the
1+ 2 1+ 2
√ .
2 in the denominator we must always get 2 + . . .
2. Obtain the continued fraction form of the following numbers and hence get a number of successive
rational fraction approximations from these forms:
√ √
(a) 1.2. (b) 1.23. (c) 5. (d) 3. (e) π.
Solution:
(a) We have 1.2 = 6/5 and hence:
6 1
=1+
5 5
Hence, 1.2 = [1; 5]. The first “approximation” is 6/5 which is exact.
(b) We have 1.23 = 123/100 and hence:
123 23 1 1 1 1 1
= 1+ =1+ =1+ =1+ =1+ =1+
100 100 100 8 1 1 1
4+ 4+ 4+ 4+
23 23 23 7 1
2+ 2+
8 8 8
7
1 1 1 1
= 1+ =1+ =1+ =1+
1 1 1 1
4+ 4+ 4+ 4+
1 1 1 1
2+ 2+ 2+ 2+
1 1 1 1
1+ 1+ 1+ 1+
7 7 7+0 7
1
As we see, the fraction part of 7/1 is zero and hence this ladder is terminating (as expected since 1.23
is rational). Thus, 1.23 = [1; 4, 2, 1, 7]. The first 3 rational fraction approximations are:
1 1 1
1+ = 1.25 1+ ≃ 1.222 1+ ≃ 1.231
4 1 1
4+ 4+
2 1
2+
1
As we see, these approximations persistently converge towards 1.23.
1.1 Continued Fractions 9

(c) We have:

√ √ 1 1 1 1
5 = 2+ 5−2=2+ =2+ √ =2+ √ =2+
1 5+2 4+ 5−2 1
√ 4+
5−2 1

5−2
1 1 1
= 2+ =2+ =2+
1 1 1
4+ √ 4+ √ 4+
5+2 4+ 5−2 .
4 + ..
√  
As we see, this pattern of repetitive (or periodic) 4 should continue for ever. Hence, 5 = 2; 4 . The
first 3 rational fraction approximations are:
1 1 1
2+ = 2.25 2+ ≃ 2.235 2+ ≃ 2.236
4 1 1
4+ 4+
4 1
4+
4

As we see, these approximations persistently converge towards 5 ≃ 2.2361.
(d) We have:

√ √ 1 1 1 1
3 = 1+ 3−1=1+ =1+ √ √
=1+ =1+ √
1 3+1 2+ 3−1 3−1
√ 1+
3−1 2 2 2
1 1 1 1
= 1+ =1+ =1+ =1+
1 1 1 1
1+ 1+ √ 1+ √ 1+ √
2 2( 3 + 1) 3+1 2+ 3−1

3−1 2
1
= 1+
1
1+
1
2+
1

3−1
√  
This pattern of repeated (1, 2) should continue for ever. Hence, 3 = 1; 1, 2 . The first 3 rational
fraction approximations are:
1 1 1
1+ =2 1+ ≃ 1.667 1+ = 1.75
1 1 1
1+ 1+
2 1
2+
1

As we see, these approximations persistently converge towards 3 ≃ 1.7321.
(e) We have:

1 1 1 1
π = 3+π−3=3+ =3+ =3+ =3+
1 1 7.062513 . . . 7 + 0.062513 ...
π−3 0.141592 . . .
1.2 Pell’s Equation 10

1 1 1
= 3+ =3+ =3+
1 1 1
7+ 7+ 7+
1 15.996594 . . . 15 + 0.996594 ...
0.062513 . . .
1 1 1
= 3+ =3+ =3+
1 1 1
7+ 7+ 7+
1 1 1
15 + 15 + 15 +
1 1.003417231 1 + 0.003417231
0.996594 . . .
1 1
= 3+ =3+
1 1
7+ 7+
1 1
15 + 15 +
1 1
1+ 1+
1 .
292 + . .
0.003417231
Hence, π = [3; 7, 15, 1, 292, . . .]. The first 3 rational fraction approximations are:
1 1 1
3+ ≃ 3.142857143 3+ ≃ 3.141509434 3+ ≃ 3.14159292
7 1 1
7+ 7+
15 1
15 +
1
As we see, these approximations persistently converge towards π ≃ 3.141592654.

1.2 Pell’s Equation


In this section we introduce Pell’s equation and how it is solved.[1] Pell’s equation is a Diophantine
quadratic equation in two variables of the following form:

x2 − dy 2 = 1 (1)

where x and y are non-zero integers (also see footnote [3] ) and d is a positive non-square integer (noting
that if d is a square integer then the equation has no solution because the difference between two non-zero
squares cannot be 1). Pell’s equation has infinitely many solutions. The method for finding these solutions
is to find the fundamental solution (which is the minimal solution in N), i.e. x = x1 and y = y1 where
x1 is the least natural number that solves (with the corresponding y, i.e. y1 ) this equation.[2] All natural
solutions are then generated by the formula:
√  √ n
x n + y n d = x 1 + y1 d (n ∈ N) (2)

All other solutions are then obtained by sign alteration noting that x and y are squared and hence each
one can be negative as well as positive (i.e. we have 4 solutions for each natural solution).
It is important to note the following about Pell’s equation:
• The existence of solution[3] of Pell’s equation is guaranteed.
[1] This section is no more than an introduction to the subject of Pell’s equation and the methods of its solution. This subject
will be extended and elaborated gradually. √
[2] The fundamental solution (x , y ) may also be defined as the solution that minimizes x + y
1 1 1 1 d in comparison to any
other solution. It is noteworthy that the fundamental solution is unique (and hence there should be no difference).
[3] We mean by “solution” the “non-trivial” solution noting that the “trivial” solution (x, y) = (1, 0) always exists. This should

explain why we imposed the condition that x and y are non-zero integers (i.e. to make this statement substantial and
extra informative).
1.2 Pell’s Equation 11

• Based on what we said, obtaining a solution to Pell’s equation is essentially about (searching for and)
finding the fundamental solution (noting that all the rest is usually trivial). So, how to obtain the
fundamental solution? In simple cases we may find the fundamental solution by guess or by inspection,
e.g. by searching by computer for the lowest (combination of) x and y in N that solve the given Pell
equation. However, in more general circumstances (and more complicated cases) we may need a more
regular and systematic technical approach for this search. The commonly-used such approach is the one
based on the technique of continued fraction (noting that this approach √ generally works; see § 1.1). The
essence of this method is to use the continued fraction expansion of d where we try successive rational
fraction approximations on the continued fraction ladder until we find a solution to the given equation,
[4]
i.e. the first found solution in this successive stepping down on the ladder is the fundamental solution. √
th
This is based on the fact that if√ak /bk (k = 1, 2, . . .) is the k rational fraction approximation of d on
the continued fraction ladder of d then x1 = ak and y1 = bk for some k (i.e. the smallest k that satisfies
a2k − db2k = 1). So, to find (x1 , y1 ) we simply try a1 /b1 , a2 /b2 , . . . successively until we find the ak /bk
that solves the given Pell equation (and hence x1 = ak and y1 = bk ). This issue will be clarified further
(practically) in the following Problems.
• Pell’s equation is generalized to the form x2 − dy 2 = c where 0 6= 1 6= c ∈ Z.[5] However, we will not
investigate this issue in this volume (although we plan to investigate this, as well as other details about
Pell’s equation, more thoroughly in the future).
• General quadratic Diophantine equation in two variables may be transformed to Pell’s equation form
to be solved as a Pell equation (where the solution of the original equation is obtained by reversing
the transformation). Some examples of this transformation technique will be given in the following
Problems (as well as in the upcoming chapters; see for instance Problem 2 of § 5.2). However, it should be
noticed that the existence of solution to the transformed Pell equation does not guarantee the existence of
solution to the original equation (as will be seen in some of the upcoming Problems) because the reverse
transformation may not produce integer solutions (totally or partially).
• Considering what we have said, although Pell’s equation may seem very restrictive, it is possible (in
many cases of quadratic Diophantine equation in two variables) to transform the equation to a standard
Pell equation (by using algebraic manipulation and scaling) and hence solve it by the Pell’s equation
techniques (as will be shown in the future). Anyway, if it is not possible to transform it to a standard
Pell equation then it is usually possible to transform it to a generalized Pell equation and hence it may
become possible to solve it as a generalized Pell equation.[6]
• When tackling a Pell equation it is recommended to search for the fundamental solution by inspection
before trying sophisticated processes and techniques like continued fraction technique. For example,
a few-seconds inspection to the Pell equation x2 − 5y 2 = 1 should lead to the fundamental solution
(x1 , y1 ) = (9, 4) and hence to all other solutions using the aforementioned formulations and instructions.
Also, basic computational effort (e.g. through the use of a spreadsheet or a simple code) can be more
economic in the search for the fundamental solution.[7]
Problems
1. Put the following equations in a standard Pell equation form and determine if these equations have
solutions or not:
(a) 4x2 − 6y 2 + 12x + 108y − 478 = 0. (b) 9x2 − 325y 2 − 42x − 130y + 35 = 0.
Solution:
(a) We have:

[4] In fact, there are detailed rules about how to get the fundamental solution (and the other solutions). However, we do not
want to get involved in these details at this stage and level.
[5] We should note that whether 0 6= 1 6= c ∈ Z or N ∋ c > 1 seems to follow different conventions (noting that this may

affect the method of solution in some cases).


[6] We should take note (in both cases) of the aforementioned possibility of having no solution by the reverse transformation

(i.e. when the reverse transformation does not produce an integer solution).
[7] See the Pell.cpp code which is in the “Codes” directory (noting that this code is very simple and limited in applicability

since it is only for the purpose of demonstration and illustration).


1.2 Pell’s Equation 12

(4x2 + 12x) − (6y 2 − 108y) − 478 = 0 → (4x2 + 12x + 9) − (6y 2 − 108y) − 478 − 9 = 0 →
2 2 2 2
(2x + 3) − (6y − 108y) − 487 = 0 → (2x + 3) − (6y − 108y + 486) − 1 = 0 →
(2x + 3)2 − 6(y 2 − 18y + 81) − 1 = 0 → (2x + 3)2 − 6(y − 9)2 = 1
As we see, the last equation is in a standard Pell equation form, i.e. X 2 − 6Y 2 = 1 where X = 2x + 3
and Y = y − 9. Now, if we solve this Pell equation we can easily obtain the fundamental solution
(X, Y ) = (5, 2) as well as all other solutions such as (X, Y ) = (±5, ±2) (±49, ±20) and  (±485, ±198).
We can also see that the reverse transformation i.e. x = (X − 3)/2 and y = (Y + 9) produces integer
solutions to the original equation, e.g. (x, y) = (1, 11), (1, 7), (−4, 7), (−4, 11), (23, 29), (241, 207), etc.
(b) We have:
(9x2 − 42x) − (325y 2 + 130y) + 35 = 0 → (9x2 − 42x + 49) − (325y 2 + 130y) + 35 − 49 = 0 →
(3x − 7)2 − (325y 2 + 130y) − 14 = 0 → (3x − 7)2 − (325y 2 + 130y + 13) − 1 = 0 →
2 2 2 2
(3x − 7) − 13(25y + 10y + 1) = 1 → (3x − 7) − 13(5y + 1) = 1
As we see, the last equation is in a standard Pell equation form, i.e. X 2 − 13Y 2 = 1 where X = 3x − 7
and Y = 5y + 1. Now, if we solve this Pell equation we can easily obtain the fundamental solution
(X, Y ) = (649, 180) as well as all other solutions (asdescribed above). However, the original equation
has no solution because the reverse transformation i.e. x = (X + 7)/3 and y = (Y − 1)/5 does not
produce integer solutions.
2. Find the first 4 natural solutions of the following Pell equations:
(a) x2 − 2y 2 = 1. (b) x2 − 3y 2 = 1. (c) x2 − 17y 2 = 1. (d) x2 − 7y 2 = 1.
Solution:
(a) By inspection we can see that the fundamental solution is: (x1 , y1 ) = (3, 2). Hence, the first 4
natural solutions are (see Eq. 2):
(x1 , y1 ) = (3, 2) (x2 , y2 ) = (17, 12) (x3 , y3 ) = (99, 70) (x4 , y4 ) = (577, 408)
(b) By inspection we can see that the fundamental solution is: (x1 , y1 ) = (2, 1). Hence, the first 4 nat-
ural solutions are:
(x1 , y1 ) = (2, 1) (x2 , y2 ) = (7, 4) (x3 , y3 ) = (26, 15) (x4 , y4 ) = (97, 56)
√  
(c) We have 17 = 4; 8 . The first rational fraction approximation on the continued fraction ladder

of 17 is:
1 33
4+ =
8 8
Now, 332 − 17 × 82 = 1 and thus (x1 , y1 ) = (33, 8). Hence, the first 4 natural solutions are:
(x1 , y1 ) = (33, 8) (x2 , y2 ) = (2177, 528) (x3 , y3 ) = (143649, 34840) (x4 , y4 ) = (9478657, 2298912)
√  
(d) We have 7 = 2; 1, 1, 1, 4 . The first 4 rational fraction approximations on the continued fraction

ladder of 7 are:[8]
3 5 8 37
[2; 1] = [2; 1, 1] = [2; 1, 1, 1] = [2; 1, 1, 1, 4] =
1 2 3 14
The first approximation that satisfies the given equation is the third (since 82 − 7 × 32 = 1) and thus
(x1 , y1 ) = (8, 3). Hence, the first 4 natural solutions are:
(x1 , y1 ) = (8, 3) (x2 , y2 ) = (127, 48) (x3 , y3 ) = (2024, 765) (x4 , y4 ) = (32257, 12192)
2
3. Show that there are infinitely many triangular numbers (i.e. numbers of the form n 2+n where n ∈ N)
which are perfect squares.
2
Solution: For a triangular number to be a perfect square we must have n 2+n = m2 where m ∈ N), i.e.


use [2; 1] to represent 2 + 11 (i.e. the first rational fraction approximation on the continued fraction ladder of
[8] We 7).
The similar symbols (such as [2; 1, 1]) have similar interpretation.
1.3 The Order of Integer 13

n2 + n − 2m2 = 0. This is a quadratic equation in n and hence it has a solution if its discriminant ∆
is a perfect square, i.e.

∆ = 12 − 4(−2m2 ) = k 2 → k 2 − 8m2 = 1 (k ∈ N)

As we see, the latter equation is a Pell equation and hence it has infinitely many solutions, e.g. (k, m) =
(3, 1), (17, 6), (99, 35), (577, 204) corresponding to n = 1, 8, 49, 288 (and hence to triangular square
numbers 1, 36, 1225, 41616). Accordingly, there are infinitely many triangular numbers which are
perfect squares.

1.3 The Order of Integer


k
The order of an integer n (modulo k) is the least positive integer m such that nm = 1 (where n and k are
coprime).[9] We symbolize this by writing: Ok n = m. For example:
3
• 21,2,3,4,... = 2, 1, 2, 1, . . . and hence the order of 2 (modulo 3) is 2, i.e. O3 2 = 2.
9
• 51,2,3,4,5,6,7,... = 5, 7, 8, 4, 2, 1, 5, . . . and hence the order of 5 (modulo 9) is 6, i.e. O9 5 = 6.
17
• 71,2,3,...,16,17,... = 7, 15, 3, . . . , 1, 7, . . . and hence the order of 7 (modulo 17) is 16, i.e. O17 7 = 16.
It is important to note the following points about the order of an integer:
k
1. nb = 1 iff Ok n|b ((where n and k are coprime and b ∈ N0 ).
k O n
2. na = nb iff a =
k
b (where n and k are coprime and a, b ∈ N0 ).
Problems
k
1. Show that nb = 1 iff Ok n|b (where n and k are coprime and b ∈ N0 ).
Solution: Regarding the if part, if Ok n|b then b = aOk n (for some a ∈ N0 ) and hence:
a k
nb = naOk n = nOk n = 1a = 1

k
Regarding the only if part, if nb = 1 where Ok n6 | b then b = aOk n + r where a ∈ N0 and 0 < r < Ok n.
Therefore, we must have:
k a k
1 = nb = naOk n+r = nOk n × nr = 1a × nr = nr

k
i.e. nr = 1 which is a contradiction because 0 < r < Ok n while Ok n is supposed to be the least positive
k
integer such that nOk n = 1.
k Ok n
2. Show that na = nb iff a = b (where n and k are coprime and a, b ∈ N0 ).
Solution: Let us assume (with no loss of generality) that a ≥ b.
O n
k
Regarding the if part, if a = b then a = sOk n + b (for some s ∈ N0 ) and hence:
s k
na = nsOk n+b = nOk n × nb = 1s × nb = nb

k
Regarding the only if part, if na = nb then we have:
k k k
na = nb → na−b nb = nb → na−b = 1
where canceling nb in the last step is because nb and k are coprime since n and k are coprime (see part
n of Problem 1 of 2.2 of V1, as well as point 7 in the preamble of § 2.7 of V1). Now, from Problem 1
k O n
we conclude that Ok n|(a − b), i.e. a = b.

[9] The“order of an integer” is actually the multiplicative order (which should remind those with knowledge of group theory
of the order in the multiplicative group). However, for simplicity (and because we have no rival or competitor so far on
this terminology) we label this as the “order of an integer”.
1.3 The Order of Integer 14

3. Show that Ok n|φ(k) (where n and k are coprime).


k
Solution: According to Euler’s theorem we have nφ(k) = 1. Hence, from Problem 1 we conclude that
Ok n|φ(k).
4. Show that if Ok n = a then Ok nb = a/g where b ∈ N and g = gcd(a, b).
Solution: Let c ≡ Ok nb . We have a = gα and b = gβ (noting that α and β are coprime) and hence:
α a/g a β k
nb = ngβ = nβ = (na ) = 1β = 1

where step 4 is because a = Ok n. So, from Problem 1 we have Ok nb |α, i.e. c|α.
c k
Also, from the definition of Ok nb we have: nb = nbc = 1 and hence from Problem 1 we have a|(bc),
i.e. (gα)|(gβc) or α|(βc). Now, since α and β are coprime then α|c.
So, c|α and α|c and hence c = α (noting that c and α are positive), that is:
a
O k nb ≡ c = α =
g
Note: based on this proposition we have:
O11 5 5 5 O7 9 3 3
O11 57 = = = =5 O7 96 = = = =1
gcd (O11 5, 7) gcd (5, 7) 1 gcd (O7 9, 6) gcd (3, 6) 3

5. Show that if Ok n = ab then Ok nb = a.


Solution: From Problem 4 we have:
Ok n ab ab
O k nb = = = =a
gcd (Ok n, b) gcd (ab, b) b gcd (a, 1)
p
6. Show that if Op n = 2b then nb = −1 (where p is an odd prime).
Solution: According to Problem 5 (noting that we have Op n = 2b), Op nb = 2. This means that
2 p p p
nb = 1 whose solutions are nb = ±1. However, since Op nb = 2 then we must have nb = −1.
7. Find the following:
(a) O1775 13. (b) O23156 41.
Solution:
(a) According to Problem 3, O1775 13|φ(1775). Now, φ(1775) = 1400 whose divisors are 1, 2, 4, 5, 7, 8,
10, 14, 20, 25, 28, 35, 40, 50, 56, 70, 100, 140, 175, 200, 280, 350, 700, 1400. On trying these divisors
(in their increasing order) we find that 140 is the first integer t in this list (according to the increasing
1775
order) that makes 13t = 1. Hence, O1775 13 = 140.
(b) According to Problem 3, O23156 41|φ(23156). Now, φ(23156) = 9912 whose divisors are 1, 2, 3, 4,
6, 7, 8, 12, 14, 21, 24, 28, 42, 56, 59, 84, 118, 168, 177, 236, 354, 413, 472, 708, 826, 1239, 1416, 1652,
2478, 3304, 4956, 9912. On trying these divisors (in their increasing order) we find that 826 is the first
23156
integer t in this list (according to the increasing order) that makes 41t = 1. Hence, O23156 41 = 826.
8. Find an integer x such that:
(a) O13 x5 = 4. (b) O9 14x = 6.
Solution: We use the proposition of Problem 4.
(a) For example, x = 5 should do because:
O13 x O13 5 4 4
O13 x5 = = = = =4
gcd (O13 x, 5) gcd (O13 5, 5) gcd (4, 5) 1

(b) Any x that is coprime to 6 should do because:


O9 14 6 6
O9 14x = = = =6
gcd (O9 14, x) gcd (6, x) 1
1.4 Primitive Root 15

9. Show that Ok n = Ok n∗ where n∗ is the modular multiplicative inverse of n modulo k (assuming n has
a modular inverse).
Solution: If ρ ≡ Ok n then we have:
k k
1 = 1ρ = (nn∗ )ρ = nρ (n∗ )ρ = 1 × (n∗ )ρ = (n∗ )ρ

Hence, from Problem 1 we get Ok n∗ |ρ and hence Ok n∗ ≤ ρ, i.e. Ok n∗ ≤ Ok n. Now, noting that
modular multiplicative inversion is a symmetric relation (see point 5 in the preamble of § 2.7.1 of V1)
we must also have Ok n ≤ Ok n∗ . Hence, Ok n = Ok n∗ .
10. Let n1 , n2 be integers which are coprime to k ∈ N. Show that Ok (n1 n2 ) (Ok n1 × Ok n2 ). Moreover, if
Ok n1 and Ok n2 are relatively prime then Ok (n1 n2 ) = Ok n1 × Ok n2 .
Solution: Let a ≡ Ok n1 , b ≡ Ok n2 and c ≡ Ok (n1 n2 ). Now:

b a k
(n1 n2 )ab = nab ab a
1 n2 = (n1 ) nb2 = 1b 1a = 1

Hence, from Problem 1 we get c|(ab), i.e. Ok (n1 n2 ) (Ok n1 × Ok n2 ).


Now, let assume that Ok n1 and Ok n2 are relatively prime. We have:
k k a c
1 = (n1 n2 )c = nc1 nc2 → 1a = (nc1 nc2 ) = (na1 ) nac
2 = n2
ac

Hence, from Problem 1 we get b|(ac) and thus b|c (noting that we are assuming now that a and b are
relatively prime).
We can similarly show that a|c (noting that this can also be deduced from the symmetry).
Now, since a|c and b|c then (ab)|c because a and b are relatively prime (see point 20 in the preamble of
§ 1.9 of V1).
So in brief, c|(ab) and (ab)|c and hence c = ab (noting that a, b, c > 0), i.e. if Ok n1 and Ok n2 are
relatively prime then Ok (n1 n2 ) = Ok n1 × Ok n2 .
11. Show that if Ok n = (k − 1) then k is prime (where N ∋ k > 1).
Solution: According to Problem 3 we have (k − 1)|φ(k) which implies (k − 1) ≤ φ(k). However, for all
k > 1 we have φ(k) ≤ (k − 1) (see point 7 in the preamble of § 2.6.4 of V1). Hence, φ(k) = (k − 1), i.e.
k is prime (see Problem 7 of § 10).

1.4 Primitive Root


An integer r is called a primitive root (modulo k) if every integer n coprime to k is congruent (modulo
k
k) to a natural power of r. In mathematical terms, this means n = rs for some s ∈ N with n and k being
coprime. For example:
7
• 3 and 5 are primitive roots (modulo 7) because the numbers coprime to 7 are n = 1, 2, 3, 4, 5, 6 and we
have:
7 7 7 7 7 7
36 = 1 32 = 2 31 = 3 34 = 4 35 = 5 33 = 6
7 7 7 7 7 7
56 = 1 54 = 2 55 = 3 52 = 4 51 = 5 53 = 6
but 1, 2, 4, 6 are not primitive roots (modulo 7) because (for instance):
7 7 7 7
1s 6= 2 2s 6= 3 4s 6= 3 6s 6= 2
for any s.
8
• 8 has no primitive root because the numbers coprime to 8 are n = 1, 3, 5, 7 and we have (for instance):
8 8 8 8
1s 6= 3 3s 6= 5 5s 6= 3 7s 6= 3
for any s.
It is important to note the following points about primitive roots:
1. We may also define primitive root (modulo k) as an element in a reduced residue system (modulo k)
whose natural powers generate all the elements in the system. It is worth noting that Srk (i.e. reduced
1.4 Primitive Root 16

residue system modulo k) is a group under modular multiplication (modulo k). So, primitive root is an
element in Srk whose order (or period; see § 1.3) is φ(k) and hence the sequence of its natural powers
generates all the elements in Srk . So, we can say: ρ ∈ Srk is a primitive root iff the order of ρ is equal
to φ(k), i.e. Ok ρ = φ(k).[10]
2. Based on what have been said, when k has a primitive root (say ρ) then Srk can be written as:
Srk = {ρ1 , ρ2 , . . . , ρφ(k) }.[11] Accordingly, multiplication of two elements of Srk in modulo k will
become addition of their indices in modulo φ(k).
3. As seen above, some (modular) integers (like 8) have no primitive root. In brief, only the following
(modular) integers have primitive roots: 2, 4, pa and 2pa (where p is an odd prime and a ∈ N). This
issue will be investigated further in the future.
4. Referring to the proposition of Problem 4 of § 1.3 (as well as point 1 above), if ρ is a primitive root
(modulo k) then we have:
Ok ρ φ(k)
O k ρb = =  
gcd (Ok ρ, b) gcd φ(k), b
 
This means that ρb is a primitive root (modulo k) iff gcd φ(k), b = 1.
5. Every prime has at least one primitive root.
Problems
1. Referring to point 1 in the preamble, find the order of all the elements of Sr12 (i.e. the reduced residue
system modulo 12) and hence determine the primitive roots of 12.
Solution: Sr12 = {1, 5, 7, 11} and hence φ(12) = 4. We have:
12
• 11,2,... = 1, 1, . . . and hence the order of 1 is 1.
12
• 51,2,... = 5, 1, . . . and hence the order of 5 is 2.
12
• 71,2,... = 7, 1, . . . and hence the order of 7 is 2.
12
• 111,2,... = 11, 1, . . . and hence the order of 11 is 2.
Therefore, 12 has no primitive root.
2. Repeat Problem 1 for Sr9 .
Solution: Sr9 = {1, 2, 4, 5, 7, 8} and hence φ(9) = 6. We have:
9
• 11,2,... = 1, 1, . . . and hence the order of 1 is 1.
9
• 21,2,3,4,5,6,... = 2, 4, 8, 7, 5, 1, . . . and hence the order of 2 is 6.
9
• 41,2,3,... = 4, 7, 1, . . . and hence the order of 4 is 3.
9
• 51,2,3,4,5,6,... = 5, 7, 8, 4, 2, 1, . . . and hence the order of 5 is 6.
9
• 71,2,3,... = 7, 4, 1, . . . and hence the order of 7 is 3.
9
• 81,2,... = 8, 1, . . . and hence the order of 8 is 2.
Therefore, the primitive roots of 9 are 2 and 5.
3. Repeat Problem 1 for Sr5 .
Solution: Sr5 = {1, 2, 3, 4} and hence φ(5) = 4. We have:
5
• 11,2,... = 1, 1, . . . and hence the order of 1 is 1.
5
• 21,2,3,4,... = 2, 4, 3, 1, . . . and hence the order of 2 is 4.
5
• 31,2,3,4,... = 3, 4, 2, 1, . . . and hence the order of 3 is 4.
5
• 41,2,... = 4, 1, . . . and hence the order of 4 is 2.
Therefore, the primitive roots of 5 are 2 and 3.
p
4. Show that if r is a primitive root of p (where p is an odd prime) then r(p−1)/2 = −1.
Solution: From Fermat’s little theorem we have:
p p p
rp−1 = 1 → rp−1 − 1 = 0 → (r(p−1)/2 − 1)(r(p−1)/2 + 1) = 0
[10] Morerigorously and generally, Ok n = φ(k) iff n is a primitive root modulo k (where n and k are coprime). In fact, this
may be used as a definition for “primitive root”.
[11] It k
is useful to note that ρφ(k) = 1 according to Euler’s theorem (which can be regarded, in this context, as a definition
of primitive root taking into account other related concepts and definitions as well as the restriction on the order of ρ).
1.4 Primitive Root 17

p
where the factorization in the last step is because (p − 1) is even. Now, r(p−1)/2 − 1 6= 0 because r is
p p
supposedly a primitive root (noting that r(p−1)/2 − 1 = 0 which implies r(p−1)/2 = 1 means that the
p
order of r is less than p − 1 in contradiction to being a primitive root). Hence, r(p−1)/2 + 1 = 0, i.e.
p
r(p−1)/2 = −1.  
5. Show that if k has a primitive root then it must have φ φ(k) distinct primitive roots.
Solution: {ρ1 , ρ2 , . . . , ρφ(k) } is a reduced residue system (modulo k) when ρ is a primitive root of k
(see points 1 and 2 in the preamble). So, when we say “k has a primitive  root” we are assuming that we
have an element ρ in the reduced residue system whose powers i.e. ρ1 , ρ2 , . . . , ρφ(k) generate all the
elements in this system. Accordingly,  any primitive root of k (i.e. any element that generates the entire
system) must be among these ρi i = 1, 2, . . . , φ(k) because these ρi represent  the entire system. Now,
from point 4 in the preamble ρb is a primitive  root (modulo
 k) iff gcd φ(k), b = 1, i.e.  and b are
 φ(k)
coprime. The number of positive integers b ≤ φ(k) which are coprime to φ(k) is φ φ(k) and hence
   
the number of primitive roots among these distinct elements i.e. ρ1 , ρ2 , . . . , ρφ(k) must be φ φ(k) .
Note: referring to Problems 2 and 3, we have:
       
φ φ(9) = φ 6 = 2 and φ φ(5) = φ 4 = 2
This should serve as a simple check that we did not make a gross mistake.
6. How many primitive roots the following numbers have:
(a) 113. (b) 254. (c) 311.
Solution: All these numbers have a primitive root (noting that 113 and 311 are primes while 254 is 2
timesa prime; seepoint  3 in the preamble) and hence we can use the proposition of Problem 5.
(a) φ φ(113)  = φ 112  = 48 and hence 113 has 48 primitive roots.
(b) φ φ(254) = φ 126 = 36 and hence 254 has 36 primitive roots.
(c) φ φ(311) = φ 310 = 120 and hence 311 has 120 primitive roots.
7. Show that the product of two distinct primitive roots (modulo an odd prime) is not a primitive root
(of that prime).
Solution: Let r and ρ be two distinct primitive roots modulo p (where p is an odd prime). Now, from
Problem 4 we have:
p p p
r(p−1)/2 = −1 and ρ(p−1)/2 = −1 → (rρ)(p−1)/2 = 1
Hence, rρ cannot be a primitive root of p because its order is less than p − 1.
8. Determine the number of primitive roots of all N ∋ k > 1.
Solution: Referring
  to point 3 in the preamble (as well as Problem 5):
• 2 has φφ(2) = φ1 = 1 primitive root (which is 1).
• 4 has φ φ(4)
 a = φ 2  =a 1 primitive  root (which is 3).
• pa has φ φ(p
 ) =
 φ p  − p a−1
 primitive
 roots.

• 2pa has φ φ(2pa ) = φ φ(pa ) = φ pa − pa−1 primitive roots (see part a of Problem 13 of § 10).
• All other k have no primitive root.
9. Show that if r is a primitive root (modulo k) then its modular multiplicative inverse r∗ is also a primitive
root (modulo k).
Solution: According to Problem 9 of § 1.3, r and r∗ have the same order (modulo k) and hence if r is
a primitive root then r∗ must also be a primitive root.
10. Show that if r is a primitive root of k then −r is not necessarily a primitive root of k.
Solution: For example, r = 2 is a primitive root of k = 9 while r = −2 is not a primitive root of k = 9.
On the other hand, both r = 2 and r = −2 are primitive roots of k = 5.
11. Show that if r is a primitive root of a prime p = 4k + 1 (k ∈ N) then −r is also a primitive root of p.
Solution: We have:
p
(−r)p−1 = rp−1 = rφ(p) = 1
where the last step is from Euler’s theorem (noting that r is a primitive root of p and hence they
are coprime). So, from Problem 3 of § 1.3 we have Op (−r)|(p − 1), i.e. Op (−r) ≤ (p − 1). Now, if
Op (−r) < (p − 1) then we have two cases to consider:
1.4 Primitive Root 18

 
• Op (−r) is even say Op (−r) = 2a for some a ∈ N and hence:
p p
(−r)2a = 1 → r2a = 1
which means that the order of r is less than (p − 1) in contradiction to the presumption that r is a
primitive root.  
• Op (−r) is odd say Op (−r) = 2a − 1 for some a ∈ N and hence:
p p
(−r)2a−1 = 1 → r2(2a−1) = 1
So, from Problem 1 of § 1.3 we have:
     
Op r 2(2a − 1) → (p − 1)| 2(2a − 1) → (4k)| 2(2a − 1) → (2k)|(2a − 1)
However, this is impossible because 2k is even while (2a − 1) is odd (noting that no odd number is
divisible by an even number).
So, it is not possible to have Op (−r) < (p − 1) and hence we must have Op (−r) = (p − 1), i.e. −r is
also a primitive root of p.
12. Find all the primitive roots of the following moduli:
(a) 22. (b) 49. (c) 17932.
Solution:
(a) 22 = 2 × 11 and hence it shouldhave primitive roots (see point 3 in the preamble). The number of
these primitive roots is: φ 111 − 110 = φ(10) = 4 (see Problem 8). Now, if we test the natural numbers
> 1 which are coprime to 22 (i.e. 3, 5, 7, 9, 13, 15, 17, 19, 21) we will find out that only 7, 13, 17, 19 have
order (mod 22) of φ(22) = 10. Accordingly, 7, 13, 17, 19 are the primitive roots of 22.
(b) 49 = 72 and hence it should have primitive roots (see point 3 in the preamble). The number of
these primitive roots is: φ 72 − 71 = φ(42) = 12 (see Problem 8). Now, if we test the natural numbers
> 1 which are coprime to 49 we will find out that only 3, 5, 10, 12, 17, 24, 26, 33, 38, 40, 45, 47 have order
(mod 49) of φ(49) = 42. Accordingly, 3, 5, 10, 12, 17, 24, 26, 33, 38, 40, 45, 47 are the primitive roots of
49.
(c) 17932 = 22 × 4483 and hence it has no primitive root (see point 3 in the preamble).
13. Find all integers n such that O31 n = 5.
Solution: The smallest primitive root of modulo 31 is 3 and hence O31 3 = φ(31) = 30 (see point 1 in
the preamble). We also note that since 3 is a primitive root then any integer (coprime to 31) can be
31
expressed as 3a (mod 31) for some a ∈ {1, 2, . . . , 30}. So, let n = 3a and hence we are looking for all
values of a such that O31 3a = 5. Now, from Problem 4 of § 1.3 we have:
O31 3 30
O31 3a = =
gcd (O31 3, a) gcd (30, a)
So, to find all values of a such that O31 3a = 5 we need to find all values of a such that gcd (30, a) = 6.
Now, gcd (30, a) = 6 (among the integers a ∈ {1, 2, . . . , 30}) are 6, 12, 18, 24. Accordingly, O31 n = 5 for
31 31
36 , 312 , 318 , 324 = 16, 8, 4, 2. So, O31 n = 5 for all n = 2, 4, 8, 16.
14. Show that if p is a prime ≥ 5 then its primitive roots occur in incongruent pairs (r, r∗ ) where r∗ is the
modular multiplicative inverse of r (modulo p).
Solution: Based on the given assumptions we have:
p
• n = ±1 cannot be primitive roots of p (because their order is 1 and 2 while the order of a primitive
root must be p − 1 which is ≥ 4). Hence, any primitive root r must be in the range 1 < r < (p − 1)
(mod p).
• From part (f) of Problem 2 of § 2.7.1 of V1, the multiplicative inverse of any 1 < r < (p − 1) must be
p
incongruent to r (i.e. r 6= r∗ ).
• From part (h) of Problem 2 of § 2.7.1 of V1, each member of the set S = {1, 2, . . . , (p − 1)} must have
a multiplicative inverse in S (modulo p) noting that S contains an even number of elements.
• From Problem 9, the multiplicative inverse r∗ of any primitive root r is also a primitive root.
Accordingly, each primitive root (mod p) must have an incongruent multiplicative inverse which is also
a primitive root, i.e. the primitive roots of p occur in incongruent pairs (r, r∗ ).
1.5 The Index of Integer 19

Note: a simpler proof (though it may be less rigorous and illuminating) is to note that (where we use
Fermat’s little theorem):
p p 
rp−1 = 1 → ra rp−1−a = 1 a = 1, . . . , p−3
2
Now, ra and rp−1−a are obviously incongruent modular multiplicative inverses (within some of the above
conditions). So, if ra is a primitive root then (by Problem 9) rp−1−a is also a primitive root. Similarly,
if rp−1−a is a primitive root then ra is also a primitive root. Hence, primitive roots occur in incongruent
pairs.
15. Let p be a prime ≥ 5. Show that the product of all the primitive roots of p is congruent to 1 (mod p).
Solution: According to Problem 14, the primitive roots of p occur in incongruent pairs (r, r∗ ) where
r∗ is the modular multiplicative inverse of r. Now, the product of each pair is congruent to 1 (mod p),
p
i.e. rr∗ = 1. Hence, the product of all the primitive roots of p is congruent to 1 (mod p).

1.5 The Index of Integer


The index of an integer n (modulo k) relative to a primitive root r of k (where n and k are coprime) is
k
the least positive integer m such that n = rm . We symbolize this by writing: Ik,r n = m. For example:
7
• 3 is a primitive root (modulo 7) and 2 is the least positive integer such that 9 = 32 . Hence, I7,3 9 = 2.
11
• 2 is a primitive root (modulo 11) and 6 is the least positive integer such that 20 = 26 . Hence, I11,2 20 = 6.
It is important to note the following rules about the index of integer:
1. Ik,r r = 1.
2. Ik,r 1 = Ok r = φ(k).
φ(k)
3. Ik,r (ab) = Ik,r (a) + Ik,r (b) (where a and b are coprime to k).
φ(k)
4. Ik,r (ab ) = b Ik,r (a).
5. Ip,r (−1) = Ip,r (p − 1) = p−1
2 (where p is an odd prime).
These rules (which are similar to the rules of logarithms) can be exploited to solve congruence equations as
will be demonstrated in the following Problems. However, we should notice the limitation of this method
for solving congruence equations since it depends on the existence of a primitive root to the modulo k.
Problems
1. Solve the following congruence equations using the rules of indices:
53 49 17
(a) 8x9 = 17. (b) 6x25 = 22. (c) 9x4 = 32.
Solution:[12]  
(a) A primitive root of 53 is 2 and we have noting that φ(53) = 52 :
53  φ(53) 52
8x9 = 17 → I53,2 8x9 = I53,2 (17) → I53,2 (8) + 9I53,2 (x) = I53,2 (17) →
52 52 52 52 52
3 + 9I53,2 (x) = 10 → 9I53,2 (x) = 7 → I53,2 (x) = 9∗ × 7 = 29 × 7 = 47
52  φ(53)  53 53
So, I53,2 (x) = 47 i.e. I53,2 (x) = 47 which means x = 247 = 5. Hence, the solution of the given
53
congruence equation is x = 5.  
(b) A primitive root of 49 is 3 and we have noting that φ(49) = 42 :
49  φ(49) 42
6x25 = 22 → I49,3 6x25 = I49,3 (22). → I49,3 (6) + 25I49,3 (x) = I49,3 (22) →
42 42 42 42
27 + 25I49,3 (x) = 24 → 25I49,3 (x) = 39 → I49,3 (x) = 25∗ × 39 = 15
42  φ(49)  49 49
So, I49,3 (x) = 15 i.e. I49,3 (x) = 15 which means x = 315 = 41. Hence, the solution of the given
49
congruence equation is x = 41.

[12] The
 
IndexOfInt.cpp code (see Problem 1 of § 18.1) can be used to calculate the indices of integers e.g. I53,2 (17) in this
Problem.
1.6 Quadratic Residue 20

 
(c) A primitive root of 17 is 3 and we have noting that φ(17) = 16 :
17  φ(17) 16
9x4 = 32 → I17,3 9x4 = I17,3 (32). → I17,3 (9) + 4I17,3 (x) = I17,3 (32) →
16 16 4
2 + 4I17,3 (x) = 6 → 4I17,3 (x) = 4 → I17,3 (x) = 1
16  φ(17)  17 17
So, I17,3 (x) = 1, 5, 9, 13 i.e. I17,3 (x) = 1, 5, 9, 13 which means x = 31 , 35 , 39 , 313 = 3, 5, 14, 12.
17
Hence, the solutions of the given congruence equation are x = 3, 5, 12, 14.

1.6 Quadratic Residue


We say n ∈ Z is a quadratic residue (modulo k) if n and k are coprime and the congruence equation
k
x2 = n has a solution. If this congruence has no solution then n is a quadratic non-residue (mod k). For
3 3
example, 4 is a quadratic residue (mod 3) since x2 = 4 has a solution (e.g. x = 1), while 2 is a quadratic
3
non-residue (mod 3) because x2 = 2 has no solution.
It is important to note that some authors impose the condition of coprimality (i.e. n and k should
be coprime) while others do not. Also, some authors seem to restrict the definition of quadratic residue
to prime moduli (i.e. k ≡ p where p ∈ P) and hence the purpose of the condition of coprimality is to
exclude 0 (mod p) which makes the number of quadratic residues and quadratic non-residues equal (see
Problem 2). Anyway, these details (related to these differences in conventions) should not be important
as long as we are aware of them and as long as we take notice of them when reading to different authors
(with strong emphasis on keeping consistency and sensibility). Accordingly, in this book we may follow
one convention in one place and another convention in another place[13] and hence the reader should be
vigilant. However, we generally make the situation clear (either by explicit announcement or by obvious
contextual indications).
Problems
p
1. Prove that x2 = n has either exactly two (distinct modular) solutions or none (where n ∈ Z, p is an
odd prime and n and p are coprime).
Solution: We have three things to prove:
p p
• x2 = n can have no solution: this is obvious because we have many examples where x2 = n has no
3
solution, e.g. x2 = 2.
p
• If x2 = n has a solution then it has no more than two solutions: this is obvious from Lagrange’s
polynomial roots theorem (see § 2.9.4 of V1).
p p
• If x2 = n has a solution then it has exactly two (distinct modular) solutions: let x2 = n has a solution
p p
X and hence X 2 = n. Therefore, we must also have (−X)2 = n, i.e. −X is also a solution. So, all
p
we need to complete the proof is to show that X 6= −X. This should be obvious because otherwise
p p
X = −X, i.e. 2X = 0 which means that p|X (since p is an odd prime and hence p6 | 2). Now, if p|X then
p p
(from X 2 = n) we have n = 0, i.e. p|n which contradicts the assumption that n and p are coprime.
2. Prove that there are exactly (p − 1)/2 quadratic residues (mod p), and (p − 1)/2 quadratic non-
residues (mod p) where p is an odd prime. Moreover, the (p − 1)/2 quadratic residues (mod p) are:
2
12 , 22 , . . . , p−1
2 .
Solution: We have:
p p p
−1 = p − 1 −2 = p − 2 ··· − p−1
2 =p− 2
p−1

Now, if we square both sides of these congruences we get:


 2  2
p p p−1 p p−1
12 = (p − 1)2 22 = (p − 2)2 ··· = p− (3)
2 2

[13] This is for convenience and because each convention has an advantage in certain situations and contexts.
1.6 Quadratic Residue 21

Now, let us analyze this: n o



p−1 2
• Eq. 3 means that each integer in the set 12 , 22 , . . . , 2 is a quadratic residue (mod p) because
each of the congruences:
p p p 
p−1 2
x2 = 12 x2 = 22 ··· x2 = 2
p p p
has two (distinct modular) solutions, e.g. x2 = 12 has the solutions x = 1, (p − 1) while x2 = 22 has
p
the solutions x = 2, (p − 2).[14] 
• Eq. 3 shows  that we have no more than (p − 1)/2 quadratic residues since 12 is congruent to (p − 1)2
and so on where each one of these (p − 1)/2 quadratic residues corresponds to two distinct solutions
from the integers {1, 2, . . . , p − 1}.
p
• If we remember that all the (modular) solutions of the congruence x2 = n must belong to the set
{1, 2, . . . , p − 1} (noting that these are the only integers in mod p which are coprime to p) then we can
conclude that the number of possible (modular) solutions is no more than p − 1. Now, we already found
that all these numbers (i.e. 1, 2, . . . , p − 1) are solutions grouped in (p − 1)/2 pairs where the solutions
in each pair are distinct, i.e. (1, p − 1), (2, p − 2), . . . , p−1 p−1
2 ,p − 2 . So, if we prove that two distinct
p
integers (say n1 and n2 ) of the set {1, 2, . . . , (p−1)/2} must satisfy n21 6= n22 then we actually proved that
p
the congruence x2 = n has exactly (p − 1)/2 quadratic residues representing (p − 1) distinct solutions
 2 
i.e. the solutions that correspond to 12 , 22 , . . . , p−1
2 and hence it cannot have more solutions.
• So in brief, since all these (p − 1) distinct solutions correspond to these distinct (p − 1)/2 quadratic
 2  2
residues i.e. 12 , 22 , . . . , p−1
2 , then we conclude that the (modular) integers 12 , 22 , . . . , p−1
2 are
the quadratic residues (mod p) and all the remaining (p − 1)/2 (modular) integers are the quadratic
non-residues (mod p) since none of the remaining (modular) integers can be a quadratic  residue since
all the possible (p − 1) solutions are already taken by the (p − 1)/2 quadratic residues noting that the
remaining
 (modular) integers cannot have solutions among these (p − 1) solutions which are already
taken .
So to complete the proof we just need to show that when n1 and n2 of the set {1, 2, . . . , (p − 1)/2} are
p p
distinct then n21 6= n22 . Now, let assume (for the sake of argument) that n21 = n22 and hence:
p p  
n21 − n22 = 0 → (n1 − n2 )(n1 + n2 ) = 0 → p (n1 − n2 )(n1 + n2 )
 
Now, p6 | (n1 +n2 ) because 1 < (n1 +n2 ) < p noting that n1 and n2 belong to the set {1, 2, . . . , (p−1)/2} .
Also, p6 | (n1 − n2 ) because 0 < |n1 − n2 | < p (noting that n1 and n2 are supposedly distinct). This
p p
nonsensical result should lead to the conclusion that if n1 6= n2 then n21 6= n22 (and this should complete
the proof).
3. Find all the quadratic residues and quadratic non-residues of the following (modular) prime numbers:
(a) 7. (b) 11. (c) 17.
Solution: We refer the reader to Problem 2 for justification and explanation to the given solutions
(noting the consistency of these solutions with the proposition of Problem 2).[15]
(a) The quadratic residues of 7 are (noting that what is between parentheses are the solutions corre-
sponding to the given quadratic residue):
7 7 7 7 7 7
12 = 1 (x = 1, 6) 22 = 4 (x = 2, 5) 32 = 2 (x = 3, 4)
The quadratic non-residues of 7 are: 3, 5, 6.
(b) The quadratic residues of 11 are:
11 11 11 11 11 11 11 11 11 11
12 = 1 (x = 1, 10) 22 = 4 (x = 2, 9) 32 = 9 (x = 3, 8) 42 = 5 (x = 4, 7) 52 = 3 (x = 5, 6)

[14] We note that we use 12 , 22 to represent the integers which are congruent to 1, 4 (mod p), i.e. 1 + kp and 4 + kp. This
laxity is for the sake of simplicity and to avoid some complications in the presentation.
[15] In fact, the examples given in the present Problem (and the given solutions) should also clarify the proposition of Problem

2 and remove any ambiguity or confusion about the proof given in Problem 2. We advise the reader to inspect the pattern
in these solutions and take note of it as this should improve the understanding of Problem 2.
1.6 Quadratic Residue 22

The quadratic non-residues of 11 are: 2, 6, 7, 8, 10.


(c) The quadratic residues of 17 are:
17 17 17 17 17 17 17 17
12 = 1 (x = 1, 16) 22 = 4 (x = 2, 15) 32 = 9 (x = 3, 14) 42 = 16 (x = 4, 13)
17 17 17 17 17 17 17 17
52 = 8 (x = 5, 12) 62 = 2 (x = 6, 11) 72 = 15 (x = 7, 10) 82 = 13 (x = 8, 9)
The quadratic non-residues of 17 are: 3, 5, 6, 7, 10, 11, 12, 14.
4. Find all the quadratic residues and quadratic non-residues of the following (modular) composite num-
bers (ignoring the condition of coprimality which we stated and discussed in the preamble):
(a) 6. (b) 9. (c) 12.
Solution:
6 6 6 6
(a) The quadratic residues of 6 are: 0 (corresponding to x = 0), 1 (x = 1, 5), 3 (x = 3), 4 (x = 2, 4).
The quadratic non-residues of 6 are: 2, 5.
9 9 9 9
(b) The quadratic residues of 9 are: 0 (x = 0, 3, 6), 1 (x = 1, 8), 4 (x = 2, 7), 7 (x = 4, 5).
The quadratic non-residues of 9 are: 2, 3, 5, 6, 8.
12 12 12 12
(c) The quadratic residues of 12 are: 0 (x = 0, 6), 1 (x = 1, 5, 7, 11), 4 (x = 2, 4, 8, 10), 9 (x = 3, 9).
The quadratic non-residues of 12 are: 2, 3, 5, 6, 7, 8, 10, 11.
φ(k) k
5. Show that if n is a quadratic residue (modulo k > 2) then n 2 = 1.[16]
k
Solution: “n is a quadratic residue (modulo k)” means we have x ∈ Z such that x2 = n with n and k
being coprime (and hence x and k are coprime). So, from Euler’s theorem we have:

k [ φ(k)
2 ] k φ(k) k
xφ(k) = 1 → x2 =1 → n 2 =1

6. Show that a primitive root (modulo k > 2) cannot be a quadratic residue (modulo k).
Solution: This can be concluded from the proposition of Problem 5 because the order of a quadratic
φ(k) k
residue n (modulo k) is less than φ(k) since n 2 = 1, while the order of a primitive root (modulo k)
is φ(k) (see point 1 in the preamble of § 1.4).
k
We may also argue that if r is a primitive root (modulo k) then r = r1 . On the other hand, any
 k 
quadratic residue n must be an even power of r i.e. n = r2s = (rs )2 where s ∈ N so that the
k
congruence x2 = n can have a solution. Hence, a primitive root cannot be a quadratic residue.
Yes, there is one exception which is 1 (modulo 2) since 1 is a primitive root (mod 2) and 1 is a quadratic
residue (mod 2), and hence we imposed k > 2. Also see Problem 6 of § 1.9.
7. Let r be a primitive root of an odd prime p. Show that the quadratic residues (mod p) are the even
powers of r while the quadratic non-residues (mod p) are the odd powers of r.
Solution: Any x ∈ {1, 2, . . . .p − 1} should be equal (mod p) to rs for some s ∈ N. Now, if n is a
quadratic residue (mod p) then from Problem 2 we must have n = x2 = (rs )2 = r2s , i.e. n is an even
power of r. So, the quadratic non-residues must be the (remaining) odd powers of r (also see Problem
6).
8. Show that if r is a primitive root of an odd prime p then:
Y p 2 Y p 2
QR = r(p −1)/4 and QnR = r(p−1) /4
Q Q
where QR is the product of all quadratic residues (mod p) and QnR is the product of all quadratic
non-residues (mod p).
Solution: The quadratic residues are the even powers of r while the quadratic non-residues are the
odd powers of r (see Problem 7). Hence:
Y p P(p−1)/2 (p2 −1)/8 2
QR = r2 × r4 × · · · × r2(p−1)/2 = r2 k=1 k
= r2 = r(p −1)/4

φ(12) 12
[16] Itis worth noting that the converse of this statement is not true in general. For instance, 5 2 = 54/2 = 52 = 1 but 5
is not a quadratic residue (modulo 12).
1.7 The Quadratic Congruence Theorem 23

where we used the arithmetic series formula in step 3 (see Eq. 15 in V1).
Similarly: Y p P(p−1)/2 2
QnR = r1 × r3 × · · · × rp−2 = r k=1 (2k−1) = r(p−1) /4
Pn
where we used the formula k=1 (2k − 1) = n2 in step 3.

1.7 The Quadratic Congruence Theorem


According to this theorem (noting that n ∈ N, p ∈ P and n < p):
• If n is a quadratic residue (mod p) then p divides (p − 1)! + n(p−1)/2 .
• If n is a quadratic non-residue (mod p) then p divides (p − 1)! − n(p−1)/2 .
Problems
1. Prove the quadratic congruence theorem.
Solution: For p = 2 the theorem is obviously true, i.e. 1 is a quadratic residue (mod 2) and 2 divides
(2 − 1)! + 1(2−1)/2 = 2. So, in the following we assume p > 2. Considering the above two cases we have:
• Because n is a quadratic residue (mod p) then we have:
p (p−1)/2 p (p−1)/2 p
x2 = n → x2 =n → n(p−1)/2 = xp−1 →
p p p
n(p−1)/2 = 1 → n(p−1)/2 = −(p − 1)! → (p − 1)! + n(p−1)/2 = 0
where we used Fermat’s little theorem in step 3 (noting that x and p must be coprime since n and p
are coprime), and we used Wilson’s theorem in step 4.
• Regarding the case when n is a quadratic non-residue (mod p), we start by examining the following
linear congruence:
p
ax = n (4)
which by the LCE theorem (see § 3.2.1 of V1) must have a single modular solution[17] where this
p
solution belongs to the set {1, 2, . . . , p − 1}. Now, if c is a solution then we have ac = n and hence if the
p p
congruence x2 = n has no solution (i.e. n is a quadratic non-residue mod p) then a 6= c. Noting that
a and c belong to the set {1, 2, . . . , p − 1},[18] this set can be partitioned into (p − 1)/2 pairs (ai , ci )
 p 
i = 1, 2, . . . , (p − 1)/2 and ai 6= ci where Eq. 4 applies to each one of these pairs. Now, if we multiply
these (p − 1)/2 congruences side by side (see rule 10 in the preamble of § 2.7 of V1) then we get:
p p
(p − 1)! = n(p−1)/2 → (p − 1)! − n(p−1)/2 = 0

i.e. p divides (p − 1)! − n(p−1)/2 .

1.8 Legendre’s Symbol


Let n be an integer and p is an odd prime and n and p are coprime. The Legendre symbol is defined as:
  (
n +1 (n is a quadratic residue mod p)
= (5)
p −1 (n is a quadratic non-residue mod p)

Legendre’s symbol is defined to be zero if p|n. For example:


     
1 2 3
= +1 = −1 =0
3 3 3
It is important to note the following about Legendre’s symbol:
[17] In brief, n > 0 and hence a and p must be coprime, i.e. their gcd is 1 (which divides n) and hence the congruence has a
solution. Now, since the gcd of a and p is 1 then we must have a single solution (see Eq. 58 of V1 and the surrounding
text).
[18] It should be obvious that we are talking in modular arithmetic.
1.8 Legendre’s Symbol 24

    p
1. m p = np where m, n ∈ Z and p is an odd prime with n and p being coprime and m = n.
2. If p is an odd prime then:  
−1
= (−1)(p−1)/2 (6)
p
3. If p is an odd prime then:
  ( 8
2 (p2 −1)/8 +1 (p = ±1)
= (−1) = 8 (7)
p −1 (p = ±3)

4. Legendre’s symbol is a totally multiplicative function,[19] that is:


    
mn m n
= (8)
p p p

where p is an odd prime.


5. If p is an odd prime then:
   2
n2 n
= (9)
p p
6. The separation of the zero case in the above definition of Legendre’s symbol means that when we talk
about Legendre’s symbol then we assume (by default) that n and p are coprime, and hence the zero
case is considered or included only if it is mentioned or indicated explicitly.
Problems
1. Prove property 1 above.
p
Solution: Since n and p are coprime then m and p must also be coprime (because otherwise m = 0
p p p
which contradicts m = n noting that n 6= 0 since n and p are coprime). Moreover, since m = n then m
and n must
 be both
 quadratic residues (mod p) or both quadratic non-residues (mod p) which means
that m p = np .
2. Prove property 5 above.
Solution: This is an instance of property 4 (which will be proved in Problem 4 of § 1.9) with m = n.
3. Let p be an odd prime and m, n ∈ Z such that p6 | m and p6 | n. Show that the number of quadratic
residues (mod p) among m, n, mn is either exactly one or three (i.e. it cannot be zero or two).
Solution: Since p6 | m and p6 | n then p6 | (mn), i.e. mn and p are coprime. Hence, from Eq. 8 (noting
that Legendre’s symbol is either +1 or −1) we get:
   
mn m n
p p p =1
This means that if we have any −1 on the LHS of this equation (i.e. if any of m, n, mn is a quadratic
non-residue) then we should have either two −1 or zero −1 (i.e. we should have either exactly one or
three quadratic residues among m, n, mn).
4. Show that for any prime p ≥ 7 we must have at least one pair of consecutive quadratic residues.
Solution: If p = 7 then we have 1 and 2 (which are consecutive quadratic residues of 7). So, in the
following we consider the cases of p > 7.
Let S = {1, 2, . . . , p − 1} be the set of residue classes of p (excluding 0), i.e. S represents the union of
all quadratic residues and quadratic non-residues of p (see Problem 2 of § 1.6). Now, for p > 7 we have
2, 5, 10 ∈ S. So, from Problem 3 we conclude that at least one of 2, 5, 10 must be a quadratic residue
of p. However, 1, 4, 9 (i.e. 12 , 22 , 32 ) are quadratic residues of p (see Problem 2 of § 1.6). Now, if we
note that 2 = 1 + 1, 5 = 4 + 1 and 10 = 9 + 1 then we conclude that we must have at least one pair of
consecutive quadratic residues (i.e. in S).

[19] Totally(or completely) multiplicative function is defined as an arithmetic function (see § 1.1 of V1) such that f (1) = 1
and f (mn) = f (m)f (n) for all m, n ∈ N.
1.8 Legendre’s Symbol 25

5. Show that for any prime p ≥ 7 we must have at least one pair of consecutive quadratic non-residues.
Solution: If p = 7 then we have 5 and 6 (which are consecutive quadratic non-residues of 7). So, in
the following we consider the cases of p > 7.
We note first that 1, 4, 9 (i.e. 12 , 22 , 32 ) are quadratic residues of p (see Problem 2 of § 1.6). Now, if
we have a pair of consecutive quadratic non-residues among 1, 2, 3, 4, 5, 6, 7, 8, 9 then we got what we
want. If not then we must have an alternation in quadratic residues and quadratic non-residues in such a
way that prevents the occurrence of consecutive quadratic non-residues among 1, 2, 3, 4, 5, 6, 7, 8, 9. This
means that at least one of 2, 3 must be a quadratic residue and at least two of 5, 6, 7, 8 must be quadratic
residues. So, in total we must have at least six quadratic residues among 1, 2, 3, 4, 5, 6, 7, 8, 9. Now, if we
remember that quadratic residues and quadratic non-residues are equal in number (see Problem 2 of §
1.6) then we will not have enough quadratic residues after 9 to have a similar alternation that prevents
the occurrence of consecutive quadratic non-residues after 9, i.e. we must have at least one pair of
consecutive quadratic non-residues after 9. So in brief, we must have a pair of consecutive quadratic
non-residues among 1, 2, 3, 4, 5, 6, 7, 8, 9 or after 9.
Note: the obvious conclusion of this Problem and the previous Problem is that for p ≥ 7 we must
always have pairs of consecutive quadratic residues and consecutive  quadratic
 non-residues.
6863 1137
6. Determine the value of the following Legendre symbols: 7883 and 5821 .
7883
Solution: The congruence
 x2 = 6863 has no solution (i.e. 6863 is a quadratic non-residue mod 7883)
6863
and hence 7883 = −1.
5821 1137

The congruence x2 = 1137 is solvable (i.e. 1137 is a quadratic residue mod 5821) and hence 5821 = 1.
n
7. Determine the value of the Legendre symbol: 11 for all n ∈ Z.
Solution: Referring to part (b) of Problem 3 of § 1.6:
n
 11
• 11 = +1 for n = 1, 3, 4, 5, 9.
n
 11
• 11 = −1 for n = 2, 6, 7, 8, 10.
n
 11
• 11 = 0 for n = 0.
8. Evaluate the following Legendre symbols:
   
(a) 122
19 . (b) 225
41 . (c) −183
61 . (d) −20101 .
Solution: In this Problem we use the rules of Legendre’s symbol (as well as the general rules such as
those of modular arithmetic and quadratic residues).[20]
(a) We have:
   
122 8 19
= (122 = 8)
19 19
 3
2
=
19
   
2 2 2
= (Eq. 8)
19 19 19
    
2 2
= = ±1
19 19
19
= −1 (2 6= 12 , 22 , . . . , 92 ; see Problem 2 of § 1.6)

19 19
A simpler approach is to note that 122 = 8 6= 12 , 22 , . . . , 92 and hence we need no more than two steps.
(b) We have:
   2 
225 3 × 52
=
41 41
[20] Wenote that in some of the following solutions we do extra work for pedagogical purposes (otherwise some solutions
can be obtained in less steps). We also note that there are various ways for obtaining these results and hence what we
present in the following solutions is just a sample of these various ways.
1.8 Legendre’s Symbol 26

 

3252
= (Eq. 8)
4141
 2  2
3 5
= (Eq. 9)
41 41
 
=1×1=1 (±1)2 = 1 noting that 3 and 5 are coprime to 41

A simpler approach is to use Eq. 9 from the beginning (noting that 225 = 152 and 15 and 41 are
coprime).
(c) 61|(−183) and hence this Legendre symbol is zero.
(d) We have:
   
−20 81 101
= (−20 = 81)
101 101
 2 
9
=
101
 2
9
= (Eq. 9)
101
 
=1 (±1)2 = 1 noting that 9 and 101 are coprime
 
9. Use property 2 (in the preamble) to determine the Legendre symbol −1 p for all odd primes according
to their modularity in modulo 4.
Solution: Every odd prime must be either of the form (4k + 1) or of the form (4k − 1) where k ∈ N
(see Problem 16 of § 2.2 of V1). Now, if p = 4k + 1 then from property 2 we have:
 
−1
= (−1)(p−1)/2 = (−1)(4k+1−1)/2 = (−1)2k = +1
p

On the other hand, if p = 4k − 1 then from property 2 we have:


 
−1
= (−1)(p−1)/2 = (−1)(4k−1−1)/2 = (−1)2k−1 = −1
p
 
So in brief, the Legendre symbol −1 p is +1 for all p = 4k + 1 and −1 for all p = 4k − 1.
 2
10. Show that for all n ∈ Z such that p6 | n (with p being an odd prime) we have np = 1.
Solution: We have (see Eq. 9):
 2   2
n n
= = (±1)2 = 1
p p
11. Let n be a quadratic residue of p (which is an odd prime). Show that −n is a quadratic residue if
p = 4k + 1, while
 −n is a quadratic non-residue if p = 4k − 1.
n
Solution: p = +1 because n is a quadratic residue of p. From Eq. 8 (as well as the result of
Problem 9) we have:
         (
−n −1 n −1 −1 +1 (p = 4k + 1)
= = (+1) = =
p p p p p −1 (p = 4k − 1)

i.e. −n is a quadratic residue if p = 4k + 1, and −n is a quadratic non-residue if p = 4k − 1.


12. Show the following:
    2          2  
(a) m p
m
p = 1. (b) mp = m p
m
p . (c) pm2 = m p
m
p . (d) mp = pm2 .
1.9 Euler’s Criterion 27

Solution: All these relations are proved in Problem 9 of § 1.11 for Jacobi symbol and hence they should
apply to Legendre symbol as well (noting that Legendre symbol is a special case of Jacobi symbol; see
point 9 of § 1.11). We should also note that some of these relations are trivial to prove since they
are no
  more
 than
 a special case of relations which are proved
 forLegendre
  symbol independently, e.g.
m2 m m mn m n
p = p p is a special case of the relation p = p p which we proved in Problem 4
of § 1.9.[21]
13. Show that mn is a quadratic residue of p (where p is an odd prime) iff m and n are either both quadratic
residues of p or both quadratic non-residues of p.
Solution: We note first that mn is coprime to p iff m and n are both coprime to p. From property 4
we have:     
mn m n
=
p p p
         
So, mn p = 1 iff either m
p = 1 and n
p = 1 or m
p = −1 and n
p = −1, i.e. mn is a quadratic
residue of p iff m and n are either both quadratic residues of p or both quadratic non-residues of p.
14. Show that n and n∗ are either both quadratic residues of p or both quadratic non-residues of p (where
n∗ is the multiplicative inverse of n and p is an odd prime).
p
Solution: We have nn∗ = 1. Now, 1 is a quadratic residue of p (see Problem 2 of § 1.6) and hence
by the proposition of Problem 13, n and n∗ are either both quadratic residues of p or both quadratic
non-residues of p.
15. State Gauss lemma and use it to calculate the following Legendre symbols:
13
 
(a) 17 . (b) 2131 .
Solution: Gauss lemma states: if m is an integer coprime to the odd prime p, and n is the number of
least positive residues (modulo p) of the integers m, 2m, . . . , (p−1)m
2 which are greater than p/2, then:
 
m
= (−1)n
p

(a) Let S be the set m, 2m, . . . , (p−1)m


2 and LP R be the set of the least positive residues of S. Accord-
ingly, we have:
S = {13, 26, 39, 52, 65, 78, 91, 104} LP R = {13, 9, 5, 1, 14, 10, 6, 2}
13

So, 13, 9, 14, 10 are greater than 17/2 and hence n = 4. Therefore, 17 = (−1)4 = 1.
(b) We have:
31
S = LP R = {21, 11, 1, 22, 12, 2, 23, 13, 3, 24, 14, 4, 25, 15, 5}
21

So, 21, 22, 23, 24, 25 are greater than 31/2 and hence n = 5. Therefore, 31 = (−1)5 = −1.

1.9 Euler’s Criterion


Euler’s criterion was introduced in § 3.2.3 of V1 of this book. According to this criterion, the quadratic
p p
congruence equation x2 = n has a solution iff n(p−1)/2 = 1 (where n ∈ Z, p is an odd prime and p6 | n).
This can be expressed (with some additional content) in terms of Legendre’s symbol (see § 1.8) as:
 
n p (p−1)/2
=n (n ∈ Z, p is an odd prime, p6 | n) (10)
p

We note that since φ(p) = p − 1, some authors replace (p − 1) by φ(p).


Problems

 
[21] In m
fact, the relation of part (a) is self evident because p
= ±1.
1.9 Euler’s Criterion 28

1. Prove Eq. 10.  


Solution: By the definition of Legendre’s symbol (noting that p6 | n) we have np = ±1. So, we have
two
 cases
 to consider (where we will show that in both cases Eq. 10 is valid):
n
• p = +1: in this case n is a quadratic residue (mod p) and hence we have:

p
(p − 1)! + n(p−1)/2 = 0 (quadratic congruence theorem; see § 1.7)
p
−(p − 1)! = n(p−1)/2
p
+1 = n(p−1)/2 (Wilson’s theorem)
 
n p (p−1)/2
=n (given)
p

We may also argue that in this case n is a quadratic residue (mod p) and hence we have x ∈ Z such that:
p (p−1)/2 p (p−1)/2 p
x2 = n → x2 =n → n(p−1)/2 = xp−1
p
Now, x2 = n (noting that p6 | n) implies p6 | x2 and hence p6 | x (i.e. p 
and x are coprime). Therefore,
p−1 p (p−1)/2 p n
from Fermat’s little theorem we have x = 1, i.e. n = 1 = p as required.
 
• np = −1: in this case n is a quadratic non-residue (mod p) and hence we have:

p
(p − 1)! − n(p−1)/2 = 0 (quadratic congruence theorem; see § 1.7)
p
(p − 1)! = n(p−1)/2
p
−1 = n(p−1)/2 (Wilson’s theorem)
 
n p (p−1)/2
=n (given)
p

As we see, in both cases Eq. 10 is valid (and this completes the proof).
2. Prove property 2 of § 1.8.
Solution: According to Euler’s criterion we have:
    
−1 p −1
= (−1)(p−1)/2 → p − (−1)(p−1)/2
p p
 
Now, −1 p and (−1)(p−1)/2 can be only +1 or −1 (and hence the dividend can only be 0 or 2 or −2).
Moreover,
  p is an odd prime. Hence, this divisibility statement is valid only if the dividend is 0, i.e.
−1 (p−1)/2
p = (−1) .
3. Prove property 3 of § 1.8.
Solution: We have:
p p p p p
p − 1 = 1 (−1)1 2 = 2 (−1)2 p − 3 = 3 (−1)3 4 = 4 (−1)4 ··· A = p−12 (−1)
(p−1)/2

4 4
where A = p− p−12 =
2p−p+1
2 = p+1 p−1
2 if p = −1 and A = 2 if p = 1. Now, if we multiply these (p−1)/2
congruences side by side (see rule 10 in the preamble of § 2.7 of V1) then we get:
  P(p−1)/2
p p−1 i
(p − 1) × 2 × (p − 3) × 4 × . . . × A = ! (−1) i=1 (11)
2

Now, the LHS is equal to 2 × 4 × . . . × (p − 1).[22] Moreover, from the arithmetic series formula we have
[22] This is just rearrangement of the terms in this product, that is:
 
p+1 p+1 p+1
(p − 1) × 2 × (p − 3) × 4 × . . . × = 2 × 4 × ... × × . . . × (p − 3) × (p − 1) A=
2 2 2
1.9 Euler’s Criterion 29

P(p−1)/2
i=1 i = (p2 − 1)/8. Hence, Eq. 11 becomes:
 
p p−1 2
2 × 4 × . . . × (p − 1) = ! (−1)(p −1)/8 (12)
2

Now, if we note that:


   
p−1 p−1
2 × 4 × . . . × (p − 1) = 2(1) × 2(2) × . . . × 2 = ! 2(p−1)/2
2 2

then Eq. 12 will become:


   
p−1 (p−1)/2 p p−1 2
!2 = ! (−1)(p −1)/8
2 2

Noting that p−12 ! and p are coprime (see for instance rule 4 of § 6.11 of V1) we can cancel the factorial
in the last equation (see rule 7 of § 2.7 of V1) and get:
p 2
2(p−1)/2 = (−1)(p −1)/8
(13)

Now, according to Euler’s criterion we have (see Eq. 10):


 
2 p (p−1)/2
=2
p

and hence Eq. 13 becomes:


    
2 p 2 2 2
= (−1)(p −1)/8 → p − (−1)(p −1)/8
p p
  2
Now, p2 and (−1)(p −1)/8 can be only +1 or −1 (and hence the dividend can only be 0 or 2 or −2).
Moreover, p is an odd prime. Hence, this divisibility statement is valid only if the dividend is 0, i.e.
 
2 2
= (−1)(p −1)/8
p

Now, an odd prime can only be of the following forms: p = 8k ± 1 and p = 8k ± 3 where k ∈ N (because
otherwise it will be even). So, if p = 8k ±1 then (p2 −1)/8 = 8k 2 ±2k (which is even), while if p = 8k ±3
then (p2 − 1)/8 = 8k 2 ± 6k + 1 (which is odd). Hence:
  ( 8
2 (p2 −1)/8 +1 (p = ±1)
= (−1) = 8
p −1 (p = ±3)

4. Prove property 4 of § 1.8.


Solution: mn and p are coprime and hence m and p are coprime and n and p are coprime (because
mn has no prime factor p and hence m and n cannot have a prime factor p). Accordingly:
 
mn p  (p−1)/2
= mn (Eq. 10)
p
 
mn p (p−1)/2 (p−1)/2
=m n (rules of indices)
p
 
p−1 p−1 p−1
(p − 1) × 2 × (p − 3) × 4 × . . . × = 2 × 4 × ... × × . . . × (p − 3) × (p − 1) A=
2 2 2
1.10 Quadratic Reciprocity 30

   
mn m p n
= (Eq. 10)
p p p
     
Now, if we note that each of mn
p , mp and np is equal either to +1 or to −1 (noting that mn, m, n
are coprime to p) then we have the following 8 (comprehensive) cases:
p p p p
+1 = (+1)(+1) +1 = (+1)(−1) +1 = (−1)(+1) +1 = (−1)(−1)
p p p p
−1 = (+1)(+1) −1 = (+1)(−1) −1 = (−1)(+1) −1 = (−1)(−1)
As we see, the 2nd , 3rd , 5th , 8th cases are impossible (noting that p is an odd prime and hence p6 | 2). So,
the only possible cases are the other four and this should establish Eq. 8 and complete the proof.
5. Repeat Problem 7 of § 1.8 using this time Euler’s criterion (i.e. Eq. 10).
Solution: p = 11 and (p − 1)/2 = 5 and we have:
11 11 11 11 11 11 11 11 11 11
15 = 1 25 = −1 35 = 1 45 = 1 55 = 1 65 = −1 75 = −1 85 = −1 95 = 1 105 = −1
n
 11 n
 11 5 11
Hence, 11 = +1 for n = 1, 3, 4, 5, 9 and 11 = −1 for n = 2, 6, 7, 8, 10. Also, 0 = 0 and hence
n
 11
11 = 0 for n = 0. These results are identical to the results of Problem 7 of § 1.8.
6. Use Euler’s criterion to show that a quadratic residue of an odd prime p cannot be a primitive root of
p.
p p
Solution: If n is a quadratic reside then by Euler’s criterion we have n(p−1)/2 = 1, i.e. nφ(p)/2 = 1.
This means that Op n < φ(p) and hence n cannot be a primitive root (see point 1 of § 1.4). Also see
Problem 6 of § 1.6.
Note: it is important to note that this proposition means that an integer cannot be a quadratic residue
and a primitive root (of an odd prime) at the same time. This does not mean that a non-quadratic
residue must be a primitive root. For instance, 6 is a quadratic non-residue (mod 7) and it is not a
primitive root (mod 7). So in brief, a quadratic residue cannot be a primitive root (and similarly a
primitive root cannot be a quadratic residue), but a quadratic non-residue can be a primitive root (such
as 3 in mod 7) and can be not a primitive root (such as 6 in mod 7). Also see Problem 7.
7. Show that if p is an odd prime then there are p−1
2 − φ(p − 1) quadratic non-residues (mod p) which are
not primitive roots (mod p).
Solution: According to Problem 6, a quadratic residue cannot be a primitive root. So, primitive roots
must be among the p−1 2 quadratic non-residues (see
 Problem
 2 of § 1.6). Also, according to Problem
8 of § 1.4 the number of primitive roots of p is φ φ(p) = φ(p − 1). Hence, the number of quadratic
non-residues which are not primitive roots is p−1
2 − φ(p − 1).

1.10 Quadratic Reciprocity


According to the law of quadratic reciprocity, if p and q are distinct odd primes then:
  
p q
= (−1)(p−1)(q−1)/4 (14)
q p
  
where pq q
p are Legendre’s symbols. To make use of this law we usually use some subsidiary results
(or methods or tricks or etc.) some of which will be outlined in the following Problems.
Problems
1. Use the law of quadratic reciprocity to determine whether or not the following are quadratic residues:
(a) 7 (mod 29). (b) 11 (mod 23).
Solution:
7
(a) We have 29 = 1 and 1 is a quadratic residue of 7 (see Problem 2 of § 1.6) and hence 29 is a quadratic
residue (mod 7), i.e. 29
7 = 1. Moreover, from the law of quadratic reciprocity we have:
  
7 29
= (−1)(7−1)(29−1)/4 = (−1)42 = 1
29 7
1.11 Jacobi’s Symbol 31

7
 29

which implies 29 = 1 since 7 = 1. Therefore, 7 is a quadratic residue (mod 29).
11
(b) We have 23 = 1 and 1 is a quadratic
 residue of 11 (see Problem 2 of § 1.6) and hence 23 is a
quadratic residue (mod 11), i.e. 2311 = 1. Moreover, from the law of quadratic reciprocity we have:
  
11 23
= (−1)(11−1)(23−1)/4 = (−1)55 = −1
23 11
11
 
which implies 23 = −1 since 23
11 = 1. Therefore, 11 is a quadratic non-residue (mod 23).
2. Let p and q be odd primes. Use the law of quadratic reciprocity to correlate the solvability of the
p q
congruence x2 = q to the solvability of the congruence x2 = p according to the modularity of p and q
in modulo 4.
Solution: Every odd prime must be either of the form (4k + 1) or of the form (4k − 1) where k ∈ N
(see Problem 16 of § 2.2 of V1). Now, if p = 4k ± 1 and q = 4κ ± 1 then we have 4 cases:
• p = 4k + 1 and q = 4κ + 1 and hence (by the law of quadratic reciprocity):
  
p q
= (−1)(p−1)(q−1)/4 = (−1)(4k+1−1)(4κ+1−1)/4 = (−1)4kκ = 1
q p
• p = 4k + 1 and q = 4κ − 1 and hence:
  
p q
= (−1)(p−1)(q−1)/4 = (−1)(4k+1−1)(4κ−1−1)/4 = (−1)4kκ−2k = 1
q p
• p = 4k − 1 and q = 4κ + 1 and hence:
  
p q
= (−1)(p−1)(q−1)/4 = (−1)(4k−1−1)(4κ+1−1)/4 = (−1)4kκ−2κ = 1
q p
• p = 4k − 1 and q = 4κ − 1 and hence:
  
p q
= (−1)(p−1)(q−1)/4 = (−1)(4k−1−1)(4κ−1−1)/4 = (−1)4kκ−2k−2κ+1 = −1
q p
     
As we see, pq q
p = 1 when p = 4k + 1 or/and q = 4κ + 1 while p
q
q
p = −1 when both p = 4k − 1
and q = 4κ − 1. This means:
p
⋆ When p = 4k + 1 or/and q = 4κ + 1 then either both the aforementioned congruences (i.e. x2 = q
q
and x2 = p) are solvable or both are non-solvable.
⋆ When p = 4k−1 and q = 4κ−1 then one of these congruences is solvable and the other is non-solvable.
6521 4
Note: for instance, knowing that x2 = 5701 is solvable and 5701 = 1 we can immediately conclude
5701 6367 4
that x2 = 6521 is also solvable. Similarly, knowing that x2 = 5701 is non-solvable and 5701 = 1 we
5701
can immediately conclude that x2 = 6367 is also non-solvable.
6043 4 4
On the other hand, knowing that x2 = 5711 is non-solvable and 5711 = 6043 = −1 we can immediately
5711
conclude that x2 = 6043 is solvable.

1.11 Jacobi’s Symbol


This is a generalization of Legendre’s symbol (see § 1.8) and is defined as follows:
(
n +1 (N = 1)
= Q k  n a i (15)
N i=1 pi (N = pa1 1 pa2 2 . . . pakk )
 
n
where N is an odd positive integer, n is an integer coprime to N , and the pi ’s are Legendre’s symbols.
It is important to note the following:
1.11 Jacobi’s Symbol 32

1. The Jacobi symbol takes only the values +1 and −1 (since the Legendre symbol takes only these values;
see Eq. 15).
2. Following the style of Legendre’s symbol, we define Jacobi’s symbol to be zero when n and N are not
coprime (also see point 6 in the preamble of § 1.8).
3. If mn ∈ Z is coprime to N (or each of m, n ∈ Z is coprime to N ) then:[23]
 mn   m   n 
= (N is odd positive integer) (16)
N N N
4. If M N is coprime to n ∈ Z (or each of M, N is coprime to n ∈ Z) then:
 n   n  n 
= (M, N are odd positive integers) (17)
MN M N
N
5. If m, n ∈ Z are coprime to N and m = n then:
m  n 
= (N is odd positive integer) (18)
N N
6. If M, N are odd coprime positive integers then:
  
M N
= (−1)(M −1)(N −1)/4 (19)
N M
This means that the law of quadratic reciprocity (or rather an analogue or generalization of it) applies
to Jacobi’s symbols as to Legendre’s symbols (see § 1.10).
7. The significance of Jacobi’s symbol is that: 
• If m is a quadratic residue (mod N ) then m N = 1. However, the converse is not true in general,  i.e.
if mN = 1 then it is not necessary that m is a quadratic
 residue (mod N ). For example, 10
237 = 1 and
14
10 is a quadratic
 residue (mod 237), while 237 = 1 and 14 is not a quadratic residue (mod 237).
• If m N = −1 then m is a quadratic non-residue (mod N ). In fact, this point is essentially the
contraposition of the previous point (noting that Jacobi’s symbol is either +1 or −1 if we exclude the
case of m and N not being coprime).
8. Point 7 highlights  an important difference between Legendre’s symbol and Jacobi’s symbol, i.e. for

Legendre’s symbol np = +1 iff n is a quadratic residue, while for Jacobi’s symbol N n
= +1 if n is a
quadratic residue. Practically,  this means that if we know that n is a quadratic residue (non-residue)
then we can conclude that np = +1 (−1) and vice verse. On the other hand, if we know that n is a
n
 n

quadratic residue then we can conclude that N = +1 and if we know  that N = −1 then we can
n
conclude that n is a quadratic non-residue but if we know that N = +1 then we cannot conclude
that n isa quadratic
 residue and if we know that n is a quadratic non-residue then we cannot conclude
n
that N = −1 .
9. Jacobi’s symbol reduces to Legendre’s symbol when N is an odd prime. Accordingly, Legendre’s symbol
is a special case of Jacobi’s symbol and hence the attributes (represented in algebraic relations) of
Jacobi’s symbol should generally apply to Legendre’s symbol (as long as we observe the restriction
imposed on the relation between the value of these symbols and quadratic residue which we discussed
in points 7 and 8). Therefore, the proofs related to Jacobi’s symbol are also proofs to Legendre’s symbol
(as long as quadratic residues are not involved and the proofs are not dependent on corresponding proofs
related to Legendre’s symbol).
Problems
1. Calculate the following Jacobi symbols:
21
 45
 66
 49

(a) 6137 . (b) 98237 . (c) 414507281407 . (d) 343 .
[23] This (as well as some of the next points) applies even without the condition of coprimality (but we ignore this trivial
case).
1.11 Jacobi’s Symbol 33

Solution:
(a) 6137 = 171 × 192 and hence:
    1  2
21 21 21
= = (+1)(−1)2 = +1
6137 17 19
(b) 98237 = 1931 × 5091 and hence:
   1  1
45 45 45
= = (−1)1 (+1)1 = −1
98237 193 509
66

(c) 414507281407 is prime and hence this is a Legendre  symbol. Thus 414507281407 = −1.
49
(d) 49 and 343 are not coprime and hence 343 =
 0.
13
2. Calculate the following Jacobi symbol: 166182225 .
Solution: We can calculate this in a straightforward (and rather lengthy) way (as we did in Problem 1)
by using Eq. 15. However, we can exploit the properties and algebraic relations of Jacobi and Legendre
symbols (which we investigated earlier) to make some (rather essential) simplifications, that is:
     
13 166182225 1
= = = +1
166182225 13 13

where in step 1 we used Eq. 19 noting that (13 − 1)(166182225 − 1)/4 = 498546672 which is even and
 13
hence (−1)(M −1)(N −1)/4 = 1 , and used property 1 of § 1.8 in step 2 (noting that 166182225 = 1).
3. Justify point 3 in the preamble of this section.
Solution: We note first that the coprimality of mn to N and the coprimality of each of m, n to N are
equivalent. Now, if N = pa1 1 pa2 2 . . . pakk then we have (see Eq. 15):
" k   # " k   #
m n  Y m ai Y n ai
= ×
N N i=1
pi i=1
pi
Yk  a  a i 
m i n
= ×
i=1
p i p i

Yk     ai
m n
= ×
i=1
pi pi
Yk   a
mn i
=
i=1
pi
 mn 
=
N
where we used property 4 of § 1.8 in line 4, and used Eq. 15 in line 5.
4. Justify point 4 in the preamble of this section.
Solution: We note first that the coprimality of M N to n and the coprimality of each of M, N to n are
equivalent. Now, if M = pa1 1 pa2 2 . . . pakk and N = q1b1 q2b2 . . . qsbs then M N = pa1 1 pa2 2 . . . pakk q1b1 q2b2 . . . qsbs
and hence (see Eq. 15):
 n   a 1  a 2   a k  b 1   b 2  b s
n n n n n n
= × × ··· × × × × ··· ×
MN p1 p2 pk q1 q2 qs
 a1  a2  a k  "  b 1  b 2  b s #
n n n n n n
= × × ··· × × × × ··· ×
p1 p2 pk q1 q2 qs
 n  n 
=
M N
1.11 Jacobi’s Symbol 34

5. Justify point 5 in the preamble of this section.


pi N
Solution: If N = pa1 1 pa2 2 . . . pakk then m = n (i = 1, 2, . . . , k) where this is justified by m = n.[24]
Therefore, from point 1 of § 1.8 we get:
     a i  a i
m n m n
= → = (i = 1, 2, . . . , k)
pi pi pi pi
Now, if we multiply these equations side by side and use Eq. 15 then we get:
Yk  a k  a m  n 
m i Y n i
= → =
i=1
pi i=1
pi N N

6. Prove (the two parts of) point 7 in the preamble of this section.
Solution: We have two parts to prove: 
• If m is a quadratic residue (mod N ) then m N = 1: let N = pa1 1 pa2 2 . . . pakk noting that all pi
(i = 1, 2, . . . , k) are odd primes because N is odd (according to the definition of Jacobi’s symbol). Now,
N
since m is a quadratic residue (mod N ) then x2 = m is solvable, i.e. there is x ∈ Z (call it X) such that:
a a a
p1 1 p2 2 ...pkk pi
X2 = m → X 2 = m (i = 1, 2, . . . , k)
where this can be more easily understood
 in terms of divisibility.[25] This means that m is a quadratic
m
residue (mod pi ) and hence pi = 1 (noting that we are using here Legendre’s symbol not Jacobi’s
  
symbol because pi is prime). Hence, from Eq. 15 we get m N = 1 since all m
pi are 1.
We prove that the converse is not true by the method of proof by example (see § 1.5.4 of V1) since we
have many
 examples (e.g. the example given in the preamble) where the converse does not hold true.
• If mN = −1 then m is a quadratic non-residue (mod N ): as indicated in the preamble, this part is
essentially the contraposition of the previous part and hence it is true by contraposition, i.e. it does
not require another (or independent) proof (see § 1.1 of V1 as well as § 1.5.4 of V1).
7. Show that if N is an odd positive integer then:
 
−1
= (−1)(N −1)/2
N
Solution: If N = pa1 1 pa2 2 . . . pakk then we have:
  Y k  a
−1 i Y h ia i Y
k k Pk
−1
= = (−1)(pi −1)/2 = (−1)ai (pi −1)/2 = (−1) i=1 ai (pi −1)/2 (20)
N i=1
pi i=1 i=1

where we used Eq. 15 in step 1 and used property 2 of § 1.8 in step 2 (noting that N is odd and hence
each pi is an odd prime).
We also have:
ai
X
a 4
pai i = [1 + (pi − 1)] i = 1 + ai (pi − 1) + Cjai (pi − 1)j = 1 + ai (pi − 1) (21)
j=2

where in step 2 we used the binomial theorem while in step 3 we used the fact that (pi − 1) is even and
hence (pi − 1)j is divisible by 4 for j ≥ 2. Thus:
k
X
4      4
N = pa1 1 pa2 2 . . . pakk = 1 + a1 (p1 − 1) 1 + a2 (p2 − 1) . . . 1 + ak (pk − 1) = 1 + ai (pi − 1)
i=1
N a
[24] This is because m = n means N (which is equal to pa 1 a2 k
1 p2 . . . pk ) divides m − n and hence each pi must divide m − n,
pi
i.e. m = n.
a a a
p1 1 p2 2 ...pkk a
[25] The congruence X 2 = m is equivalent to (pa 1 a2 k 2 2
1 p2 . . . pk )|(X − m), and this implies pi |(X − m) which is
p
equivalent to X 2 =i m.
1.11 Jacobi’s Symbol 35

where step 2 is from Eq. 21 while step 3 is because all non-linear terms are 0 (mod 4) since (pi − 1) is
even. Hence (see rule 9 of § 2.7 of V1):
k
X k
4 N − 1 2 X ai (pi − 1)
N −1= ai (pi − 1) → =
i=1
2 i=1
2
Pk Pk
ai (pi −1)/2
i.e. (N − 1)/2 and i=1 ai (pi − 1)/2 have the same parity and hence (−1) i=1 = (−1)(N −1)/2 .
So, from Eq. 20 we conclude:  
−1
= (−1)(N −1)/2
N
8. Show that if N is an odd positive integer then:
 
2 2
= (−1)(N −1)/8
N
Solution: If N is prime then this is no more than property 3 of § 1.8 (which we proved in Problem
3 of § 1.9). So, let assume that N is a composite whose prime factorization is N = pa1 1 pa2 2 . . . pakk .
Accordingly:
  Y k  a
2 i Yh ia i Y
k k Pk
2 (p2i −1)/8 2 2
= = (−1) = (−1)ai (pi −1)/8 = (−1) i=1 ai (pi −1)/8 (22)
N i=1
p i i=1 i=1

where we used Eq. 15 in step 1 and used property 3 of § 1.8 in step 2.


We also have:
ai
X
 2  ai  ai 64
pi = 1 + (p2i − 1) = 1 + ai (p2i − 1) + Cjai (p2i − 1)j = 1 + ai (p2i − 1) (23)
j=2

where in step 2 we used the binomial theorem while in step 3 we used the fact that (p2i − 1) is divisible
by 8 and hence (p2i − 1)j is divisible by 64 for j ≥ 2.[26] Thus:
2   a1  2  a 2   ak
N 2 = [pa1 1 pa2 2 . . . pakk ] = p21 p2 . . . p2k
k
X
64      64
= 1 + a1 (p21 − 1) 1 + a2 (p22 − 1) . . . 1 + ak (p2k − 1) = 1 + ai (p2i − 1)
i=1

where step 3 is from Eq. 23 while step 4 is because all non-linear terms are 0 (mod 64) since (p2i − 1)
is divisible by 8. Hence (see rule 9 of § 2.7 of V1 noting that since 8 divides p2i − 1 then it must divide
N 2 − 1):
Xk k
64 N 2 − 1 8 X ai (p2i − 1)
N2 − 1 = ai (p2i − 1) → =
i=1
8 i=1
8
P Pk 2
k
This implies that (N 2 −1)/8 and i=1 ai (p2i −1)/8 have the same parity[27] and hence (−1) i=1 ai (pi −1)/8 =
2
(−1)(N −1)/8 . So, from Eq. 22 we conclude:
 
2 2
= (−1)(N −1)/8
N
[26] As
P(p−1)/2
we noted earlier, from the arithmetic series formula we have i=1 i = (p2 − 1)/8 and hence (p2 − 1)/8 is an integer
which implies 8|(p − 1). Alternatively, any odd prime is of the form 4k ± 1 (k ∈ N) and hence (p2 − 1)/8 = 2k2 ± k
2

(which are integers).


[27] It is obvious that:
h 2 i P 
N 2 −1 8 Pk a (p2 −1) N −1 k ai (p2
8
= i=1 i 8i means 8 divides 8
− i=1
i −1)
8

Now, if (N 2 − 1)/8 and ki=1 ai (p2i − 1)/8 have opposite parity then their difference will be odd and hence it cannot be
P
divisible by 8 which is even.
1.11 Jacobi’s Symbol 36

9. Show the following:


 m  2  m   m   
m2
(a) mN N = 1. (b) m
N = mN N . (c) Nm2 = m N N . (d) N = m
N2 .
Solution: All these relations can be proved in one go, that is:
 m   m   m2   m 
1= = =
N N N N2
 m 
(a) m m
N N = 1 is because N is either +1 or −1.
2  m
(b) m N = m N is from property 3 (see the preamble and Problem 3).
m
 m
 mN
(c) N 2 = N N is from property 4 (see the preamble and Problem 4).
2 
(d) m N = Nm2 is just a combination of (b) and (c).
m

10. Find all the integers m which are coprime to 33 and 33 = 1.
Solution: We have (see Eq. 15 noting that 33 = 31 × 111 ):
m  m 1  m 1
=
33 3 11

Now, the quadratic residue of 3 is 1, and the quadratic non-residue of 3 is 2. Hence, m 3 = +1 for
3 m
 3
m = 1 and 3 = −1 for m = 2 (see § 1.6 and § 1.8).
m
 11 m
 11
Similarly, 11 = +1 for m = 1, 3, 4, 5, 9 and 11 = −1 for m = 2, 6, 7, 8, 10 (see Problem 7 of § 1.8).
1 m 1 
Now, if we combine these cases we get all the possibilities for the product m 3 33 and hence 33m
,
that is:
m

11
1 2 3 4 5 6 7 8 9 10
m
 1 +1 −1 +1 +1 +1 −1 −1 −1 +1 −1
3 2 −1 +1 −1 −1 −1 +1 +1 +1 −1 +1
m

So, we have 33 = +1 in the following cases:
3 11 3 11 3 11 3 11 3 11
m=1&m=1 m=1&m=3 m=1&m=4 m=1&m=5 m=1&m=9
3 11 3 11 3 11 3 11 3 11
m=2&m=2 m=2&m=6 m=2&m=7 m=2&m=8 m = 2 & m = 10
Now, if we solve these 10 systems of congruence equations (using for instance the Chinese remainder
theorem) then we get:
33 33 33 33 33 33 33 33 33 33
m=1 m = 25 m=4 m = 16 m = 31 m=2
m = 17 m = 29 m=8 m = 32
m

So, these are all the integers m which are coprime to 33 and 33 = 1.
11. Find all the integers m which are coprime to 33 and m is a quadratic residue of 33.
Solution: Referring to points 7 and 8 in the preamble, the quadratic residues of 33 must be among
those m whose Jacobi symbol is 1. So, although having a Jacobi symbol of value 1 is not sufficient
to determine if m is a quadratic residue or not, we can still make use of our results in Problem 10 by
searching for the quadratic residues of 33 among only those m whose Jacobi symbol is 1.
33 33
On investigating the quadratic congruence x2 = m for m = 1, 2, 4, 8, 16, 17, 25, 29, 31, 32 we find that
33
this congruence is solvable only for m = 1, 4, 16, 25, 31. So, these are the quadratic residues modulo 33
among the integers which are coprime to 33. 
12. Give an example of an odd positive integer N whose Jacobi symbol m N is +1 for all m ∈ Z (where m
and N are coprime).
Solution: N is a perfect square (which includes any integer that is an even natural power of an integer)
should do (as can be seen from Eq. 15).
13. Solve (and analyze the implications of) the following equation involving Jacobi’s symbols (i.e. a is an
1.12 Mobius Inversion 37

integer coprime to the odd positive integers M and N ):


 a  a   a   a 
= + +3
M N M N
Solution:
 We have 4 cases:
a a
• M  = N  = 1 and hence 1 = 5 which is not acceptable.
a a
• M  = N = −1 and hence 1 = 1 which is acceptable.
a
• M  = 1 and Na =  −1 and hence −1 = 3 which is not acceptable.
a a
• M = −1 and N = 1 and  hence −1 = 3 which is not acceptable.
a
So in brief, only M = Na = −1 is acceptable and hence the solution of the given equation is: every
integer a (coprime to M and N ) which is a quadratic non-residue of both M and N (see points 7 and
8 in the preamble).

1.12 Mobius Inversion


Mobius inversion can be summarized in the following conditional statement:
X X n X n
F (n) = f (d) → f (n) = µ F (d) = µ(d) F (n ∈ N) (24)
d d
d|n d|n d|n

Problems
1. Prove the Mobius inversion formula which is given by:
X n
f (n) = µ(d) F (n ∈ N)
d
d|n
P
where µ is the Mobius function and F is the summatory function of f , i.e. F (n) = d|n f (d).[28]
Solution: We have:
X n X X X X
µ(d) F = µ(d) f (δ) = µ(d) f (δ) (25)
d
d|n d|n δ|(n/d) d|n δ|(n/d)

where we used the definition of summatory function (which is given above) in the first step. Now, let
us analyze the double sum in the last step of this equation. This double sum means that we take all
the (product) combinations of µ(d) and f (δ) where d represents all the divisors of n while δ represents
all the divisors of n/d. In other words, we need to loop over all the divisors (i.e. d) of n in combination
with all the divisors of n/d (i.e. δ). However, if we note that “all the divisors of n” are the same as
“all the divisors of n/d” (noting that d is looping over all the divisors of n from 1 to n inclusive) then
this double loop (representing the double sum) can be done equivalently (although the order of the
generated combinations generally differs) by taking all the (product) combinations of µ(δ) and f (d)
and hence we can continue Eq. 25 as follows:
X n X X X X X X
µ(d) F = µ(d) f (δ) = µ(d) f (δ) = µ(δ) f (d)
d
d|n d|n δ|(n/d) d|n δ|(n/d) d|n δ|(n/d)
  
X X
=  f (d)  µ(δ)
d|n δ|(n/d)
P
Now, µ(δ) = 0 (see Problem 3 of § 2.6.5 of V1) except when n/d = 1 (i.e. d = n) and hence:
δ|(n/d)
       
X X X X h i X
 f (d)  µ(δ) =  f (n)  µ(δ) = f (n)  µ(δ)
d|n δ|(n/d) n|n δ|(n/n) δ|1

[28] For more details about the “summatory function”, see Problem 15 of § 10.
1.12 Mobius Inversion 38

" #
h i X
= f (n) µ(1) = f (n) × 1 = f (n)
1

which completes the proof.


It is worth noting (see Eq. 24) that the Mobius inversion formula may be given as:
X n
f (n) = µ F (d)
d
d|n

since both d and n/d represent all the divisors of n since each divisor d is matched by a corresponding
divisor n/d noting that d × (n/d) = n (see Problem 19 of § 1.9 of V1).
2. Verify the Mobius inversion formula with regard to:
(a) The divisor function σ(n). (b) The tau function τ (n).
Solution:
(a) σ(n) is the summatory function of f (d) = d. Hence:
X n X n X X X X X X
µ(d) F = µ(d) σ = µ(d) f (δ) = µ(d) δ= µ(d) δ
d d
d|n d|n d|n δ|(n/d) d|n δ|(n/d) d|n δ|(n/d)
    
X X X X X
= µ(δ) d =  d  µ(δ) =  n × 1 = n × 1 = n = f (n)
d|n δ|(n/d) d|n δ|(n/d) n|n

where the explanations are as given in Problem 1.


(b) τ (n) is the summatory function of f (d) = 1. Hence:
X n X n X X X X X X
µ(d) F = µ(d) τ = µ(d) f (δ) = µ(d) 1= µ(d) × 1
d d
d|n d|n d|n δ|(n/d) d|n δ|(n/d) d|n δ|(n/d)
    
X X X X X
= µ(δ) × 1 =  1  µ(δ) =  1 × 1 = 1 × 1 = 1 = f (n)
d|n δ|(n/d) d|n δ|(n/d) n|n

where the explanations are as given in Problem 1.


3. Derive the formula φ(pa ) = pa − pa−1 (see Eq. 42 in V1) by using the Mobius inversion formula.
Solution: Let n = pa and hence:
X a
X
n = pa = φ(d) = φ(pk ) (26)
d|pa k=0

where step 2 is from Eq. 45 of V1 (with n = pa ; also see Problem 1 of § 2.6.4 of V1), while step 3 is
because the divisors of pa are p0 , p1 , . . . , pa . Now, we have:
X  a X a  a X a a
X
p p
φ(pa ) = µ(d) F = µ(pk ) F k = µ(pk ) F (pa−k ) = µ(pk ) pa−k
a
d p
d|p k=0 k=0 k=0
0 a−0 1 a−1 2 a−2 a a−a
= µ(p ) p + µ(p ) p + µ(p ) p + · · · + µ(p ) p
a a−1 a a−1
= p −p + 0 + ··· + 0 = p − p
where:
step 1 is from the Mobius inversion formula,
step 2 is because the divisors
 of pa areP
p0 , p1 , . . . , pa , P 
a−k a−k
step 4 is from Eq. 26 i.e. F (p ) ≡ d|pa−k φ(d) = i=0 φ(pi ) = pa−k , and
step 6 is because µ(p0 ) = µ(1) = 1 and µ(p1 ) = (−1)1 = −1 while µ(p2 ) = . . . = µ(pa ) = 0 (since they
are not square free).
Chapter 2
Miscellaneous
1. Determine the parity of am + bn + ck for all a, b, c ∈ Z and all m, n, k ∈ N0 .
Solution: We note first that we consider 00 as undefined and hence any case of 00 is not considered in
the following. Now, let represent the parity of a, b, c (as well as the parity of am + bn + ck ) with e for
even and o for odd. Also, let represent m, n, k with 0 when m, n, k is 0 and ignore its symbol otherwise
(e.g. e0 o0 e represents the case when a, b, c is even, odd, even with m = n = 0 and k 6= 0 noting that
e0 o0 e represents sum not product). Accordingly, the parity of am +bn +ck is given by the following table:
e0 e0 e0 = o e 0 e0 o0 = o e 0 o0 e0 = o e 0 o0 o0 = o o 0 e0 e0 = o o 0 e0 o 0 = o o 0 o0 e0 = o o 0 o0 o0 = o
e0 e0 e = e e0 e0 o = o e0 o0 e = e e0 o0 o = o o0 e0 e = e o 0 e0 o = o o0 o0 e = e o0 o0 o = o
e0 ee0 = e e0 eo0 = e e0 oe0 = o e0 oo0 = o o0 ee0 = e o0 eo0 = e o0 oe0 = o o0 oo0 = o
ee0 e0 = e ee0 o0 = e eo0 e0 = e eo0 o0 = e oe0 e0 = o oe0 o0 = o oo0 e0 = o oo0 o0 = o
e0 ee = o e0 eo = e e0 oe = e e0 oo = o o0 ee = o o0 eo = e o0 oe = e o0 oo = o
ee0 e = o ee0 o = e eo0 e = o eo0 o = e oe0 e = e oe0 o = o oo0 e = e oo0 o = o
eee0 = o eeo0 = o eoe0 = e eoo0 = e oee0 = e oeo0 = e ooe0 = o ooo0 = o
eee = e eeo = o eoe = o eoo = e oee = o oeo = e ooe = e ooo = o
2. Find all n ∈ Z such that P1 = P2 = P3 = P4 = P5 where:

P1 (n) = n5 − 96n4 + 2752n3 − 16950n2 − 221777n + 2104724


P2 (n) = n5 − 96n4 + 2860n3 − 22350n2 − 214541n + 2685980
P3 (n) = −n5 + 110n4 − 3526n3 + 21588n2 + 292167n − 2437684
P4 (n) = −n5 + 136n4 − 4452n3 + 4630n2 + 457157n − 424816
P5 (n) = −n4 − 31n3 + 3983n2 − 10809n − 403288

Solution: If P1 = P2 = P3 = P4 = P5 then:
P1 = P2 & P 1 = P3 & P1 = P4 & P1 = P5
So, it is a problem of solving a system of univariate equations (see § 3.3 of V1). On solving the following
system:
P1 − P2 = 0 P1 − P3 = 0 P1 − P4 = 0 P1 − P5 = 0
we get: n = −9, 13, 46. So, we have P1 = P2 = P3 = P4 = P5 for these values of n.
3. Determine the sign of the polynomial f (n) = −n5 + 58n4 + 462n3 − 4913n2 − 4972n − 5376 for all n ∈ Z.
Solution: If we factorize f (n) to its simplest factors (i.e. linear and non factorizable quadratic) then
we get:
f (n) = (n + 12)(7 − n)(n − 64)(n2 + n + 1)
We can now build the following sign table:
n= < −12 −12 7 64 > 64
n + 12 − 0 + + + + +
7−n + + + 0 − − −
n − 64 − − − − − 0 +
n2 + n + 1 + + + + + + +
f (n) + 0 − 0 + 0 −

39
2 MISCELLANEOUS 40

As we see, the sign of f (n) is given in the last row, i.e. f (n) is positive for n < −12 and 7 < n < 64,
f (n) is negative for −12 < n < 7 and n > 64, and f (n) = 0 for n = −12, 7, 64.
4. Find a formula for the number of sets Ns of (distinct) natural numbers of size k (≥ 2) whose sum of
elements is equal to a given natural number Nn .
Solution: We have at least three methods to tackle this Problem: the use of generating function, the
use of recursive formula and the use of combinatorics argument. In the following, we discuss the first
method andPonly give the result of the second method.[29] Pk
k
For Nn < i=1 i we have zero set, and hence in the following we assume Nn ≥ i=1 i. Now, let
Pk
N0 = i=1 i and Nn = N0 + n (where n = 0, 1, 2, . . .). The generating function fg of the sequence of
Ns for a given k is given by:
1
fg (z, k) = Qk
j
j=1 (1 − z )

For example:
1 1
fg (z, 2) = fg (z, 3) =
(1 − z) (1 − z 2 ) (1 − z) (1 − z 2 ) (1 − z 3 )

Accordingly, the number of sets Ns (k, Nn ) (i.e. Ns as a function of k and Nn ) are given by the
coefficients cn of the series expansion of the generating function fg (z, k) at z = 0 (i.e. Taylor series).
For instance, the Taylor series of fg (z, 3) is given by:

fg (z, 3) = 1 + z + 2z 2 + 3z 3 + 4z 4 + 5z 5 + 7z 6 + 8z 7 + 10z 8 + 12z 9 + 14z 10 + · · ·

and hence (noting that for k = 3 we have N0 = 1 + 2 + 3 = 6 and thus N4 = 10 and N9 = 15) we have:

Ns (3, 6) = c0 = 1 Ns (3, 10) = c4 = 4 Ns (3, 15) = c9 = 12

Regarding the recursive formula we say the following: for Nn = N0 , N1 , . . . , Nk−1 we have

Ns (k, Nn ) = Ns (k − 1, Nn )

(where we should note the difference in the meaning of Nn on the two sides because of the dependency
of Nn on k) while for Nn > Nk−1 we have:

Ns (k, Nn ) = Ns (k − 1, Nn ) + Ns (k, Nn−k )

5. Referring to Problem 4, find all the sets of (distinct) natural numbers of:
(a) Size 4 with sum 15. (b) Size 7 with sum 32. (c) Size 8 with sum 35.
Solution:
(a) We have: k = 4, N0 = 1 + 2 + 3 + 4 = 10 and Nn = 15 and hence n = Nn − N0 = 15 − 10 = 5. The
coefficient c5 of the Taylor series of fg (z, 4) is 6 and hence Ns (4, 15) = c5 = 6. These 6 sets are:
{1,2,3,9} {1,2,4,8} {1,2,5,7} {1,3,4,7} {1,3,5,6} {2,3,4,6}
(b) We have: k = 7, N0 = 1+2+3+4+5+6+7 = 28 and Nn = 32 and hence n = Nn −N0 = 32−28 = 4.
The coefficient c4 of the Taylor series of fg (z, 7) is 5 and hence Ns (7, 32) = c4 = 5. These 5 sets are:
{1,2,3,4,5,6,11} {1,2,3,4,5,7,10} {1,2,3,4,5,8,9} {1,2,3,4,6,7,9} {1,2,3,5,6,7,8}
(c) We have: k = 8, N0 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 = 36 and Nn = 35. Since Nn < N0 we have zero
set, i.e. Ns (8, 35) = 0.

[29] The combinatorics method is rather messy and requires lengthy explanation and hence we leave it (noting that we may
discuss it in the future). We refer the reader to the literature about the topics of sequence representation and generation
using the generating function and z-transform techniques (noting that these topics are out of scope of our book which is
about number theory).
2 MISCELLANEOUS 41

6. Find all the partitions of the following set into two disjoint subsets such that the product of the members
of one subset is equal to the product of the members of the other subset:
{49, 27, 3125, 32, 243, 8, 343, 9, 16807, 25, 125, 4}
Solution: We prime-factorize these numbers so that we can group and partition them in a way that
ensures that the number of prime factors (i.e. of any given prime number) in each subset is the same
as the number of prime factors in the other subset, that is:
{72 , 33 , 55 , 25 , 35 , 23 , 73 , 32 , 75 , 52 , 53 , 22 }
So we must have 22 , 23 (i.e. 4, 8) in one subset and 25 (i.e. 32) in the other, 32 , 33 (i.e. 9, 27) in one
subset and 35 (i.e. 243) in the other, 52 , 53 (i.e. 25, 125) in one subset and 55 (i.e. 3125) in the other,
and 72 , 73 (i.e. 49, 343) in one subset and 75 (i.e. 16807) in the other. So, we can do this partitioning
in 8 possible ways, i.e.
{4, 8, 9, 27, 25, 125, 49, 343}{32, 243, 3125, 16807} {4, 8, 9, 27, 25, 125, 16807}{32, 243, 3125, 49, 343}
{4, 8, 243, 25, 125, 49, 343}{32, 9, 27, 3125, 16807} {4, 8, 243, 25, 125, 16807}{32, 9, 27, 3125, 49, 343}
{4, 8, 9, 27, 3125, 49, 343}{32, 243, 25, 125, 16807} {4, 8, 9, 27, 3125, 16807}{32, 243, 25, 125, 49, 343}
{4, 8, 243, 3125, 49, 343}{32, 9, 27, 25, 125, 16807} {4, 8, 243, 3125, 16807}{32, 9, 27, 25, 125, 49, 343}
7. Find all natural numbers of the form n + 3n + 1 which terminate in 2021 (where n ∈ N0 ).
2
10000
Solution: These numbers are the solutions of the congruence equation n2 + 3n + 1 = 2021, i.e.
n = m + 10000k where m = 2732, 4140, 5857, 7265 and k ∈ N0 .
8. Propose a simple way for the prime factorization of factorials (which should be very useful, and possibly
the only practical way, for the prime factorization of very large factorials).
Solution: We propose using the formula of the highest power of a prime p that divides n! (see Eq. 83
in V1) where p represents all the primes which are less than or equal to n. These calculations can be
easily done using a spreadsheet or a few lines of computer code. For example, let us find the prime
factorization of 123!.
On using the aforementioned formula (with p representing all the 30 primes which are less than 123,
i.e. 2, 3, 5, . . . , 107, 109, 113) we obtain the following prime factorization:
123! = 2117 × 359 × 528 × 719 × 1112 × 139 × 177 × 196 × 235 × 294 × 313 × 373 × 413 × 432 × 472 × 532 ×
592 × 612 × 67 × 71 × 73 × 79 × 83 × 89 × 97 × 101 × 103 × 107 × 109 × 113.
9. Propose a simple way for calculating the number of digits of factorials (which should be very useful,
and possibly the only practical way, for calculating the number of digits of very large factorials).
Solution: The simplest way is to use the rules of logarithms, that is:
n
! n
Y X
log10 (n!) = log10 k = log10 (k)
k=1 k=1

where the latter sum can be easily calculated using a spreadsheet or a few lines of computer code.
Hence, the number of digits in n! is: $ n %
X
log10 (k) + 1
k=1
For example, the number of digits of 1000! is:
$1000 %
X
log10 (k) + 1 = ⌊2567.604644⌋ + 1 = 2568
k=1

10. What is the number of digits in b


5?
Solution: We have:
32 9
b
5 ≡ 54 = 54 = 5262144
2 MISCELLANEOUS 42

Hence, the number of digits in b


5 is:
j k
log10 b
5 + 1 = ⌊262144 × log10 5⌋ + 1 = ⌊183230.7928⌋ + 1 = 183231

11. What is the number of digits in Prn and Crn (where Prn is the number of permutations and Crn is the
binomial coefficient).
Solution: Regarding Prn we have:

n!
Prn = = n × (n − 1) × · · · × (n − r + 1)
(n − r)!

Hence, the number of digits of Prn is:


$ n
%
X
log10 (k) + 1
k=n−r+1

723
For example, the number of digits of P288 is:
$ 723
% $ 723 %
X X
log10 (k) + 1 = log10 (k) + 1 = ⌊794.448⌋ + 1 = 795
k=723−288+1 k=436

Regarding Crn we have:

n! n × (n − 1) × · · · × (n − r + 1)
Crn = =
r!(n − r)! r!

Hence, the number of digits of Crn is:


$ n r
%
X X
log10 (k) − log10 (k) + 1
k=n−r+1 k=1

2109
For example, the number of digits of C1562 is:
$ 2109 1562
%
X X
log10 (k) − log10 (k) + 1 = ⌊4834.723 − 4312.157741⌋ + 1 = ⌊522.566⌋ + 1 = 523
k=548 k=1

12. Find every 10-digit integer the sum of its digits is equal to the product of its digits.
Solution: Let S be the sum of digits and P the product of digits. We have 3 main cases:
• S = P = 0: since P = 0 then at least one of the digits must be 0 and hence all the digits must be 0
so that S = 0. So, we have only one possibility which is 0000000000.
• S = P = 16: we have 1111111144 and its permutations which are 45 in total.[30]
• S = P 6= 0, 16: we have no 10-digit integer that satisfies this condition because no factorization of P
(noting that 1 ≤ S ≤ 90 excluding 16) can satisfy the condition S = P .
So, we have 45 permutations of 1111111144 as well as 0000000000, i.e. 46 such integers. Now, if we
consider the negatives of the 45 permutations of 1111111144 then we should have 91 such integers.
13. Identify (or characterize) the integers which have the following number of positive divisors (exactly):
(a) Infinitely many. (b) Zero. (c) One. (d) Two. (e) Three. (f ) Four. (g) Five.
Solution:
(a) Only 0 (because 0 can be divided by any other integer).
(b) None (because any integer can be divided at least by 1).
[30] The 10!
permutations of eight 1’s and two 4’s are given by the multinomial coefficient 2! 8!
= 45.
2 MISCELLANEOUS 43

(c) Only ±1 (because if a|b and b 6= 0 then |a| ≤ |b| and hence ±1 can be divided only by 1 noting that
any other non-zero integer can be divided by 1 and by its absolute value).
(d) Primes (because by definition a prime number can be divided only by 1 and itself).
(e) Squares of primes (because the divisors of p2 where p ∈ P are only 1, p and p2 ).
(f ) Cubes of primes (because the divisors of p3 where p ∈ P are only 1, p, p2 and p3 ). Also, composite
numbers of the form p1 p2 where p1 , p2 ∈ P and p1 6= p2 (because the divisors of p1 p2 are only 1, p1 , p2
and p1 p2 ).
(g) Fourth powers of primes (because the divisors of p4 where p ∈ P are only 1, p, p2 , p3 and p4 ).
14. Find all x, y ∈ Z such that xy = y x .
Solution: An obvious solution is x = y. So, in the following we search for solutions where x 6= y.
In Problem 5 of § 7.3 we find that xy > y x for all 2 < x < y. We also find that xy < y x when
(x, y) = (1, y) where N ∋ y > 1. So, assuming x, y ∈ N and x < y, the only possibility for xy = y x
is for x = 2, that is: 2y = y 2 whose only solution (assuming x 6= y) is y = 4. So, another solution
to xy = y x is (x, y) = (2, 4). Now, if we lift the restriction that x < y (noting the symmetry in
x, y) as well as the restriction that x, y ∈ N (noting that 2 and 4 are even) then we get three more
solutions, i.e. (x, y) = (4, 2), (−2, −4), (−4, −2). So in brief, the solutions of xy = y x (where k ∈ Z) are:
(x, y) = (k, k) (x, y) = (2, 4) (x, y) = (4, 2) (x, y) = (−2, −4) (x, y) = (−4, −2)
15. Conduct an initial check on the following integers to see if they can be perfect numbers or not:
(a) 348923082239. (b) 5762859329434. (c) 116398323238.
Solution:
(a) All known perfect numbers (up to very large integers) are even and hence this cannot be a perfect
number because it is odd.
(b) All even perfect numbers end in 6 or 8 (see point 6 of § 2.8 of V1) and hence this cannot be a
perfect number because it ends in 4.
(c) All even perfect numbers (excluding 6) end in 16, 28, 36, 56, 76, or 96 (see point 7 of § 2.8 of V1)
and hence this cannot be a perfect number because it ends in 38.
16. Show that xy = yz = xz iff x = y = z (where Z ∋ x, y, z 6= 0).[31]
Solution: Regrading the if part, if x = y = z then xy = 1, yz = 1 and xz = 1 and hence xy = yz = xz = 1.
Regrading the only if part, we prove this part by contraposition where we first consider the case of
x, y, z ∈ N. So, let assume that the triple equality x = y = z does not hold. This means that one of
the variables x, y, z must be greater than another one of these variables. So, let assume (without loss of
generality since it is a matter of labeling) that x is the greater variable. Hence, (with a proper labeling
of y and z) we have one of the following three cases:
• x = y > z and hence xy 6= yz since xy = 1 while yz > 1.
• x > y = z and hence xy 6= yz since xy > 1 while yz = 1.
• x > y > z and hence xy 6= xz since xy > 1 while xz < 1.
So, in all cases the triple equality xy = yz = xz does not hold if the triple equality x = y = z does
not hold, and hence by contraposition the triple equality x = y = z does hold if the triple equality
x y z x y z
y = z = x does hold, i.e. if y = z = x then x = y = z.
We finally need to extend from x, y, z ∈ N to Z ∋ x, y, z 6= 0. Now, we have four cases:
• All x, y, z are greater than 0: this is the case of x, y, z ∈ N which is already considered.
• All x, y, z are less than 0: this is equivalent to the previous case because the minus sign will be
canceled (or rather it has no effect because the ratio of two positive numbers is the same as the ratio
of their negatives).
• Only one of x, y, z is less than 0: so assume (with no loss of generality) that x < 0 and hence xy and
z y
x are negative while z is positive and hence they cannot be equal.
• Only one of x, y, z is greater than 0: so assume (with no loss of generality) that x > 0 and hence xy
and xz are negative while yz is positive and hence they cannot be equal.
Hence, the proposition applies to all Z ∋ x, y, z 6= 0 and not only to x, y, z ∈ N.

[31] The purpose of such “trivial” questions is to learn systematic investigation and analysis.
Chapter 3
Primes, Composites and Coprimes
1. Find all prime numbers of the following forms:
(a) n3 + 3n2 + 5n + 6 (n ∈ Z). (b) 3n ± 1 (n ∈ N0 ). (c) 4n+2 + 2n (n ∈ N0 ).
Solution:
3
(a) This expression is divisible by 3 for all n ∈ Z (noting that n3 + 3n2 + 5n + 6 = 0 identically). Hence,
it is composite except if it is equal to 0 (which is neither composite nor prime) or 3 (which is prime).
So, if this expression is to be prime then we must have n3 + 3n2 + 5n + 6 = 3 for some n ∈ Z. This
equation has a solution n = −1 and hence 3 is the only prime number of this form (corresponding to
n = −1).
(b) 3n ± 1 is even for all n ∈ N0 and hence it is prime only when it is equal to 2 (corresponding to
n = 0 for 3n + 1 and to n = 1 for 3n − 1).
(c) 4n+2 + 2n is even and greater than 2 for all n ∈ N0 except when n = 0 where it is equal to 17.
Hence, 17 is the only prime number of this form (corresponding to n = 0).
2. Find all prime numbers of the following forms: aa, abab, abcabc, abcdabcd, abcdeabcde, abcdef abcdef
(where a, b, c, d, e, f are digits and a 6= 0).
Solution: All integers of the form aa are divisible by 11 and hence they are all composite except 11
itself. Regarding the other forms we have:
abab = 101 × ab abcabc = 1001 × abc abcdabcd = 10001 × abcd
abcdeabcde = 100001 × abcde abcdef abcdef = 1000001 × abcdef
Hence, they are all composite. So, the only prime of the given forms is 11.
3. Let n = 9m + 6 (m ∈ N) and τ (n) = 4 (where τ is the tau function). Show that 3m + 2 is prime.
Solution: We have:[32]
k
Y
τ (n) = (ai + 1) = 4 = 2 × 2
i=1
i.e. k = 2 and a1 = a2 = 1. This means that n is square free with two prime factors, that is:
n = 9m + 6 = 3(3m + 2) = 3p where p = 3m + 2 is prime.
4. Investigate the prime numbers of the following form:
n times
z }| {
p = m . . . mm (m, n ∈ N, n > 1)
where mm means concatenation not multiplication
Solution: If k is the number of digits of m then we can write:
p = 10k(n−1) m + · · · + 10k m + 100 m = m(10k(n−1) + · · · + 10k + 100 )
This is obviously composite if m > 1 since (10k(n−1) + · · · + 10k + 100 ) > 1 (noting that n > 1). Hence,
to have a prime we must have m = 1 and thus p = (10n−1 + · · · + 101 + 100 ) = 1 . . . 11. Now, for n = 2
we have 1 . . . 11 = 11 which is prime. Regarding n > 2, if n is even then 1 . . . 11 is divisible by 11 (see
rule 33 of § 1.9 of V1), while if n is a natural multiple of 3 then 1 . . . 11 is divisible by 3 (see rule 25 of
§ 1.9 of V1) and hence they cannot be prime. In fact, the primality of the natural numbers of the form
1 . . . 11 is a research issue. Those who are interested in further details should refer to the problem of
repunit numbers (i.e. repeated unit numbers such as 11, 111, 1111) in the literature noting that there
are several known repunit primes (other than 11).
[32] We note that n = p3 is not a possibility because p3 = 9m + 6 (i.e. 3m + 2 = 9) has no solution.

44
3 PRIMES, COMPOSITES AND COPRIMES 45

5. Find all p such that p, 11p3 + 2 and 5p3 + 4 are primes.


Solution: p = 2 is not a possibility (because 11p3 + 2 and 5p3 + 4 will be even). Similarly, p = 3 is not
a possibility (because 11p3 + 2 = 299 which is composite). So, let us investigate p > 3. It is obvious
3
that for p > 3 we have p 6= 0 because p cannot be divisible by 3 (since p is supposedly prime). So,
3 3
either p = 1 or p = 2:
3 3
• If p = 1 then 5p3 + 4 = 0 and hence 5p3 + 4 is not prime.
3 3
• If p = 2 then 11p3 + 2 = 0 and hence 11p3 + 2 is not prime.
So in brief, there is no p such that p, 11p3 + 2 and 5p3 + 4 are primes.
6. Find all composite numbers of the following forms (where n ∈ Z):
(a) n2 − 2n + 1. (b) n! + 5. (c) n5 + 1.
Solution:
(a) We have n2 − 2n + 1 = (n − 1)2 . Now, for n = 0 and n = 2 we have (n − 1)2 = 1 which is not
composite. Similarly, for n = 1 we have (n − 1)2 = 0 which is not composite. For all other n ∈ Z,
(n − 1)2 is a product of two integers whose magnitude is > 1 and hence it is composite. So in brief,
(n2 − 2n + 1) is composite for all n ∈ Z excluding n = 0, 1, 2.
(b) We note first that n! is defined only for n ∈ N0 . Now, it is obvious that n! + 5 is divisible by 5 for
all n > 4 and hence it is composite for all these values of n. So, all we need is to inspect n! + 5 for
n = 0, 1, 2, 3, 4. Now, for n = 0, 1, 2, 3, 4 we have n! + 5 = 6, 6, 7, 11, 29. So in brief, n! + 5 is prime for
n = 2, 3, 4 and composite for all other n ∈ N0 .
(c) From Eq. 11 of V1 we can see that (n5 + 1) is composite for all n < −2 and n > 1. So, all we need
is to inspect (n5 + 1) for n = −2, −1, 0, 1. Now, for n = −2, −1, 0, 1 we have n5 + 1 = −31, 0, 1, 2. So
in brief, (n5 + 1) is composite for all n ∈ Z excluding n = −2, −1, 0, 1.[33]
7. Show that there are no prime numbers of the following forms (where m, n ∈ Z):
(a) n2 − 2n + 1. (b) n5 − 15n3 + 4n + 20. (c) 6m3 − 19m2 n + 19mn2 − 6n3 .
Solution:
(a) This is a consequence of part (a) of Problem 6 (noting that by definition 0 and 1 are not prime
numbers).
5
(b) This expression is divisible by 5 for all n ∈ Z (noting that n5 − 15n3 + 4n + 20 = 0 identically).
Moreover, this expression is not equal to 0 or 5 (which are the only non-composite numbers divisible
by 5)[34] for any n ∈ Z. Therefore, this expression is always composite and hence it cannot represent a
prime.
(c) Let f (m, n) = 6m3 − 19m2 n + 19mn2 − 6n3 and hence we have:

f (m, n) = 6m3 − 6n3 − 19m2 n + 19mn2 = 6(m3 − n3 ) − 19(m2 n − mn2 )


 
= 6(m − n)(m2 + mn + n2 ) − 19mn(m − n) = (m − n) 6(m2 + mn + n2 ) − 19mn
= (m − n)(6m2 − 13mn + 6n2 ) = (m − n)(3m − 2n)(2m − 3n)

Now, a prime number p can be factorized as a product of three integer factors only in 3 different ways,
i.e.
p = (1)(−1)(−p) = (1)(1)(p) = (−1)(−1)(p)
So, if f = p then we have 3 cases to consider:
First case: f = (1)(−1)(−p) and hence one of the factors (m − n), (3m − 2n), (2m − 3n) must be equal
to 1 and another factor of these must be equal to −1. So, if we consider the 6 systems of simultaneous
equations obtained from equating (m − n), (3m − 2n), (2m − 3n) to 1 combined with the equations
obtained from equating (m − n), (3m − 2n), (2m − 3n) to −1 (noting that a single factor cannot be

[33] We should note that if “composite” is restricted (by definition) to natural numbers (see § 2.2. of V1) then we should
exclude all the negatives. We may also add: n5 + 1 is prime for n = 1 and neither prime nor composite for n = −2, −1, 0
(noting the sign of −31 in the case of n = −2).
[34] If we consider −5 as well (by ignoring the sign) then we can also confirm that this expression is not equal to −5.
3 PRIMES, COMPOSITES AND COPRIMES 46

equal to 1 and −1 at the same time) then we can identify m and n values
 that can possibly make
 f = p.
These 6 systems with their solutions and the corresponding values of f in the form (m, n, f ) are given
in the following table:
m − n = 1 3m − 2n = 1 2m − 3n = 1
m − n = −1 (3, 4, 6) (−4, −3, 6)
3m − 2n = −1 (−3, −4, −6) (−1, −1, 0)
2m − 3n = −1 (4, 3, −6) (1, 1, 0)
As we see, f = 0, ±6 in this case and hence it is not prime.
Second case: f = (1)(1)(p) and hence if we follow the argument and procedure of the first case then
we get the following table (where NS means “No Solution”):
m − n = 1 3m − 2n = 1 2m − 3n = 1
m−n=1 (−1, −2, 4) (2, 1, 4)
3m − 2n = 1 NS
2m − 3n = 1
As we see, f = 4 in this case and hence it is not prime.
Third case: f = (−1)(−1)(p) and hence if we follow the argument and procedure of the first case then
we get the following table:
m − n = −1 3m − 2n = −1 2m − 3n = −1
m − n = −1 (1, 2, −4) (−2, −1, −4)
3m − 2n = −1 NS
2m − 3n = −1
As we see, f = −4 in this case and hence it is not prime.
So, in all cases f cannot represent a prime number and hence there are no prime numbers of the given
form.
8. Show that the gap between two successive prime numbers can be arbitrarily large.
Solution: It was shown in Problem 8 of § 6.15 of V1 that for any n ∈ N there are n consecutive
composite numbers. This implies that the gap between prime numbers can be arbitrarily large. So,
although there is a lower limit on the size of the gap between two successive prime numbers (i.e. 1 in
the case of twin primes noting the exception of 2, 3) there is no upper limit on the size of this gap.
9. Determine if the following pairs of polynomials are coprime for all n ∈ N, or coprime for none of n ∈ N,
or coprime for only some of n ∈ N:
(a) 2n2 − 1 and 5n2 − 3. (b) 4n3 − 1 and 7n4 + 5. (c) n5 + 10n4 − n = 0 and 3n9 − n.
Solution:
(a) By Bezout theorem we have:
gcd(2n2 − 1, 5n2 + 3) = 5(2n2 − 1) − 2(5n2 − 3) = 1
Thus, these polynomials are coprime for all n ∈ N.
(b) For example, these polynomials are coprime for n = 2 and not coprime for n = 1. Thus, these
polynomials are coprime for only some of n ∈ N.
(c) These polynomials are even for all n ∈ N and hence they are coprime for none of n ∈ N.
10. Find all p, q ∈ P such that 5p2 − 8pq + 11q 2 = 1175.
Solution: If we treat this equation as a quadratic in p with a discriminant ∆ then we have:
r
23500
∆ = 64q 2 − 20(11q 2 − 1175) = −156q 2 + 23500 ≥ 0 → q≤ ≃ 12.27
156
So, we need to consider only q = 2, 3, 5, 7, 11. On substituting these values in the given equation and
solving for p (accepting only prime values for p) we get: (p, q) = (2, 11) which is the only solution to
this Problem.
11. Find all p, q, r ∈ P such that:
(a) p(q − r) = 2(q + r). (b) p(q + r) = 5(q − r).
3 PRIMES, COMPOSITES AND COPRIMES 47

Solution:
(a) It is obvious that q 6= r because 2(q + r) > 0. Also, p 6= 2 because q − r 6= q + r (since it leads to
r = 0). So, p is an odd prime. Moreover, (q − r) must be even (because of the 2 on the RHS) and hence
both q and r are odd primes. So in brief, p, q, r are odd primes. Rewriting the equation as (noting that
q + r is even and p is odd):
2(q + r)
p=
q−r
we conclude that (q − r) is a multiple of 4. So, based on this equation we can write:
p(q − r) p 4 (pa1 1 . . . pakk )
q − r = 4 (pa1 1 . . . pakk ) q+r = = = 2p (pa1 1 . . . pakk )
2 2
Now:
• If we add these equations we get:
2q = 4 (pa1 1 . . . pakk ) + 2p (pa1 1 . . . pakk ) → q = (pa1 1 . . . pakk ) (2 + p) → pa1 1 . . . pakk = 1 →
q =2+p → p=q−2
where step 2 is because if q = pa1 1 . . . pakk (noting that q is prime) then 2 + p = 1 (i.e. p = −1) which is
impossible.
• If we subtract these equations we get:
2r = 2p (pa1 1 . . . pakk ) − 4 (pa1 1 . . . pakk ) → r = (pa1 1 . . . pakk ) (p − 2) → pa1 1 . . . pakk = 1 →
r =p−2 → p=r+2
a1 ak
where step 2 is because if r = p1 . . . pk (noting that r is prime) then p − 2 = 1 (i.e. p = 3) which is
impossible because q will be 5 (since p = q − 2) and hence r = 1 (which is nonsensical since r is prime).
So in brief, we have p = q − 2 and p = r + 2. Now, if we remember that 5 is the only prime number
that is shared by two different pairs of twin primes (see point 3 in the preamble of § 2.2.1 of V1), then
we can conclude that (p, q, r) = (5, 7, 3) which is the only solution to the given equation.
(b) If we write this equation as 5(q − r) = p(q + r) and compare it to the equation of part (a) noting
its unique solution then we can conclude that (p, q, r) = (2, 7, 3). However, let assume that we do not
have part (a) and its solution and hence we solve this equation from scratch.
It is obvious that q > r (since the LHS is > 0). Now, since (q + r) > (q − r) then p < 5 and hence we
have only two possibilities:
• p = 2 and hence we have 2(q + r) = 5(q − r) which simplifies to 3q = 7r. So, 3 divides r and hence
r = 3 (noting that r is prime) and q = 7. Thus, we have the solution (p, q, r) = (2, 7, 3).
• p = 3 and hence we have 3(q + r) = 5(q − r) which simplifies to q = 4r, i.e. q is composite and hence
it is unacceptable.
Accordingly, the only solution to the given equation is (p, q, r) = (2, 7, 3).
12. Find solutions to the following equation: p2 (q − r) = 12(q + r) where p, q, r ∈ P.
Solution: p 6= 2 because 4(q − r) < 12(q + r). p 6= 3 because 9(q − r) < 12(q + r). Hence, p is an odd
prime ≥ 5.
On comparing the two sides of the given equation we must have:
q − r = 12 (pa1 1 . . . pakk ) q + r = p2 (pa1 1 . . . pakk )
On adding and subtracting these equations we get:
(p2 + 12) (pa1 1 . . . pakk ) (p2 − 12) (pa1 1 . . . pakk )
q= r=
2 2
Now, since p is odd then p2 +12 and p2 −12 are odd (i.e. they are not divisible by 2) and hence 2 divides
pa1 1 . . . pakk . Moreover, since p2 + 12 and p2 − 12 are greater than 1 (since p ≥ 5) then pa1 1 . . . pakk must
be equal to 2 (noting that q and r are primes). Therefore, we must have q = p2 + 12 and r = p2 − 12.
On inspecting the low values of p we found the following solutions, i.e. (p, q, r):
(5,37,13) (7,61,37) (13,181,157) (19,373,349) (29,853,829) (41,1693,1669) (61,3733,3709)
3 PRIMES, COMPOSITES AND COPRIMES 48

13. Investigate the prime numbers of the following forms (where n ∈ N):
(a) n2 − 1. (b) n2 + 1. (c) n3 − 1. (d) n3 + 1. (e) n2 − 2.
Solution:
(a) n2 − 1 = (n − 1)(n + 1) which is composite for all n > 2. For n = 1 we have n2 − 1 = 0 (which is
not prime), while for n = 2 we have n2 − 1 = 3 (which is prime). So, the only prime of the form n2 − 1
is 3.
(b) There are many primes of the form n2 + 1 (e.g. 2, 5, 17) and it is conjectured that there are
infinitely many primes of this form.
(c) n3 − 1 = (n − 1)(n2 + n + 1) and hence it is composite for all n > 2. For n = 1 we have n3 − 1 = 0
(which is not prime), while for n = 2 we have n3 − 1 = 7 (which is prime). So, the only prime of the
form n3 − 1 is 7.
(d) The only prime of the form n3 + 1 is 2 (corresponding to n = 1) because n3 + 1 = (n + 1)(n2 − n + 1)
which is composite for all n > 1.
(e) If n is even then the only prime of this form is 2 (corresponding to n = 2) because n2 − 2 is even.
If n is odd then we have many primes of this form (e.g. 7, 23, 47) and it is conjectured that there are
infinitely many of them.
14. Show that any divisor of a Mersenne number Mp = 2p − 1 (where p is an odd prime) is of the form
2kp + 1 (where k ∈ N).
Solution: Let q be a prime number dividing Mp (and hence q is odd since Mp is odd). Now, by
Fermat’s little theorem we have q|(2q−1 − 1). Moreover:

gcd(2p − 1, 2q−1 − 1) = 2gcd(p,q−1) − 1 (see Problem 2 of § 13)

Noting that q supposedly divides both 2p −1 and 2q−1 −1, q must divide their gcd which is 2gcd(p,q−1) −1
(see Problem 10 of § 2.4 of V1). Now, since q is an odd prime then gcd(p, q − 1) > 1 which implies
gcd(p, q − 1) = p, i.e. p is a factor of q − 1 and hence p|(q − 1). So, we can write q − 1 = sp where s must
be an even natural number because q − 1 is even (noting that q is an odd prime as indicated earlier and
because p divides q − 1). Hence, we can write q = 2kp + 1 (where k ∈ N). This means that any prime
divisor of Mp is of the form 2kp + 1. However, this should apply even to the composite divisors of Mp
because the composite divisor is a product of prime factors where each one of these prime factors is of
the form 2kp + 1 and hence their product must be of this form, e.g.

(2k1 p + 1)(2k2 p + 1) = 4k1 k2 p + 2k1 p + 2k2 p + 1 = 2(2k1 k2 + k1 + k2 )p + 1

Note 1: the theorem of this Problem can be used to prove that there are infinitely many primes because
if there are only finitely many primes with p being the largest of them then Mp (which must be greater
than p) is composite. However, according to the theorem of this Problem any prime divisor of Mp must
be of the form 2kp + 1 which must be greater than p in contradiction to the claim that p is the largest
prime.[35]
Note 2: the theorem of this Problem is very useful for the search of Mersenne primes (or composites)
since it can be used to accelerate the search for Mersenne primes. The idea is that Mersenne numbers
which are composite are divisible only by factors of the form 2kp + 1. This restriction on the form
of divisors limits the possibilities of potential divisors substantially, i.e. if a Mersenne number is not
divisible by any factor of the form 2kp + 1 then it must be prime (otherwise it is composite). This will
be illustrated in Problem 15.

[35] Itis worth noting that we can find many proofs in the literature about the infinitude of primes, e.g. the proof of Euclid
which we discussed in Problem 12 of § 2.2 of V1 and the proof about the coprimality of Fermat numbers which we
discussed in Problem 7 of § 2.2.3 of V1 (as well as the proof indicated in the present note; also see Problem 18). These
proofs can be classified as direct proofs (i.e. they are intended to prove the infinitude of primes; e.g. the proof of Euclid)
and indirect proofs (i.e. they are intended to prove something else but their outcome implies the infinitude of primes;
e.g. the proof of Problem 7 of § 2.2.3 of V1 and the proof of the present note). In fact, some of the proofs of propositions
about the infinitude of primes of certain forms and types are also proofs of the infinitude of primes (assuming that these
proofs do not presume the infinitude of primes or based on such presumption).
3 PRIMES, COMPOSITES AND COPRIMES 49

15. Determine if the following Mersenne numbers are prime or composite: M17 and M23 . √
Solution: Regrading M17 , we need to test only the primes of the form 34k+1 which are < M17 ≃ 362,
i.e. p = 103, 137, 239, 307. None of these primes divides M17 and hence M17 is a Mersenne
√ prime.
Regrading M23 , we need to test only the primes of the form 46k + 1 which are < M23 ≃ 2896. The
first of these primes is 47 which divides M23 and hence M23 is a composite Mersenne number (with no
need for doing more tests).
16. Let m and n be coprime integers. Show that 2m + n and 3m + 2n are coprime.
Solution: Let A = 2m + n and B = 3m + 2n. Accordingly:
2A − B = m and 2B − 3A = n
Now, if we note that m and n are coprime and we use the rules of gcd (as given in the preamble of §
2.4 of V1) then we have:

1 = gcd(m, n) = gcd(2A − B, 2B − 3A) = gcd(B − 2A, 2B − 3A)


= gcd(B − 2A, [2B − 3A] − [B − 2A]) = gcd(B − 2A, B − A)
= gcd(B − 2A, [B − A] − [B − 2A]) = gcd(B − 2A, A) = gcd(2A − B, A) = gcd([2A − B] − A, A)
= gcd(A − B, A) = gcd([A − B] − A, A) = gcd(−B, A) = gcd(B, A) = gcd(A, B)

i.e. 2m + n and 3m + 2n are coprime.


17. Show that any multi-digit twin primes (i.e. excluding 3,5 and 5,7) must end with 1 and 3 (like 11,13)
or with 7 and 9 (like 17,19) or with 9 and 1 (like 29,31).
Solution: A multi-digit integer whose last digit is 0, 2, 4, 5, 6, 8 must be composite because it is either
even (> 2) or divisible by 5 (> 5). Hence, the last digit of any multi-digit prime must be 1, 3, 7, 9. Now:
• If a prime ends in 1 then its potential twin must end either in 9 or in 3, and both these possibilities
are acceptable (because the potential twin ends with an acceptable last digit of a prime).
• If a prime ends in 3 then its potential twin must end either in 1 (which is considered in the previous
point) or in 5 (which is not acceptable because the “twin” is divisible by 5).
• If a prime ends in 7 then its potential twin must end either in 5 (which is not acceptable because the
“twin” is divisible by 5) or in 9 (which is acceptable because the twin ends with an acceptable last digit
of a prime).
• If a prime ends in 9 then its potential twin must end either in 7 or in 1 (where both these possibilities
are considered in the previous points).
18. Show the following (where n ∈ N):
(a) n! and n! + 1 have no common prime factor. (b) Any prime factor of n! + 1 is > n.
Solution:
(a) If n! and n! + 1 have a common prime factor then this factor will divide both of them and hence it
will divide their difference which is 1. This contradiction should prove the given proposition.
(b) If n! + 1 has a prime factor ≤ n then this prime factor will be common to both n! and n! + 1 which
contradicts the result of part (a).
Note: the result of part (b) is an indirect proof for the infinitude of primes because we can always find
a prime > n that divides n! + 1. Also see note 1 of Problem 14.
19. List some of the famous conjectures related to prime numbers.
Solution: For example:
• Goldbach conjecture which states: every even integer > 2 can be written as the sum of two primes.
• Twin primes conjecture which states: there are infinitely many twin primes.
• Mersenne primes conjecture which states: there are infinitely many Mersenne primes.
• The n2 + 1 conjecture which states: there are infinitely many primes of the form n2 + 1 where n ∈ N.
Chapter 4
Representation of Numbers
1. Show that if n ∈ Z is any integer multiple of 4 then n = 7xy − xyz for some x, y, z ∈ Z.
Solution: For example, if x = 1 and y = 4 then we have:
n = 7xy − xyz = xy(7 − z) = 1 × 4 × (7 − z) = 4(7 − z)
Now, if we note that (7 − z) can represent any integer then we can see that n can represent any integer
multiple of 4. This implies that if n is any integer multiple of 4 then we can always find x, y, z ∈ Z such
that n = 7xy − xyz.
2. Show that if p ∈ P is of the form p = 3n + 1 then it cannot be expressed as 2x2 + 3y 2 (where n, x, y ∈ N).
Solution: p is obviously greater than 3. Now, 2x2 + 3y 2 can be congruent (mod 3) only to 0 and 2.
However, since p is prime (and greater than 3) it cannot be congruent (mod 3) to 0. Also, if p is
3 3
congruent (mod 3) to 2 then we must have: 3n + 1 = 2 (i.e. 1 = 2) which is nonsensical. So, if
2 2
p = 3n + 1 then it cannot be expressed as 2x + 3y .
3. Give some examples of pairs (a, b) of distinct natural numbers such that ab is a perfect square and
a − 2b is a perfect (positive) cube.
Solution: This sort of problems can be easily solved computationally by writing a simple code or script
to search for examples of such pairs. However, let us try a more rational (or analytical) approach. Let
(for simplicity) assume that ab and a − 2b are natural powers of primes, i.e. ab = p2s and a − 2b = q 3t
(where p, q ∈ P and s, t ∈ N). Accordingly (noting that c, d ∈ N):
p=q=2 → a = 2c and b = 2d → a − 2b = 2c − 2d+1 →
a − 2b = 2d+1 (2c−d−1 − 1) → c−d−1=1 → c=d+2
Now, if we try d = 1, 2, 3, . . . we can find many examples. For instance, d = 2, 5, 8, 11, 14 produce the
following examples of (a, b) pairs:
(16, 4) (128, 32) (1024, 256) (8192, 2048) (65536, 16384)
In fact, every pair (a, b) = (24+3k , 22+3k ) where k ∈ N0 should meet the given requirement.
4. Find the smallest positive integer k which is equal to twice a cube (of an integer) and thrice a square
(of an integer).
Solution: We have k = 2m3 = 3n2 (m, n ∈ N). It is obvious that m is a multiple of 3 (and hence
m = 3µ where µ ∈ N) pwhile n is a multiple of 2 (and hence n = 2ν where ν ∈ N). Hence, we have
32 µ3 = 2ν 2 , i.e. ν = 9µ3 /2. Now, if we try the smallest values of µ then we find that µ = 2 yields
ν = 6 and hence k = 2(3 × 2)3 = 3(2 × 6)2 = 432.
5. Find all n ∈ Z such that:
(a) f (n) = n2 − n + 1 is a perfect square. (b) g(n) = n3 + 3n + 1 is a perfect cube.
(c) h(n) = n2 + 3n − 1 is a perfect square.
Solution:
(a) We have three main cases:
• n = 0, 1 and hence f (n) = 1 which is a perfect square.
• n < 0 and hence:
n2 < (n2 − n + 1) < (n − 1)2
which means that f (n) is not a perfect square (because there is no perfect square between two consec-
utive perfect squares).
• n > 1 and hence:
(n − 1)2 < (n2 − n + 1) < n2

50
4 REPRESENTATION OF NUMBERS 51

which means that f (n) is not a perfect square (as in the previous point).
So in brief, f (n) is a perfect square only for n = 0 and n = 1.
(b) If we follow the method of part (a) then we conclude that g(n) is a perfect cube only for n = 0
because:
(n − 1)3 < (n3 + 3n + 1) < n3 (for n < 0) & n3 < (n3 + 3n + 1) < (n + 1)3 (for n > 0)
noting that there is no perfect cube between two consecutive perfect cubes.
(c) Because h(n) is a perfect square, we have n2 + 3n − 1 = m2 (where m ∈ Z). Hence (noting that
N = 2n and M = 2m):
4n2 + 12n − 4 = 4m2 → 4n2 + 12n = 4m2 + 4 → N 2 + 6N = M 2 + 4 →
N 2 + 6N + 9 = M 2 + 13 → (N + 3)2 = M 2 + 13 → (N + 3)2 − M 2 = 13 →
(N + 3 − M )(N + 3 + M ) = 13 →
Noting that 13 = (−1)(−13) = (1)(13) and considering all the 4 possibilities (i.e. with regard to equat-
ing the factors on the two sides in both orders), we get 4 systems of equations in N and M . On solving
these systems we get: (N, M ) = (−10, −6), (−10, 6), (4,6), (4, −6). So, h(n) is a perfect square only
for n = −5 and n = 2 (corresponding to m2 = 9).
6. Find all x, y ∈ N0 such that x2 + 4y and y 2 + 4x are both perfect squares.
Solution: We have four cases to consider:
• x = y = 0 and hence (x, y) = (0, 0).
• x = 0 and y 6= 0, i.e. 4y and y 2 are perfect squares. Noting that 4 is a perfect square, any y = k 2
(k ∈ Z) is a valid solution. Hence, (x, y) = (0, k 2 ).
• x 6= 0 and y = 0: from the previous point (noting the symmetry) we have (x, y) = (k 2 , 0).
• x > 0 and y > 0 and hence:[36]
(x + 1)2 ≤ (x2 + 4y) → (x2 + 2x + 1) ≤ (x2 + 4y) → (2x + 1) ≤ 4y
Now, 2x+1 is odd while 4y is even and hence the equality is not possible. Accordingly, we must have:[37]
(x + 2)2 ≤ (x2 + 4y) → (x2 + 4x + 4) ≤ (x2 + 4y) → (x + 1) ≤ y
By a similar argument (or by symmetry) we must also have (y + 1) ≤ x. However, this contradicts
(x + 1) ≤ y because (x + 1) ≤ y implies x < y while (y + 1) ≤ x implies y < x. This contradiction
means that we have no solution in this case.
So in brief, x2 + 4y and y 2 + 4x are both perfect squares only for (x, y) = (0, k 2 ) and (x, y) = (k 2 , 0)
where k ∈ Z.
7. Let A ≡ x2 + y + z, B ≡ x + y 2 + z and C ≡ x + y + z 2 (where x, y, z ∈ Z). Show that A, B, C cannot
be perfect squares simultaneously if:
(a) All of x, y, z are > 0. (b) One of x, y, z is < 0 and the other two are > 0.
(c) Exactly one of x, y, z is 0.
Solution: We note first that no perfect square can lie between consecutive squares, i.e. the squares of
two consecutive integers. For example, if k is an integer then there is no perfect square between k 2 and
(k + 1)2 or between k 2 and (k − 1)2 .
(a) This is because x2 and (x + 1)2 are consecutive squares and hence if A is a perfect square then it
cannot lie between them. This similarly applies to B with regard to y 2 and (y + 1)2 and to C with
regard to z 2 and (z + 1)2 . Now, if we note that A, B, C are greater than x2 , y 2 , z 2 (respectively) then
we must have:
(x + 1)2 ≤ (x2 + y + z) → (2x + 1) ≤ (y + z)
[36] In this argument we are using the fact that no perfect square can lie between consecutive squares, i.e. the squares of two
consecutive integers. For example, if k is an integer then there is no perfect square between k2 and (k + 1)2 or between
k2 and (k − 1)2 . In brief, x2 < (x2 + 4y), moreover (x2 + 4y) cannot be between x2 and (x + 1)2 and hence we must
have (x + 1)2 ≤ (x2 + 4y).
[37] Again, we are using the fact that no perfect square can lie between consecutive squares, i.e. (x + 1)2 < (x2 + 4y),

moreover (x2 + 4y) cannot be between (x + 1)2 and (x + 2)2 and hence we must have (x + 2)2 ≤ (x2 + 4y).
4 REPRESENTATION OF NUMBERS 52

(y + 1)2 ≤ (x + y 2 + z) → (2y + 1) ≤ (x + z)
2 2
(z + 1) ≤ (x + y + z ) → (2z + 1) ≤ (x + y)

Now, if we add the three inequalities on the right (side by side) we obtain:

2(x + y + z) + 3 ≤ 2(x + y + z) → 3≤0

which is nonsensical. So, we conclude that A, B, C cannot be perfect squares simultaneously if all of
x, y, z are > 0.
(b) Noting the symmetry in the variables, it is sufficient to consider the case of x < 0 and y, z > 0.
Moreover, we can assume (with no loss of generality) that y ≤ z. Now, we have three cases:
• |x| < y and hence:

(x − 1)2 ≤ (x2 + y + z) → (−2x + 1) ≤ (y + z)


2 2
(y + 1) ≤ (x + y + z) → (2y + 1) ≤ (x + z)
(z + 1)2 ≤ (x + y + z 2 ) → (2z + 1) ≤ (x + y)

On adding the three inequalities on the right (side by side) and simplifying we obtain −4x + 3 ≤ 0
which is nonsensical noting that x < 0.
• y ≤ |x| ≤ z and hence:

(x − 1)2 ≤ (x2 + y + z) → (−2x + 1) ≤ (y + z)


2 2
(y − 1) ≤ (x + y + z) → (−2y + 1) ≤ (x + z)
(x + y + z 2 ) ≤ z2 → (x + y) ≤ 0

Now, the first inequality minus the second inequality plus the third inequality lead to 2y ≤ 0 which is
nonsensical noting that y > 0.
• |x| > z and hence:

(x − 1)2 ≤ (x2 + y + z) → (−2x + 1) ≤ (y + z)


2 2
(x + y + z) ≤ y → (x + z) ≤ 0
(x + y + z 2 ) ≤ z2 → (x + y) ≤ 0

On adding the three inequalities on the right (side by side) we obtain 1 ≤ 0 which is nonsensical.
So, we conclude that A, B, C cannot be perfect squares simultaneously if one of x, y, z is < 0 and the
other two are > 0.
(c) Let us assume that only x = 0 (noting that the cases of only y = 0 and only z = 0 can be obtained
from the case of only x = 0 due to the symmetry of A, B, C in the variables x, y, z). This means that
(y + z), (y 2 + z) and (y + z 2 ) are perfect squares. Now, y and z cannot be both < 0 because (y + z) is
supposedly a perfect square. So, we must have either y, z > 0 or one of y, z is > 0 and the other is < 0.
Accordingly:
• y, z > 0 and hence:

(y + 1)2 ≤ (y 2 + z) → (2y + 1) ≤ z
2
(z + 1) ≤ (y + z 2 ) → (2z + 1) ≤ y

On adding the two inequalities on the right (side by side) and simplifying we obtain (y + z + 2) ≤ 0
which is nonsensical noting that y, z > 0.
• y > 0 and z < 0 and hence:

(y 2 + z) ≤ (y − 1)2 → z ≤ (−2y + 1)
(z − 1)2 ≤ (y + z 2 ) → (−2z + 1) ≤ y
4 REPRESENTATION OF NUMBERS 53

On adding the two inequalities on the right (side by side) and simplifying we obtain −z ≤ −y which is
nonsensical noting that y > 0 and z < 0.
• y < 0 and z > 0: this is similar to the previous case (noting the symmetry).
So, we conclude that A, B, C cannot be perfect squares simultaneously if exactly one of x, y, z is 0.
8. Let A ≡ x2 + y + z, B ≡ x + y 2 + z and C ≡ x + y + z 2 (where x, y, z ∈ Z). Investigate (with regard to
the sign of x, y, z) the possibility of A, B, C being perfect squares simultaneously.
Solution: We have eight cases:
• All of x, y, z are 0: this is possible because 0 is a perfect square.
• Two of x, y, z are 0 and the other is positive: this is possible, i.e. (x, y, z) = (k 2 , 0, 0), (0, k 2 , 0),
(0, 0, k 2 ) where k ∈ Z.
• Two of x, y, z are 0 and the other is negative: this is impossible because (where we exploit the
symmetry to generalize the argument) if x < 0 and y = z = 0 then A is a perfect square but B and C
cannot be perfect squares because they are negative.
• Exactly one of x, y, z is 0: this is impossible (see part c of Problem 7).
• All of x, y, z are < 0: this is possible, e.g. (x, y, z) = (−3, −4, −4), (−2, −2, −2).
• Two of x, y, z are < 0 and the other is > 0: this is possible, e.g. (x, y, z) = (2, −2, −2).
• One of x, y, z is < 0 and the other two are > 0: this is impossible (see part b of Problem 7).
• All of x, y, z are > 0: this is impossible (see part a of Problem 7).
9. Find all a, b ∈ Z such that (a + b), (a2 + b), (a + b2 ) are all perfect squares.
Solution: According to part (c) of Problem 7 these cannot be perfect squares simultaneously if ab 6= 0.
So, the only possibility of these being perfect squares simultaneously is when ab = 0, i.e. (a, b) = (k 2 , 0)
and (a, b) = (0, k 2 ) where k ∈ Z.
10. Find all n ∈ Z such that 4n4 + 8n3 + 12n2 + 8n + 4 is a perfect square.
Solution: We have:
 
4n4 + 8n3 + 12n2 + 8n + 4 = 4 n4 + 2n3 + 3n2 + 2n + 1
  
= 4 n4 + 2n3 + 2n2 + n2 + 2n + 1
h 2 i
= 4 n2 + 2n2 (n + 1) + (n + 1)2
 2 2  2
= 4 n2 + (n + 1) = 22 n2 + n + 1 = 2 n2 + n + 1

Hence, 4n4 + 8n3 + 12n2 + 8n + 4 is a perfect square for all n ∈ Z.


11. Find all n ∈ Z such that the following expression is a perfect cube: n3 + 2n2 + n + 1.
Solution: We use in the following solution the fact that no perfect cube can lie between consecutive
cubes, i.e. the cubes of two consecutive integers. For example, if k is an integer then there is no perfect
cube between k 3 and (k + 1)3 or between k 3 and (k − 1)3 .
Let:

n3 < n3 + 2n2 + n + 1 < (n + 1)3


n3 < n3 + 2n2 + n + 1 < n3 + 3n2 + 3n + 1
0 < 2n2 + n + 1 < 3n2 + 3n + 1

The solution of the last inequality is n < −2 and n > 0. This means that n3 + 2n2 + n + 1 cannot be a
perfect cube if n < −2 or n > 0 because it is between two perfect cubes, and hence n3 + 2n2 + n + 1 can
possibly be a perfect cube only for n = −2, −1, 0. On testing these values we find that n3 + 2n2 + n + 1
is a perfect cube for all these values, (i.e. n = −2, −1, 0) and hence these are the solutions to our
Problem.
12. Find every integer n that has the following forms simultaneously: n = 5 + 14k, n = 3 + 23s and
n = 7 + 33t (where k, s, t ∈ Z).
Solution: We are required to solve the following system of simultaneous congruence equations:
14 23 33
n=5 n=3 n=7
4 REPRESENTATION OF NUMBERS 54

10626
The solution of this system (which can be obtained by the Chinese remainder theorem) is n = 2119.
So, every n = 2119 + 10626u (where u ∈ Z) meets the stated requirement.
13. Find all n ∈ N0 such that the following expressions are perfect cubes:
(a) n! + 5. (b) n! + 7. (c) n! − 14.
Solution:
7
(a) This is equivalent to solving the Diophantine equation m3 = n! + 5. Now, for n > 6 we have n! = 0
7 7
and hence m3 = 5. However, m3 = 5 has no solution. So, if there is any solution then we must have
0 ≤ n ≤ 6. On testing these values of n we find that only n = 5 is a solution. So, n! + 5 is a perfect
cube only for n = 5.
9
(b) This is equivalent to solving the Diophantine equation m3 = n! + 7. Now, for n > 8 we have n! = 0
9 9
and hence m3 = 7. However, m3 = 7 has no solution. So, if there is any solution then we must have
0 ≤ n ≤ 8. On testing these values of n we find that only n = 0, 1 are solutions. So, n! + 7 is a perfect
cube only for n = 0, 1.
4
(c) This is equivalent to solving the Diophantine equation m3 = n! − 14. Now, for n > 3 we have n! = 0
4 4
and hence m3 = −14. However, m3 = −14 has no solution. So, if there is any solution then we must
have 0 ≤ n ≤ 3. On testing these values of n we find that only n = 3 is a solution. So, n! − 14 is a
perfect cube only for n = 3.
14. Show that (n5 − 4) cannot be a perfect square for any n ∈ Z.
Solution: For n < 2 we have (n5 −4) < 0 and hence it cannot be a perfect square. Regarding n ≥ 2, we
note that being a perfect square is equivalent to m2 = n5 − 4 for some m ∈ Z. However, this equation
has no solution.[38] Hence, (n5 − 4) cannot be a perfect square for any n ∈ Z.
15. Find all the natural numbers which can be expressed as n3 + 5n − 1807 and end in 1121.
Solution: These numbers are the solutions of the following congruence equation:
10000
n3 + 5n − 1807 = 1121

The solutions of this equation are n = 32 + 10000k where k ∈ N0 (see § 3.2.1 of V1).
16. Show that every N ∋ n > 2 can be written as n = pk or as n = 4k (where p is an odd prime and k ∈ N).
Solution: If n is odd then n = pk (for some odd p ∈ P and k ∈ N).
If n is even then n = 2s (where s ∈ N). Now, if s is even then s = 2k and hence n = 4k, while if s is
odd then s = tp (where t ∈ N) and hence n = kp (where k = 2t). So, is all cases we can write n as
n = pk or as n = 4k.
17. Show that the sum of two odd squares cannot be a perfect square.
Solution: If m = 2s + 1 and n = 2t + 1 (where s, t ∈ Z) then:
4
m2 + n2 = 4s2 + 4s + 1 + 4t2 + 4t + 1 = 2

and hence it cannot be a perfect square because the residue of a square (mod 4) is either 0 or 1.
18. Show that any square of an odd number can be written as 8k + 1 where k ∈ N0 .
Solution: An odd number n can be written as n = 2s + 1 (where s ∈ Z) and hence:

n2 = (2s + 1)2 = 4s2 + 4s + 1 = 4(s2 + s) + 1 = 4(2k) + 1 = 8k + 1

where step 4 is because (s2 + s) is even (and ≥ 0).

[38] For 11
example, m2 = n5 − 4 has no solution and hence m2 = n5 − 4 has no solution (see § 2.7.6 of V1).
Chapter 5
Diophantine Equations
This chapter is essentially a continuation to our investigation of Diophantine equations (e.g. their types
and the methods of their solution) which we started in the first volume of this book. So, we mostly build
(and elaborate) on the material of the first volume about Diophantine equations.

5.1 General Issues about Diophantine Equations


1. It is useful (and recommended) to narrow the domain or/and range of solution when tackling a Dio-
phantine problem (and indeed any number theory or mathematical problem in general).[39] Try to
suggest some criteria and considerations that can help in narrowing the domain/range of solution (and
hence they should be considered in this effort).
Solution: The following is just a sample of the criteria and considerations that should be taken into
account in this context:
• Sign considerations: e.g. if the domain/range can be limited to positive or negative numbers.
• Parity considerations: e.g. if the domain/range can be limited to even or odd numbers (or even to
neither and hence we can conclude that there is no solution).
• Magnitude considerations, e.g. if the domain/range of solution has an upper or a lower limit or a
bounded interval.
• Obvious solutions considerations: e.g. considering the small integers (i.e. those in the neighborhood
of 0) solutions by using inspection and intuition.
• Special and limited cases considerations: e.g. solutions at 0 or infinity or in the absence of certain
variable(s).
• Algebraic manipulations and techniques considerations, e.g. factoring or division/multiplying by a
factor could reveal the impossibility or necessity of specific solutions.
Also see § 6.4.
2. Motivated by Problem 1, try to narrow the domain/range of solution of the following Diophantine
equation: 5x3 + 4y 3 − 9 = 0 (where x, y ∈ Z).
Solution: For example, the domain should be limited by the following restrictions (noting that 5x3 +
4y 3 = 9):
• At least one of x and y must be > 0.
• x = 0 is not a possibility (because 4y 3 = 32 has no solution).
• y = 0 is not a possibility (because 5x3 = 32 has no solution).
• x must be odd (to avoid parity violation).
From the first 3 points we conclude that we must have either x > 0 and y > 0, or x > 0 and y < 0, or
x < 0 and y > 0. Now:
If x > 0 and y > 0 then (from magnitude considerations) x and y cannot be > 1 and hence we must
have (x, y) = (1, 1, ) which is a valid solution.
If x > 0 and y < 0 then by simple inspection we may find (x, y) = (13, −14) which is another solution
(although this does not prove that there is no other solution of this kind).
If x < 0 and y > 0 then by inspection we do not find a solution of this kind (although this does not
prove that there is no such solution).
So in brief, this approach of narrowing and inspection can lead us to building the solution step by step
(with the possibility of reaching through this to a general logical/mathematical argument that proves

[39] Infact, narrowing the domain of solution does not only make the search for solution easier (by excluding certain
possibilities) but can lead to a clue or an insight about the solution or its nature.

55
5.1 General Issues about Diophantine Equations 56

that what we found is the entire solution).


3. A common approach for solving a Diophantine equation is to compare it to a similar equation whose
solutions are known or whose solutions are easier to obtain. Use this approach to infer the solutions of
the following Diophantine equations by comparing them to the solutions of 5x3 + 4y 3 − 9 = 0 which we
found in Problem 2:
(a) 5x3 − 4y 3 + 9 = 0. (b) 5x3 + 4y 3 + 9 = 0.
Solution:
(a) If we multiply the given equation by −1 we obtain 5(−x)3 + 4y 3 − 9 = 0. On comparing this
equation to the equation of Problem 2 we can easily conclude that the solutions of the given equation
that correspond to the two solutions found in Problem 2 are (x, y) = (−1, 1) and (x, y) = (−13, −14).
(b) If we multiply the given equation by −1 we obtain 5(−x)3 + 4(−y)3 − 9 = 0. On comparing this
equation to the equation of Problem 2 we can easily conclude that the solutions of the given equation
that correspond to the two solutions found in Problem 2 are (x, y) = (−1, −1) and (x, y) = (−13, 14).
Also see § 6.4.
4. What we mean by “solving a Diophantine equation”?
Solution: “Solving” (or “finding the solution”) of a Diophantine equation should mean proving (by an
irrefutable logical/mathematical argument) that there is no solution (i.e. when there is no solution) or
finding all the solutions (either explicitly or through a sort of closed form formula or formulae) with an
incontestable argument that there are no other solutions. So, a Diophantine equation is not solved, for
instance, by finding a number of solutions (e.g. through inspection or through computational search)
even if we know for sure that the equation has no other solutions.
5. Discuss initial sensibility checks and the importance of applying them when tackling a Diophantine
equation problem.
Solution: It is important (and highly recommended) to conduct initial (and basic) sensibility checks as
a first step in tackling a Diophantine equation problem before going through the process of solving the
problem in detail. The purpose of these checks is to assess the sensibility of the equation quickly (by
inspecting its general characteristics) to see if it is possible to have a solution or not. These initial checks
may also reveal the obvious solutions of the equation easily without effort or use of any complicated
treatment. In fact, applying an initial sensibility checks investigation can save a lot of time trying to
solve an equation that has no solution or has an obvious solution and hence it does not require any
effort to solve. In the following points we outline some of the most common initial sensibility checks:
• Parity checks: these should be regarded as the first item in the list of sensibility checks. This is
due to their simplicity and intuitivity. For example, if we are asked to find the general solution of
the Diophantine equation x4 + 4y 3 − 7x2 − 12y + 7 = 0 (where x, y ∈ Z) then before we try to solve
this equation by using the familiar rules and traditional methods of solving polynomial Diophantine
equations (in two variables) we should simply check the parity of this polynomial, and hence we can
easily conclude (by checking the parity) that this equation has no solution because the polynomial is
always odd and hence it cannot be equal to 0 which is even.
Parity checks can also reduce the possibilities that to be considered (or the domain or the range of
the problem). For example, the equation 18x + 16y = 19z (where x, y, z ∈ N0 ) can have a solution
(in principle) but because of parity considerations any potential solution must have either x = 0 (and
y 6= 0) or y = 0 (and x 6= 0). So, we have only these possibilities to consider which by simple inspection
should lead to the only solution, i.e. (x, y, z) = (1, 0, 1).
• Primality and composity checks: for example, if we conduct an initial primality check on the
Diophantine equation 12x2 + 99y 2 = 7159 (where x, y ∈ Z) then it should become obvious that this
equation has no solution because 7159 is prime while 12x2 + 99y 2 = 3(4x2 + 33y 2 ) which is composite
and hence they cannot be equal considering their prime factorization.
• Sign and magnitude checks: for example, the Diophantine equation 3x4 + y 2 + z! = 0 (where
x, y, z ∈ Z) has obviously no solution because 3x4 +y 2 cannot be negative and hence when it is added to
z! (which is always positive) the result cannot be zero. Similarly, it is fairly obvious that the Diophantine
equation x1 + y2 + z3 = 7 (where x, y, z ∈ Z and xyz 6= 0) has no solution because of a magnitude issue
5.2 Polynomial Diophantine Equations 57

(i.e. the left hand side cannot be greater than 6). Also, the equation 13x2 + 6y 2 + 5z 4 = 0 (where
x, y, z ∈ Z) has the obvious (and only) trivial solution (i.e. x = y = z = 0) because any sum of (positive
multiples of) even natural powers of integers must be a positive natural number unless all the integers
are 0.
4 4 2
• Simple divisibility checks: for example, it is fairly obvious that the equation  x +y −x − y 2 = 34
(where x, y ∈ Z) has no solution because the left hand side is divisible by 4 noting that x − x2 =
4

(x2 − x)(x2 + x) where both factors are even and this similarly applies to y 4 − y 2 while the right hand
side is not divisible by 4.
• Simple modularity checks: we mean by this using modular arithmetic rules and techniques to
inspect and test the solvability of the given Diophantine equation (where we largely exploit and benefit
from the rules that we outlined in § 2.7.6 of V1). For example, it should be fairly obvious (to someone
with modest experience in solving Diophantine equations) that the Diophantine equation 20x2 + 21y 2 =
22 (where x, y ∈ Z) has no solution because by a simple modularity inspection (i.e. via reducing the
5
equation in modulo 5) we find that this equation implies y 2 = 2 which obviously has no solution (because
2 is a quadratic non-residue of 5) and hence the original Diophantine equation is not solvable.[40]
Also see Problem 7 of § 6.1 as well as § 6.4.

5.2 Polynomial Diophantine Equations


1. Show that the Diophantine equation x2 − y 2 = z 3 has a solution (x, y) for any z (where x, y, z ∈ Z).
Solution: We have:
z 4 + 2z 3 + z 2 z 4 − 2z 3 + z 2 z 2 (z 2 + 2z + 1) z 2 (z 2 − 2z + 1)
z3 = − = −
4 4 4 4
 2  2
z(z + 1) z(z − 1)
= −
2 2

So, for any z ∈ Z we have x = z(z + 1)/2 and y = z(z − 1)/2 that satisfy this equation noting that
z(z + 1) and z(z − 1) are even . The obvious implication of this result is that any cube (of an integer)
can be expressed as a difference of two squares (of integers).[41]
2. Solve the following Diophantine equations (where x, y ∈ Z):
(a) x5 − 4x4 + 7x2 − 11y − 9 = 0. (b) 10x2 + 2x − 8y 2 = 0. (c) x + xy + y = 0.
(d) x4 + y 4 = 4096. (e) x5 − y 5 = 16807. (f ) x2 + 4x + y 2 − 14y + 48 = 0.
(g) x2 y − xy 2 − 13 = 0. (h) x2 + y 2 = 43275. (i) x2 − y 5 − 18 = 0.
Solution:
(a) If we write this equation as x5 −4x4 +7x2 −9 = 11y then we are looking for all x ∈ Z such that P (x) ≡
11 11
x5 − 4x4 + 7x2 − 9 is a multiple of 11. Now, P (x = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) = 2, 6, 9, 6, 4, 10, 8, 2, 4, 0, 4.
Therefore, x = 9 + 11k and y = P (9+11k)
11 and hence the solutions are (where k ∈ Z):

(x, y) = (9 + 11k, 14641k 5 + 54571k 4 + 80586k 3 + 58883k 2 + 21267k + 3033)

(b) It is obvious that x = y = 0 is a solution. So, in the following we consider non-trivial solutions. We
convert this equation to a Pell equation form (see § 1.2) by transforming x, that is:

[40] It is worth noting that we can consider parity checks (which we investigated in the first point) as an example of simple
modularity (or modular arithmetic) checks. In fact, we can consider parity checks as the simplest modularity checks
(since parity checks are based on the modular arithmetic of 2 which is the least modulo in modular arithmetic). However,
parity checks (unlike common modularity checks) are not limited to explicit modularity inspection and checks, and hence
from this perspective we may consider parity checks as more general than simple modularity checks.
[41] In fact, if we exclude z = 0 then we can make a more specific statement, i.e. any cube can be expressed as a difference

of two distinct squares.


5.2 Polynomial Diophantine Equations 58

10x2 + 2x − 8y 2 = 0 → 100x2 + 20x − 80y 2 = 0 → 100x2 + 20x + 1 − 1 − 80y 2 = 0 →


2 2 2 2
(10x + 1) − 1 − 80y = 0 → X − 80y = 1
√  
This is a Pell equation. Now, 80 = 8; 1, 16 . On inspecting the successive rational fraction approxi-
mations on the continued fraction ladder we find that the first approximation [8; 1] = 9/1 satisfies the
given equation (since 92 − 80 × 12 = 1) and thus (X1 , y1 ) = (9, 1). Now, to find the solutions (x, y) of
the original equation we need to use the reverse transformation, i.e. x = (X − 1)/10. However, the last
digit of Xn is 9 for odd n and 1 for even n (see § 1.2), and hence to have an integer solution for xn we
take xn = (−Xn − 1)/10 for odd n and xn = (Xn − 1)/10 for even n. Some of the solutions are:
n (Xn , yn ) (xn , yn )
1 (9, ±1) (−1, ±1)
2 (161, ±18) (16, ±18)
3 (2889, ±323) (−289, ±323)
4 (51841, ±5796) (5184, ±5796)
5 (930249, ±104005) (−93025, ±104005)
6 (16692641, ±1866294) (1669264, ±1866294)
(c) An obvious solution is (x, y) = (0, 0). Now, let xy 6= 0. If we divide by x and divide by y then we
get (respectively):
y x
1+y+ =0 +x+1=0
x y
i.e. x divides y and y divides x. Hence, y = ±x (see rule 9 of § 1.9 of V1) and thus:
1+y±1=0 ±1+x+1=0
Now, the +1 case leads to (x, y) = (−2, −2) while the −1 case leads to (x, y) = (0, 0) which is not
acceptable because of the assumption xy 6= 0 (noting that this solution is found already).
So in brief, the solutions are (x, y) = (0, 0) and (x, y) = (−2, −2).
(d) If we write this equation as x4 +y 4 = 84 then it should be obvious that this equation has no solution
in natural numbers (according to Fermat’s last theorem; see § 2.9.5 of V1). Now, if we note that the
power (i.e. 4) is even then it should also be obvious that this equation has no solution for any xy 6= 0.
So, we must have either x = 0 and y 6= 0 (and hence y = ±8) or x 6= 0 and y = 0 (and hence x = ±8).
So, the only possible solutions are: (x, y) = (0, ±8) and (x, y) = (±8, 0).
(e) We note first that 16807 = 75 Now, we have 6 cases to consider:
• x = y = 0: i.e. 0 − 0 = 16807 which is obviously impossible.
• x, y > 0: if we write this equation as x5 = y 5 + 75 then it is obvious that it has no solution (by
Fermat’s last theorem; see § 2.9.5 of V1).
• x, y < 0: if we write this equation as −|x|5 = −|y|5 + 75 (which is equivalent to |y|5 = |x|5 + 75 ) then
it is obvious that it has no solution (by Fermat’s last theorem).
• x > 0 and y < 0: if we write this equation as x5 + |y|5 = 75 then it is obvious that it has no solution
(by Fermat’s last theorem).
• x < 0 and y > 0: if we write this equation as −|x|5 − y 5 = 16807 then it is obvious that it has no
solution (noting that the LHS is negative while the RHS is positive).
• x = 0 and y 6= 0 (or x 6= 0 and y = 0): i.e. −y 5 = 16807 and hence y = −7 (or x5 = 16807 and hence
x = 7).
So in brief, we have only two solutions: (x, y) = (0, −7) and (x, y) = (7, 0).
(f ) We have:
x2 + 4x + y 2 − 14y + 48 = 0 → (x + 2)2 + (y − 7)2 = 5 → X2 + Y 2 = 5
Now, we have 8 solutions for (X, Y ), that is:
5 = (−2)2 + (±1)2 = (−1)2 + (±2)2 = (+1)2 + (±2)2 = (+2)2 + (±1)2
Hence, we have 8 solutions for (x, y), that is:
(−4, 6) (−4, 8) (−3, 5) (−3, 9) (−1, 5) (−1, 9) (0, 6) (0, 8)
5.2 Polynomial Diophantine Equations 59

(g) If we write this equation as x2 y − xy 2 = 13 then we can see that the LHS is always even while the
RHS is odd and hence this equation has no solution.
(h) The square of an integer is congruent (mod 4) either to 0 or to 1 and hence the LHS is congruent
(mod 4) to 0 or 1 or 2. Now, if we note that 43275 is congruent (mod 4) to 3 then it should be obvious
that this congruence has no solution.
(i) Let us write this equation as x2 − 18 = y 5 . Now, the residues of x2 − 18 (mod 11) are: 4, 5, 8,
2, 9, 7, 7, 9, 2, 8, 5 while the residues of y 5 (mod 11) are: 0, 1, 10, 1, 1, 1, 10, 10, 10, 1, 10. Hence,
11
x2 − 18 6= y 5 which implies that the equation has no solution (see § 2.7.6 of V1).
3. Solve the following Diophantine equations (where x, y ∈ Z):
(a) x3 + y 3 − x − y = 0. (b) x3 + y 3 + x + y = 0. (c) x3 + x2 − y 3 − y 2 = 0.
(d) x3 + y 3 + x2 + y 2 = 0. (e) x3 + y 3 − x2 − y 2 = 0. (f ) x2 − xy + 6x − y + 2 = 0.
Solution:
(a) We have:
(x3 + y 3 ) − (x + y) = 0 → (x + y)(x2 − xy + y 2 ) − (x + y) = 0 →
2 2
(x + y)(x − xy + y − 1) = 0
So, either x + y = 0 or x2 − xy + y 2 − 1 = 0. Hence, we have two cases:
• x + y = 0 and hence y = −x.
• x2 − xy + y 2 − 1 = 0 which is equivalent to (x − y)2 + xy − 1 = 0. Accordingly:
If (x − y)2 = 0 then x = y and hence xy = x2 = y 2 = 1, i.e. x = y = −1 or x = y = 1.
If (x − y)2 = 1 then xy = 0, i.e. x = y = 0 (which is inconsistent) or x = 0 (and hence y = ±1) or
y = 0 (and hence x = ±1).
If (x − y)2 > 1 then if we write the equation x2 − xy + y 2 − 1 = 0 as x2 + y 2 = xy + 1 then x and y
must have the same sign because otherwise the LHS will be greater than 1 (noting that the difference
between x and y must be greater than 1 in magnitude) while the RHS will not exceed 1. Now, if we
write the equation (x − y)2 + xy − 1 = 0 as (x − y)2 − 1 = −xy then the LHS must be positive while the
RHS must be non-positive (noting that x and y presumably have the same sign). So, this contradiction
should lead to the conclusion that there is no solution for (x − y)2 > 1, and hence we have no other
solutions.
So in brief, the solutions are (where k ∈ Z):
(x, y) = (k, −k) (x, y) = (−1, −1) (x, y) = (1, 1) (x, y) = (0, ±1) (x, y) = (±1, 0)
(b) We have:
(x3 + y 3 ) + (x + y) = 0 → (x + y)(x2 − xy + y 2 ) + (x + y) = 0 →
(x + y)(x2 − xy + y 2 + 1) = 0
So, either x + y = 0 or x2 − xy + y 2 + 1 = 0. Hence, we have two cases:
• x + y = 0 and hence y = −x.
• x2 − xy + y 2 + 1 = 0 which is equivalent to (x − y)2 + xy + 1 = 0. Accordingly:
If (x − y)2 = 0 then x = y and hence xy = x2 = y 2 = −1 which is impossible.
If (x − y)2 = 1 then x − y = ±1, i.e. x = y − 1 or x = y + 1 which lead to y 2 − y + 2 = 0 or y 2 + y + 2 = 0.
These equations have no integer solution.
If (x − y)2 > 1 then if we write the equation x2 − xy + y 2 + 1 = 0 as x2 + y 2 + 1 = xy then x and y must
have the same sign because otherwise the LHS will be positive while the RHS cannot be positive. Now,
if we write the equation (x − y)2 + xy + 1 = 0 as (x − y)2 + 1 = −xy then the LHS must be positive
while the RHS must be non-positive (noting that x and y presumably have the same sign). So, this
contradiction should lead to the conclusion that there is no solution for (x − y)2 > 1.
So in brief, the only solution is: (x, y) = (k, −k) where k ∈ Z.
(c) If we write the equation as (x3 − y 3 ) + (x2 − y 2 ) = 0 then it is obvious that x = y is a solution. So,
let us consider the other case, i.e. x 6= y:
If x = 0 then y 3 + y 2 = y 2 (y + 1) = 0, i.e. (x, y) = (0, −1).
5.2 Polynomial Diophantine Equations 60

If x = 1 then y 3 + y 2 − 2 = 0 which has the solution y = 1 (but it is not acceptable because x 6= y


although it is included in the previous solution x = y).
If x = −1 then y 3 + y 2 = y 2 (y + 1) = 0, i.e. (x, y) = (−1, 0).
Now, we show that |x| > 1 is not a possibility except when x = y (which we obtained already). If
we write the equation as x2 (x + 1) = y 2 (y + 1) then it should be obvious that (x + 1) and (y + 1)
must have the same sign (noting that x2 and y 2 have the same sign and noting as well that y = 0 is
not a possibility). Now, if we note that x and (x + 1) are consecutive integers and y and (y + 1) are
consecutive integers then we must have x = y which is the solution that we obtained already.
So in brief, we have only 3 solutions: (x, y) = (k, k), (0, −1), (−1, 0) where k ∈ Z.
(d) We have 4 (comprehensive) cases: x = 0 or x = ±1 or |x| > 1. So, let us consider these cases:
If x = 0 then y 3 + y 2 = y 2 (y + 1) = 0, i.e. (x, y) = (0, 0) and (x, y) = (0, −1).
If x = 1 then y 3 + y 2 + 2 = 0 which has no solution.
If x = −1 then y 3 + y 2 = y 2 (y + 1) = 0, i.e. (x, y) = (−1, 0) and (x, y) = (−1, −1).
Now, we show that |x| > 1 is not a possibility (i.e. it does not lead to new solutions). If we write the
equation as x2 (x + 1) = −y 2 (y + 1) then it should be obvious that (x + 1) and (y + 1) must have opposite
signs (noting that x2 and y 2 have the same sign and noting as well that y = 0 is not a possibility).
Now, if we note that x and (x + 1) are consecutive integers and y and (y + 1) are consecutive integers
then we must have x2 = y 2 (i.e. x = ±y) and x + 1 = −y − 1 (i.e. x = −y − 2). On substituting
x = ±y in the equation x3 + y 3 + x2 + y 2 = 0 we get only (x, y) = (0, 0) and (x, y) = (−1, −1) which
we obtained already. On substituting x = −y − 2 in the equation x3 + y 3 + x2 + y 2 = 0 we get only
(x, y) = (−1, −1) which we obtained already.
So in brief, we have only 4 solutions: (x, y) = (0, 0), (0, −1), (−1, 0), (−1, −1).
(e) Let x = −X and y = −Y . Now, if we substitute this in the given equation then we get:
−X 3 − Y 3 − X 2 − Y 2 = 0, i.e. X 3 + Y 3 + X 2 + Y 2 = 0. The solutions of this equation (accord-
ing to part d) are: (X, Y ) = (0, 0), (0, −1), (−1, 0), (−1, −1). So, on transforming back to x and y we
get: (x, y) = (0, 0), (0,1), (1,0), (1,1).
(f ) If we write this equation as x2 + (6 − y)x + (2 − y) = 0 then it is a quadratic in x and hence its
discriminant must be a perfect square (say k 2 ), that is:
k 2 = (6 − y)2 − 4(2 − y) → k 2 = y 2 − 8y + 28 → k 2 = (y − 4)2 + 12 →
  
k 2 − (y − 4)2 = 12 → k − (y − 4) k + (y − 4) = 12 → (k − y + 4)(k + y − 4) = 12
Now, if we factorize 12 as 12 = (±1)(±12) = (±2)(±6) = (±3)(±4) and consider all the possibilities
of these numeric factors equaling the two factors on the LHS (considering both orders) then by solving
the resulting twelve systems of simultaneous equations in k and y (accepting only the integer solutions)
we get: (k, y) = (−4, 2), (−4, 6), (4,6), (4,2). Now, if we insert these values of y (i.e. y = 2 and y = 6)
in the given equation we get: x2 + 4x = 0 (whose solutions are x = 0 and x = −4) and x2 − 4 = 0
(whose solutions are x = ±2). Hence, the solutions of the given equation are:
(x, y) = (0, 2) (x, y) = (−4, 2) (x, y) = (−2, 6) (x, y) = (2, 6)
4. Solve the following Diophantine equations (where x, y, z ∈ Z):
(a) xy + yz = xyz. (b) x + y + z = xyz. (c) x2 yz − 3xy 2 z − 2z + 1 = 0.
(d) x6 − y 3 + 216z 3 = 0. (e) x2 + y 2 + z 2 = 237327.
Solution:
(a) If y = 0 then (x, y, z) = (m, 0, k) is a solution where m, k ∈ Z.
If y 6= 0 then we have x + z = xz and hence:
• If x = 0 (z = 0) then z = 0 (x = 0) and hence (x, y, z) = (0, n, 0) is a solution where Z ∋ n 6= 0.
• If x 6= 0 then x = z(x − 1) and hence z|x. Similarly, z = x(z − 1) and hence x|z. This means x = z
(noting that x = −z is not a possibility) and hence we have 2x = xz, i.e. z = x = 2. Thus, we have
another solution: (x, y, z) = (2, n, 2) where Z ∋ n 6= 0.
So in brief, we have 3 solutions: (m, 0, k), (0, n, 0) and (2, n, 2) where m, n, k ∈ Z and n 6= 0.
(b) If xyz = 0 then we have the following solutions: (x, y, z) = (m, −m, 0), (m, 0, −m) and (0, m, −m)
5.2 Polynomial Diophantine Equations 61

where m ∈ Z. So, in the following we assume xyz 6= 0.


Let us first assume that |x| ≤ |y| ≤ |z|. In the following we will show that (with this condition) x must
be equal to ±1. This is because for all the possibilities of |x| > 1 we have |x + y + z| < |xyz|, e.g.

|±2±2±2| < |(±2)(±2)(±2)| |±2±2±3| < |(±2)(±2)(±3)| |±2±3±3| < |(±2)(±3)(±3)|

Now, we have 2 cases to consider:


• x = 1 and hence we have 1 + y + z = yz, i.e. y + 1 = z(y − 1). This equation means (y − 1)|(y + 1)
and hence:
y+1 2
=1+
y−1 y−1
i.e. (y − 1)|2 and hence (noting that y 6= 0) y = 2 or y = −1 or y = 3. On substituting x = 1 and
y = 2, −1, 3 in the given equation we get the following solutions: (x, y, z) = (1, 2, 3), (1, −1, 0) and
(1, 3, 2). However, because z 6= 0 and we are currently assuming |x| ≤ |y| ≤ |z| we can accept only
(x, y, z) = (1, 2, 3).
• x = −1 and hence we have −1 + y + z = −yz, i.e. 1 − y = z(1 + y). This equation means (1 + y)|(1 − y)
and hence:
1−y 2
= −1 +
1+y y+1
i.e. (y + 1)|2 and hence (noting that y 6= 0) y = −2 or y = −3 or y = 1. On substituting x = −1 and
y = −2, −3, 1 in the given equation we get the following solutions: (x, y, z) = (−1, −2, −3), (−1, −3, −2)
and (−1, 1, 0). However, because z 6= 0 and we are currently assuming |x| ≤ |y| ≤ |z| we can accept
only (x, y, z) = (−1, −2, −3), i.e. (x, y, z) = −(1, 2, 3).
So, assuming that |x| ≤ |y| ≤ |z| we have only 2 (zero-free) solutions: (x, y, z) = ±(1, 2, 3). Now, if
we lift the condition |x| ≤ |y| ≤ |z| (noting the symmetry in x, y, z) by permuting x, y, z (and hence
permuting the values in these 2 solutions) then we get the following 12 solutions:
±(1, 2, 3) ±(1, 3, 2) ±(2, 1, 3) ±(2, 3, 1) ±(3, 1, 2) ±(3, 2, 1)
(c) If we write this equation as: z(x2 y − 3xy 2 − 1) = z − 1 then we can see that (x2 y − 3xy 2 − 1) is
always odd and hence if z is odd then the LHS is odd while the RHS is even, while if z is even then the
LHS is even while the RHS is odd. Hence, this equation has no solution.
(d) If we write this equation as (x2 )3 + (6z)3 = y 3 then (by Fermat’s last theorem)[42] it is obvious
that it has no “non-zero” solutions (i.e. solutions with xyz 6= 0). Regarding the zero solutions we have
three cases:
• x = 0 and hence:
−y 3 + 216z 3 = 0 → y 3 = 216z 3 → y 3 = (6z)3 → y = 6z
So, the solution in this case is (x, y, z) = (0, 6k, k) where k ∈ Z.
• y = 0 and hence:
x6 + 216z 3 = 0 → (x2 )3 = (−6z)3 → x2 = −6z → (6k)2 = −6(−6k 2 )
So, the solution in this case is (x, y, z) = (6k, 0, −6k 2 ) where k ∈ Z.
• z = 0 and hence:
x6 − y 3 = 0 → y 3 = x6 → y 3 = (x2 )3 → y = x2
So, the solution in this case is (x, y, z) = (k, k 2 , 0) where k ∈ Z.
So in brief, we have three main solutions:
(x, y, z) = (0, 6k, k) (x, y, z) = (6k, 0, −6k 2 ) (x, y, z) = (k, k 2 , 0)
(e) The number 237327 on the RHS is congruent (mod 8) to 7. Now, the square of an integer is con-
gruent (mod 8) either to 0 or to 1 or to 4 and hence the LHS cannot be congruent (mod 8) to 7. Hence,
this equation has no solution (see § 2.7.6 of V1).
[42] Regardingthe possibility of y and z being negative, we can exchange their positions and hence we deal with natural
solutions. Regarding the possibility of y being positive and z being negative, we can move the z term to the RHS and
again dealing with natural solutions. Regarding the possibility of y being negative and z being positive, the equation
will obviously have no solution because the LHS is positive while the RHS is negative.
5.2 Polynomial Diophantine Equations 62

5. Find all x, y, z ∈ Z such that x2 + y 2 = z 2 and x, y, z are consecutive integers.


Solution: We have six cases:
• x < y < z and hence y = x + 1 and z = x + 2. Thus, we have:
x2 + (x + 1)2 = (x + 2)2 → x2 − 2x − 3 = 0 → (x + 1)(x − 3) = 0
i.e. x = −1 and x = 3. Therefore, we have only two solutions: (x, y, z) = (−1, 0, 1) and (3, 4, 5).
• x < z < y and hence y = x + 2 and z = x + 1. Thus, we have:
x2 + (x + 2)2 = (x + 1)2 → x2 + 2x + 3 = 0
which has no solution.
• y < x < z: this is similar to the first case (with the exchange of x, y which are symmetric). Therefore,
we have only two solutions: (x, y, z) = (0, −1, 1) and (x, y, z) = (4, 3, 5).
• y < z < x: this is similar to the second case (with the exchange of x, y which are symmetric). There-
fore, we have no solution.
• z < x < y and hence y = x + 1 and z = x − 1. Thus, we have:
x2 + (x + 1)2 = (x − 1)2 → x2 + 4x = 0 → x(x + 4) = 0
i.e. x = 0 and x = −4. Therefore, we have only two solutions: (x, y, z) = (0, 1, −1) and (−4, −3, −5).
• z < y < x: this is similar to the previous case (with the exchange of x, y which are symmetric).
Therefore, we have only two solutions: (x, y, z) = (1, 0, −1) and (−3, −4, −5).
So in brief, we have only eight (x, y, z) solutions which are:
(−1, 0, 1) (3, 4, 5) (0, −1, 1) (4, 3, 5) (0, 1, −1) (−4, −3, −5) (1, 0, −1) (−3, −4, −5)
It is worth noting that these results mean that (3, 4, 5) is the only Pythagorean triple with consecutive
integers.
6. Solve the following Diophantine equation (where m, n ∈ Z):
3n3 m + 2n2 m − 7m = m6 n + 5m3 n + mn
Solution: An obvious solution is m = 0 with n being an arbitrary integer, i.e. (m, n) = (0, k) where
k ∈ Z. If m 6= 0 then we can divide the two sides by m and obtain:
3n3 + 2n2 − 7 = n(m5 + 5m2 + 1)
This equation has no solution due to parity violation, i.e. (m5 + 5m2 + 1) is always odd and hence if n
is even then we have: odd = even while if n is odd then we have: even = odd.
So in brief, we have only the solution (m, n) = (0, k) where k ∈ Z.
7. Let f (x, y) = 120x5 + 274x4 y + 225x3 y 2 + 85x2 y 3 + 15xy 4 + y 5 . Are there x, y ∈ Z such that f is equal
to the following integers:
(a) 21. (b) 27. (c) 181. (d) 45. (e) −105. (f ) 63.
Solution: In essence, this is a Diophantine equation problem where we are supposed to investigate if
there are x, y ∈ Z that make f equal to these integers. Now, let us factorize f :
f (x, y) = 120x5 + (154 + 120)x4 y + (71 + 154)x3 y 2 + (14 + 71)x2 y 3 + (1 + 14)xy 4 + y 5
= (120x5 + 154x4 y + 71x3 y 2 + 14x2 y 3 + xy 4 ) + (120x4 y + 154x3 y 2 + 71x2 y 3 + 14xy 4 + y 5 )
= x(120x4 + 154x3 y + 71x2 y 2 + 14xy 3 + y 4 ) + y(120x4 + 154x3 y + 71x2 y 2 + 14xy 3 + y 4 )
 
= (x + y) 120x4 + 154x3 y + 71x2 y 2 + 14xy 3 + y 4
 
= (x + y) 120x4 + (94 + 60)x3 y + (24 + 47)x2 y 2 + (2 + 12)xy 3 + y 4
 
= (x + y) (120x4 + 94x3 y + 24x2 y 2 + 2xy 3 ) + (60x3 y + 47x2 y 2 + 12xy 3 + y 4 )
 
= (x + y) 2x(60x3 + 47x2 y + 12xy 2 + y 3 ) + y(60x3 + 47x2 y + 12xy 2 + y 3 )
 
= (x + y)(2x + y) 60x3 + 47x2 y + 12xy 2 + y 3
 
= (x + y)(2x + y) 60x3 + (27 + 20)x2 y + (3 + 9)xy 2 + y 3
 
= (x + y)(2x + y) (60x3 + 27x2 y + 3xy 2 ) + (20x2 y + 9xy 2 + y 3 )
5.2 Polynomial Diophantine Equations 63

 
= (x + y)(2x + y) 3x(20x2 + 9xy + y 2 ) + y(20x2 + 9xy + y 2 )
 
= (x + y)(2x + y)(3x + y) 20x2 + 9xy + y 2
 
= (x + y)(2x + y)(3x + y) 20x2 + (4 + 5)xy + y 2
 
= (x + y)(2x + y)(3x + y) (20x2 + 4xy) + (5xy + y 2 )
= (x + y)(2x + y)(3x + y) [4x(5x + y) + y(5x + y)]
= (x + y)(2x + y)(3x + y)(4x + y)(5x + y)

As we see:
If x = y = 0 then f = 0.
If x = 0 and y 6= 0 then f = y 5 6= 0.
If x 6= 0 and y = 0 then f = 120x5 6= 0.
If x 6= 0 and y 6= 0 and one of these five factors is zero (e.g. when y = −x) then f = 0.
If x 6= 0 and y 6= 0 and none of these five factors is zero then f 6= 0 is a product of 5 distinct factors.
So in brief, either f = 0, or f = y 5 6= 0, or f = 120x5 6= 0, or f = abcde where a, b, c, d, e are distinct
non-zero integers.
(a) It is obvious that 21 6= 0, 21 6= y 5 and 21 6= 120x5 . Moreover, if we consider all the possible
factorizations of 21 into distinct integer factors then we have:

21 = (1)(21) = (−1)(−21)
= (3)(7) = (−3)(−7)
= (1)(−1)(−21)
= (1)(3)(7) = (−1)(−3)(7) = (−1)(3)(−7) = (1)(−3)(−7)
= (1)(−1)(−3)(7) = (1)(−1)(3)(−7)

As we see, 21 can be factorized only in 2 or 3 or 4 distinct integer factors and hence it cannot be equal
to abcde. Therefore, f cannot be equal to 21.
(b) It is obvious that 27 6= 0, 27 6= y 5 (noting that 27 = 33 ) and 27 6= 120x5 . Moreover, if we consider
all the possible factorizations of 27 into distinct integer factors then we have:

27 = (1)(27) = (−1)(−27)
= (3)(9) = (−3)(−9)
= (1)(−1)(−27)
= (1)(3)(9) = (−1)(−3)(9) = (−1)(3)(−9) = (1)(−3)(−9)
= (1)(−1)(−3)(9) = (1)(−1)(3)(−9)

As we see, 27 can be factorized only in 2 or 3 or 4 distinct integer factors and hence it cannot be equal
to abcde. Therefore, f cannot be equal to 27.
(c) 181 is prime and hence it is obvious that 181 6= 0, 181 6= y 5 and 181 6= 120x5 . Moreover, any prime
number p can be factorized as a product of only two or three distinct integer factors, i.e. p = (1)(p) or
p = (−1)(−p) or p = (1)(−1)(−p). Hence, 181 cannot be equal to abcde. Therefore, f cannot be equal
to 181.
(d) 45 6= 0, 45 6= y 5 and 45 6= 120x5 . However, in principle 45 can be equal to abcde because 45 can be
factorized into 5 distinct integers, that is:

45 = (1)(−1)(3)(−3)(5)

Now, (x + y) must be equal to one of these five numeric factors while (2x + y) must be equal to one
of the remaining four numeric factors. So, if we consider all the 20 systems of simultaneous equations
obtained from the five possibilities of x+y = (1), (−1), (3), (−3), (5) with the four remaining possibilities
of 2x+y = (1), (−1), (3), (−3), (5) then we can identify x and y values that can potentially make f = 45.
5.2 Polynomial Diophantine Equations 64

 
These 20 systems with their solutions and the corresponding values of f in the form (x, y, f ) are given
in the following table:
x+y =1 x + y = −1 x+y =3 x + y = −3 x+y =5
2x + y = 1 (2, −3, −105) (−2, 5, −45) (4, −7, −1755) (−4, 9, −1155)
2x + y = −1 (−2, 3, 105) (−4, 7, 1755) (2, −5, 45) (−6, 11, 8645)
2x + y = 3 (2, −1, 945) (4, −5, −3465) (6, −9, −25515) (−2, 7, 45)
2x + y = −3 (−4, 5, 3465) (−2, 1, −945) (−6, 9, 25515) (−8, 13, 84645)
2x + y = 5 (4, −3, 9945) (6, −7, −21505) (2, 1, 10395) (8, −11, −118755)
As we see, f can take the value 45, i.e. when (x, y) = (2, −5) and when (x, y) = (−2, 7). So, there are
x, y ∈ Z that make f = 45.
(e) From the table of part (d) we can see that f can take the value −105, e.g. when (x, y) = (2, −3).
So, there are x, y ∈ Z that make f = −105.
(f ) 63 6= 0, 63 6= y 5 and 63 6= 120x5 . However, in principle 63 can be equal to abcde because 63 can be
factorized into 5 distinct integers, that is:

63 = (1)(−1)(3)(−3)(7)

Now, if we follow the procedure of part (d) by building a similar table (where x + y = 5 and 2x + y = 5
are replaced by x + y = 7 and 2x + y = 7) then we find that f cannot take the value 63. So, there are
no x, y ∈ Z that make f = 63 (despite the fact that 63 can be factorized into 5 distinct integers, i.e.
the possibility of factorization is a necessary but not sufficient condition for f to take the given integer
value).
8. Show that if (a, b, c) is a primitive Pythagorean triple then exactly one of a, b, c is divisible by 3, exactly
one of a, b, c is divisible by 4, and exactly one of a, b, c is divisible by 5.
3 3 3
Solution: Regarding the divisibility by 3, we have x2 (x = 0, 1, 2) = 0, 1, 1. Thus, either c2 = 0
3 3
and hence a2 = 0 and b2 = 0 (which is impossible because this means that all the three numbers are
3
divisible by 3 in contradiction to being primitive) or c2 = 1 and hence one of a, b must be congruent
(mod 3) to 0 and the other must be congruent (mod 3) to 1 or to 2, i.e. exactly one of a, b, c (i.e. a or
b) is divisible by 3.
Regarding the divisibility by 4, it was shown (in Problem 3 of § 4.1.4 of V1) that if (a, b, c) is a
primitive Pythagorean triple, then there are coprimes m, n ∈ N of opposite parity with m > n such
that (a, b, c) is given by Euclid’s formula, i.e. (a, b, c) = (2mn, m2 − n2 , m2 + n2 ). This means that a
is divisible by 4. Moreover, it was shown (in Problem 2 of § 4.1.4 of V1) that if (a, b, c) is a primitive
Pythagorean triple then a and b have opposite parity (and hence c is odd). This means that only a is
divisible by 4, i.e. exactly one of a, b, c is divisible by 4.
5 5
Regarding the divisibility by 5, we have x2 (x = 0, 1, 2, 3, 4) = 0, 1, 4, 4, 1. Now:
5
If c2 = 0 then one of a2 , b2 must be congruent (mod 5) to 1 and the other must be congruent (mod 5)
5 5
to 4 (noting that a2 = 0 and b2 = 0 is not possible because this contradicts being primitive) and hence
exactly one of a, b, c (i.e. c) is divisible by 5.
5
If c2 = 1 then one of a2 , b2 must be congruent (mod 5) to 0 and the other must be congruent (mod 5)
to 1 and hence exactly one of a, b, c (i.e. a or b) is divisible by 5.
5
If c2 = 4 then one of a2 , b2 must be congruent (mod 5) to 0 and the other must be congruent (mod 5)
to 4 and hence exactly one of a, b, c (i.e. a or b) is divisible by 5.
So, in all cases exactly one of a, b, c is divisible by 5.
9. Find all the solutions of the Diophantine equation: ax + xy + by = c where a, b, c, x, y ∈ Z and ab 6= 0.
Solution: We have ax + xy + by = c and hence ax + xy + by + ab = ab + c, i.e. (x + b)(y + a) = ab + c.
Now, if we consider all the possible 2-factor factorizations of (ab + c) in both orders and equate one
factor to (x + b) and the other factor to (y + a) then we get all the possible solutions.
For example, if a = b = 1 and c = 7 then we have x + xy + y = 7 and hence x + xy + y + 1 = 8, i.e.
5.2 Polynomial Diophantine Equations 65

(x + 1)(y + 1) = 8. Thus:

(x + 1)(y + 1) = (−1)(−8) = (−8)(−1) = (1)(8) = (8)(1) = (−2)(−4) = (−4)(−2) = (2)(4) = (4)(2)

On considering these eight possibilities we get the following eight (x, y) solutions:
(−2, −9) (−9, −2) (0, 7) (7, 0) (−3, −5) (−5, −3) (1, 3) (3, 1)
10. Solve the following Diophantine equations in two variables (where x, y ∈ Z):
(a) x2 − 6xy − 3x + 9y + 5 = 0. (b) 3x3 y − 3x2 + 22x2 y − 7x + 21xy − 3y + 1 = 0.
(c) 7x2 − x2 y 2 + 13 = 0. (d) x2 − xy + 6x − y + 2 = 0.
Solution: The common feature of these equations is that we can separate the two variables in a way
that changes the problem from being a Diophantine equation problem to a polynomial divisibility prob-
lem. This essentially converts the problem from being a two-variable Diophantine equation problem to
a one-variable divisibility problem (which is generally easier to solve).
(a) We have:
x2 −3x+5
x2 − 6xy − 3x + 9y + 5 = 0 → x2 − 3x + 5 = 6xy − 9y → y= 6x−9
Now, the solutions of the divisibility problem (6x − 9)|(x2 − 3x + 5) are x = −4, 1, 2, 7 (see § 6.4 of V1).
Hence, the solutions of the given Diophantine equation are: (x, y) = (−4, −1), (1, −1), (2, 1), (7, 1).
(b) We have:
3x3 y − 3x2 + 22x2 y − 7x + 21xy − 3y + 1 = 0 → 3x3 y + 22x2 y + 21xy − 3y = 3x2 + 7x − 1 →
3x2 +7x−1
y= 3x3 +22x2 +21x−3
Now, the solution of the divisibility problem (3x3 + 22x2 + 21x − 3)|(3x2 + 7x − 1) is x = −1 (see § 6.4
of V1). Hence, the solution of the given Diophantine equation is: (x, y) = (−1, 1).
(c) If we write this equation as x2 = y213−7 then we must have (y 2 − 7)|13, i.e. y 2 − 7 = ±1, ±13.
However, there is no integer solution to any of these four equations. Hence, the given equation has no
solution.
(d) This equation was solved in Problem 3 by treating it as a quadratic in x. In the present Problem
we will solve it as a divisibility problem, that is:
x2 − xy + 6x − y + 2 = 0 → x2 − 4 − xy + 6x − y + 6 = 0 → x2 − 4 = xy − 6x + y − 6 →
x2 −4
x2 − 4 = (y − 6)(x + 1) → y−6= x+1
Now, the solutions of the divisibility problem (x + 1)|(x2 − 4) are x = −4, −2, 0, 2 (see § 6.4 of V1).
Hence, the solutions of the given Diophantine equation are: (x, y) = (−4, 2), (−2, 6), (0, 2), (2, 6).
11. Solve the following Diophantine equations in two variables (where x, y ∈ Z):
(a) x2 − y 2 − 12x − 3y + 1 = 0. (b) x3 − x2 − y − 1 = 0.
(c) x4 − y 3 + 2y 2 + 3x + 9 = 0. (d) x3 − 2y 2 − 7x2 + 6y − 11 = 0.
Solution: The common feature of these equations is that we can separate the two variables and hence
this Problem is like Problem 10. However, unlike Problem 10 we do not have the luxury of converting a
two-variable Diophantine equation problem to a one-variable divisibility problem because we have two
equal polynomial expressions in two separate variables. So, we usually need to invent and employ some
algebraic (and possibly non-algebraic) tricks (or techniques or considerations). Some of these tricks (or
techniques or considerations) are considered in the following solutions.
(a) We have:
x2 − y 2 − 12x − 3y + 1 = 0 → x2 − 12x = y 2 + 3y − 1 →
x2 − 12x + 36 = y 2 + 3y + 35 → (x − 6)2 = y 2 + 3y + 35 →
(2x − 12)2 = (2y)2 + 12y + 140 → (2x − 12)2 = (2y + 3)2 + 131 →
2 2
X − Y = 131 → (X − Y )(X + Y ) = 131
5.2 Polynomial Diophantine Equations 66

where X = 2x − 12 and Y = 2y + 3. Noting that 131 is prime, we have 4 possibilities of factorization:

(X − Y )(X + Y ) = (−1)(−131) = (−131)(−1) = (1)(131) = (131)(1)

On solving the four 2-equation systems representing these 4 possibilities we get the following solutions:

(X, Y ) = (−66, −65), (−66, 65), (66, 65), (66, −65)



Now, if we use the reverse transformation: (X, Y ) 7→ (x, y) = X+12 2 , 2
Y −3
then we get the following
solutions:
(x, y) = (−27, −34), (−27, 31), (39, 31), (39, −34)
(b) If we write this equation as y = x3 − x2 − 1 then the solutions are: (x, y) = (k, k 3 − k 2 − 1) (where
k ∈ Z) and hence we have infinitely many solutions, i.e. one solution for each integer value of x. Some
of these solutions are:
(−3, −37) (−2, −13) (−1, −3) (0, −1) (1, −1) (2, 3) (3, 17)
(c) Let us separate the variables by writing the equation as: x4 + 3x = y 3 − 2y 2 − 9. If we now factorize
the two sides we get: x(x3 + 3) = (y − 3)(y 2 + y + 3). So, we have two possibilities (noting that x and
y are free to vary):
• x = (y − 3). Now, if we substitute this in the original equation and simplify we get: y 4 − 13y 3 +
56y 2 − 105y + 81 = 0 whose (integer) solution is y = 3 and hence x = 0.
• x = (y 2 + y + 3). Now, if we substitute this in the original equation and simplify we get:

y 8 + 4y 7 + 18y 6 + 40y 5 + 91y 4 + 119y 3 + 167y 2 + 111y + 99 = 0

which has no (integer) solution.


So in brief, this equation has only one solution, i.e. (x, y) = (0, 3).
(d) If we write this equation as: x3 − 7x2 = 2y 2 − 6y + 11 then we can see that the LHS is even while
the RHS is odd and hence it has no solution.
12. Solve the following Diophantine equations in three variables (where x, y, z ∈ Z):
(a) 14xy − 4x + 12y + z = 10. (b) x3 + y 3 + z 3 = 58. (c) 4x2 + 16y 2 − 9z 2 − 12x + 8y + 10 = 0.
Solution:
(a) If we write this equation as z = 10 − 14xy + 4x − 12y then the solutions are: (x, y, z) = (k, s, 10 −
14ks + 4k − 12s) (where k, s ∈ Z) and hence we have infinitely many solutions, i.e. one solution for
each pair of integer values of x and y. Some of these solutions are:
(−5, 0, −10) (−1, 4, 14) (0, 1, −2) (1, 3, −64) (3, −7, 400) (11, 0, 54)
9
(b) If we reduce this equation modulo 9 we get: x3 + y 3 + z 3 = 4. Now, the cube of an integer can be
congruent (mod 9) only to 0, 1 and 8. Noting that no combination of 3-term sum of these numbers (i.e.
0, 1 and 8) can be congruent (mod 9) to 4, we conclude that this equation has no solution (see § 2.7.6
of V1).
(c) We have:

4x2 + 16y 2 − 9z 2 − 12x + 8y + 10 = (4x2 − 12x + 9) + (16y 2 + 8y + 1) − (3z)2


= (2x − 3)2 + (4y + 1)2 − (3z)2 = 0

i.e. (2x − 3)2 + (4y + 1)2 = (3z)2 . However, the sum of two odd squares cannot be a perfect square (see
Problem 17 of § 4). Hence, this equation has no solution.
13. Find a natural number n such that the Diophantine equation 3x + 5y = n has exactly 5 solutions in
natural numbers (i.e. x, y ∈ N).
Solution: The simplest approach is to tackle this Problem computationally by searching for the values
of n that produce exactly 5 natural solutions. If we do this then we will find (for example) that
n = 68, 71, 73, 74, 76, 77, 90 solve this Problem. For instance, 3x + 5y = 90 has the following five natural
solutions: (x, y) = (5, 15), (10, 12), (15, 9), (20, 6), (25, 3).
5.2 Polynomial Diophantine Equations 67

14. Find all quadruples of integers whose sum is equal to their product.
Solution: This is a 4-variable Diophantine equation problem, i.e. x + y + z + w = xyzw where
x, y, z, w ∈ Z. Now:
• If xyzw = 0 then we have the following solutions: (x, y, z, w) = (0, k, s, −k − s), (k, 0, s, −k − s),
(k, s, 0, −k − s), (k, s, −k − s, 0) where k, s ∈ Z.
• If xyzw 6= 0 then let assume for the time being that |x| ≤ |y| ≤ |z| ≤ |w|. Now, if |x| > 1 or |y| > 1
then |x + y + z + w| < |xyzw|, e.g.

| ± 2 ± 2 ± 2 ± 2| < |(±2)(±2)(±2)(±2)| | ± 1 ± 2 ± 2 ± 2| < |(±1)(±2)(±2)(±2)|

Hence, we must have x = ±1 and y = ±1.


Similarly, if |z| > 2 then |x + y + z + w| < |xyzw|, e.g.

| ± 1 ± 1 ± 3 ± 3| < |(±1)(±1)(±3)(±3)| | ± 1 ± 1 ± 3 ± 4| < |(±1)(±1)(±3)(±4)|

Hence, we must have z = ±2. Now, if we test the 8 combinations of these values of x, y, z (considering
the conditions xyzw 6= 0 and |x| ≤ |y| ≤ |z| ≤ |w| as well as x, y, z, w ∈ Z) then we find only 3 solutions
which are: (x, y, z, w) = (1, 1, 2, 4), (1, −1, −2, −2), (−1, 1, −2, −2). Now, if we lift the condition
|x| ≤ |y| ≤ |z| ≤ |w| (noting the symmetry in x, y, z, w) by permuting x, y, z, w (and hence permuting
the values in these 3 solutions) then we get 24 solutions in total (i.e. 12 + 12 noting that the last two
solutions produce the same permutations).
15. Show that the product of every Pythagorean triple is divisible by 60.
Solution: Non-primitive Pythagorean triples are scaled-up versions of primitive Pythagorean triples
(because any non-primitive triple can be reduced to primitive by dividing by the common factor)[43]
and hence it is enough to prove this proposition for primitive Pythagorean triples. Now, from the result
of Problem 8 we can conclude that every Pythagorean triple has factors of 3, 4 and 5 and hence their
product must have a factor of 3 × 4 × 5 = 60, i.e. every Pythagorean triple is divisible by 60.
16. Show that the Diophantine equation x2 −y 2 +z 2 = w has a solution (x, y, z) for any w (where x, y, z, w ∈
Z).
Solution: w is either odd or even. Now, 2n + 1 = (n + 1)2 − n2 + 02 (where n ∈ Z) can represent any
odd number, while 2n + 2 = (n + 1)2 − n2 + 12 can represent any even number. So, if we choose z = 0
when w is odd and choose z = 1 (or z = −1) when w is even then we can find x = n + 1 and y = n (for
some n ∈ Z) that satisfy x2 − y 2 + z 2 = w. The obvious implication of this result is that any integer
can be expressed as a sum of two squares (of integers) minus a square (of an integer).
17. Solve the following Diophantine equations (where x, y ∈ Z):
(a) x2 + xy + 2y + 2 = 0. (b) 4x2 + 4x − 15 − y 3 = 0. (c) x3 − 4y 4 + 2 = 0. (d) x2 + 4x = y 2 .
Solution:
(a) This is a quadratic equation in x whose discriminant is y 2 − 8y − 8. So, if this equation has a
solution then this discriminant must be a perfect square, i.e. y 2 − 8y − 8 = m2 (where m ∈ Z). Hence:
y 2 − 8y = m2 + 8 → y 2 − 8y + 16 = m2 + 24 → (y − 4)2 = m2 + 24 →
(y − 4)2 − m2 = 24 → (y − 4 − m)(y − 4 + m) = 24
Now, 24 = (−1)(−24) = (1)(24) = (−2)(−12) = (2)(12) = (−3)(−8) = (3)(8) = (−4)(−6) = (4)(6).
So, if we consider equating these 8 factorizations (in both orders) to the factors on the LHS then
we obtain 16 systems of simultaneous equations. On solving these systems of equations we find the
following integer solutions for y (noting that we ignore the non-integer solutions): y = −3, 11, −1, 9
(corresponding to m2 = 25, 25, 1, 1). Thus, the solutions (x, y) of the given Diophantine equation are:
(−1, −3) (4, −3) (−3, 11) (−8, 11) (0, −1) (1, −1) (−4, 9) (−5, 9)
(b) We have:
[43] It
should be obvious that all non-primitive Pythagorean triples can be obtained from the primitive Pythagorean triples
by multiplying the three numbers of the primitive triples by a natural number k > 1, and hence non-primitive triples
can be reduced (or scaled down) to their primitive form by dividing them by this common factor k.
5.2 Polynomial Diophantine Equations 68

y 3 = 4x2 + 4x − 15 → y 3 = (2x + 1)2 − 16 → y 3 = (2x − 3)(2x + 5)


Now, (2x+5)−(2x−3) = 8 which means that the gcd of (2x+5) and (2x−3) is a divisor of 8. However,
both (2x + 5) and (2x − 3) are odd and hence the only possible
 divisor of 8 (and hence a gcd of these
factors) is 1. This means noting that y 3 = (2x − 3)(2x + 5) that (2x + 5) = a3 and (2x − 3) = b3
(where a, b ∈ Z) and hence:

a3 − b3 = (a − b)(a2 + ab + b2 ) = 8 = (−1)(−8) = (1)(8) = (−2)(−4) = (2)(4)

Now, if we consider these 4 factorization possibilities in both orders then we have 8 systems of simulta-
neous equations (e.g. a − b = −1 and a2 + ab + b2 = −8). Of these 8 systems the only solvable system
in integers is a − b = 2 and a2 + ab + b2 = 4 which leads to (a, b) = (0, −2) and (a, b) = (2, 0). However,
neither of these solutions leads to an acceptable solution for x and y and hence the given Diophantine
equation has no solution.
4
(c) If we reduce this equation modulo 4 we get x3 + 2 = 0 which has no solution and hence the given
Diophantine equation has no solution (see § 2.7.6 of V1).
(d) We have x2 + 4x − y 2 = 0 which is a quadratic in x and hence:
p
−4 ± 16 + 4y 2 p
x= = −2 ± 4 + y 2
2
Now, we have two cases:
• y = 0 and hence x = 0, −4.
• y 6= 0 and hence we have no solution. This is because 4 + y 2 must be a perfect square which is
impossible because y 2 is a perfect square and hence 4 + y 2 cannot be a perfect square because the
difference between two (non-trivial) perfect squares cannot be 4.[44]
So in brief, the given equation has only two solutions: (x, y) = (0, 0) and (x, y) = (−4, 0).
18. Find the necessary and sufficient conditions for the following Diophantine equation to have a solution:

x2 ± py + c = 0 (p is odd prime coprime to c)

Solution: Regarding the necessary condition, if this is solvable then by reducing it in modulo p we
p p
get x2 + c = 0, i.e. x2 = −c. This means that −c must be a quadratic residue (mod p).
Regarding the sufficient condition, we will show that this condition is also sufficient. If −c is a
p
quadratic residue (mod p) then x2 + c = 0 must be solvable, i.e. we must have some x ∈ Z such that
p
x2 + c = 0. This means that x2 + c = ∓py (for some y ∈ Z), i.e. x2 ± py + c = 0 has an integer solution
(x, y) which means x2 ± py + c = 0 is solvable.
So in brief, the necessary and sufficient condition for the given Diophantine equation to have a solution
is that −c is a quadratic residue (mod p).
19. Find all x, y, z ∈ Z that satisfy the following equation: xy + xz + yz = xyz.
Solution: We have 3 main cases to consider:
• xyz = 0 and hence (x, y, z) = (0, 0, k) or (0, k, 0) or (k, 0, 0) where k ∈ Z.
• xyz 6= 0 and all x, y, z are positive (i.e. x, y, z ∈ N). If we divide the two sides by xyz we get
1 1 1
x + y + z = 1 whose solutions were obtained in Problem 7 of § 4.1.10 of V1.
• xyz 6= 0 and not all x, y, z are positive (i.e. at least some of them are negative). If we divide the two
sides by xyz we get x1 + y1 + z1 = 1 and hence at least one of x, y, z must be > 0 (because otherwise the
LHS will be < 0). In fact, we must have exactly two variables > 0 because otherwise the LHS will be
< 1. Now, we have two cases:
One of the positive variables is 1 and hence the other two variables (i.e. the other positive and the
negative) must be equal in magnitude and opposite in sign, i.e. (x, y, z) = (1, k, −k) or (k, 1, −k) or
(k, −k, 1).
Both positive variables are > 1 and hence the LHS will be < 1 (i.e. we have no solution). This is
[44] We note that the only solutions to the Diophantine equation m2 − n2 = 4 are (m, n) = (±2, 0).
5.3 Exponential Diophantine Equations 69

because the maximum value of the sum of the terms involving these variables is 1 (i.e. 1/2 + 1/2) and
hence the sum of the three terms must be less than 1.
So in brief, the solutions (x, y, z) are (where k ∈ Z):
(0, 0, k) (0, k, 0) (k, 0, 0) (2, 3, 6) (2, 6, 3) (3, 2, 6) (3, 6, 2) (6, 2, 3)
(6, 3, 2) (2, 4, 4) (4, 2, 4) (4, 4, 2) (3, 3, 3) (1, k, −k) (k, 1, −k) (k, −k, 1)
2 2 2
20. Find all x, y, z ∈ N such that x + y − z = 0 and 60|(xyz).
Solution: It is obvious that (x, y, z) is a Pythagorean triple and hence from the result of Problem 15
we conclude that the solutions to this Problem are all the Pythagorean triples.
21. Create a 2-variable polynomial Diophantine equation which has the following solutions: (x, y) = (3, 5),
(−11, 21), (1, 12).
Solution: A simple way for solving this type of problems is to use a “graphical approach”, e.g. we
assume that the equation is a parabola passing through these three points. So, if the parabola is rep-
resented by the equation y = ax2 +bx+c then we have the following system of linear equations in a, b, c:
5 = 9a + 3b + c 21 = 121a − 11b + c 12 = a + b + c
whose solution is (a, b, c) = (−11/56, −19/7, 835/56). On inserting these values in the equation
y = ax2 + bx + c and multiplying by 56 we get: 56y + 11x2 + 152x − 835 = 0. So, this Diophantine
equation meets the stated requirement.

5.3 Exponential Diophantine Equations


1. Show that the following Diophantine exponential equations have no solution (where x, y ∈ N0 ):
(a) 5x + 7 = 6y . (b) 7x + 3 = 8y . (c) 8x + 5 = 9y . (d) 80x + 3 = 121y . (e) 39x + 2 = 49y .
Solution: We note that none of these equations have a solution when xy = 0. Hence, in the following
we assume xy 6= 0.
5
(a) In modulo 5 we have 0 + 2 = 1 and hence the given Diophantine equation has no solution.
7
(b) In modulo 7 we have 0 + 3 = 1 and hence the given Diophantine equation has no solution.
8
(c) In modulo 8 we have 0 + 5 = 1 and hence the given Diophantine equation has no solution.
4
(d) In modulo 4 we have 0 + 3 = 1 and hence the given Diophantine equation has no solution.
13  6 13
(e) In modulo 13 we have 0 + 2 = (−3)y which has no solution noting that (−3)y=0,1,2,3,4,5 =
1, 10, 9, 12, 3, 4 and hence the given Diophantine equation has no solution.
2. Show that the following Diophantine exponential equations have no solution (where x, y, z ∈ N):
(a) 21x + 37y = 46z . (b) 38x + 43y = 79z . (c) 22x + 71y = 83z .
Solution:
5 5
(a) In modulo 5 we have 1 + 2y = 1 (i.e. 2y = 0) and hence the given Diophantine equation has no
4 5 5
solution (noting that 2y=0,1,2,3 = 1, 2, 4, 3 and hence 2y 6= 0).
3 3
(b) In modulo 3 we have 2x + 1 = 1 (i.e. 2x = 0) and hence the given Diophantine equation has no
2 3 3
solution (noting that 2x=0,1 = 1, 2 and hence 2x 6= 0).
7 7
(c) In modulo 7 we have 1 + 1 = 6z (i.e. 6z = 2) and hence the given Diophantine equation has no
2 7 7
solution (noting that 6z=0,1 = 1, 6 and hence 6z 6= 2).
3. Find all x, y ∈ N0 such that:
(a) 2x − 3y = 1. (b) 3x − 2y = 1.
Solution:
(a) We have two cases:
3 3
• x is odd: if we reduce the equation in modulo 3 we get 2 − 1 = 1 (if y = 0) or 2 − 0 = 1 (if y > 0).
So, the only solution is (x, y) = (1, 0).
• x is even: i.e. 4k −3y = 1 (where x = 2k with k ∈ N0 ). The only solution to this equation is k = y = 1
5.3 Exponential Diophantine Equations 70

(see part a of Problem 3 of § 4.1.7 of V1). So, the only solution is (x, y) = (2, 1).
So in brief, the given equation has only two solutions: (x, y) = (1, 0) and (2, 1).
(b) We have two cases:
• x is odd: if we reduce the equation in modulo 8 we get:
8 8 8 8
3 − 1 = 1 (if y = 0) 3 − 2 = 1 (if y = 1) 3 − 4 = 1 (if y = 2) 3 − 0 = 1 (if y > 2)
So, the only solution in this case is (x, y) = (1, 1).
• x is even: i.e. 32k − 2y = 1 (where x = 2k with k ∈ N noting that x = 0 is impossible). Accordingly:
32k − 1 = 2y → (3k − 1)(3k + 1) = 2y
i.e. 3k − 1 = 2m and 3k + 1 = 2n (where m, n ∈ N with m < n and m + n = y). Now, if we subtract the
first of the last two equations from the second we get 2 = 2n − 2m , i.e. 2 = 2m (2n−m − 1). The only
solution to the last equation is m = 1 and n = 2 and hence y = 3. So, the only solution in this case is
(x, y) = (2, 3).
So in brief, the given equation has only two solutions: (x, y) = (1, 1) and (2, 3).
4. Find all x, y ∈ N0 such that:
(a) 10x + 7 = 2y . (b) 4x − 7 = 9y . (c) 3x − 8 = 11y . (d) 5x − 9 = 2y .
(e) 4x − 3y = 7. (f ) 5x − 3y = 2. (g) 3x − 5y = 4.
Solution:
(a) We obviously have parity violation unless:
• x = 0 and y 6= 0 and hence we have 1 + 7 = 2y , i.e. (x, y) = (0, 3).
• x 6= 0 and y = 0 and hence we have 10x + 7 = 1 which has no solution.
So, the only solution to the given equation is (x, y) = (0, 3).
(b) This equation has no solution if xy = 0. Hence, in the following we assume xy 6= 0.
5
If we reduce the equation in modulo 5 we get (−1)x − 2 = (−1)y and hence x must be even (say x = 2k
where k ∈ N) and y must be odd. Hence:
42k − 7 = 9y → 42k − 7 = 32y → 42k − 32y = 7 → (4k − 3y )(4k + 3y ) = 7
Now, if we consider the factorization of 7 then we can easily conclude that the only possibility is
4k − 3y = 1 and 4k + 3y = 7, i.e. k = y = 1.
So, the only possible solution to the given equation is (x, y) = (2, 1).
(c) If xy = 0 then we have only one solution, i.e. (x, y) = (2, 0). So, in the following we assume xy 6= 0.
3
If we reduce the equation in modulo 3 we get 0 + 1 = (−1)y and hence y must be even, i.e. 3x − 8 = 112s
(where s ∈ N).
3
If we reduce the equation in modulo 4 we get (−1)x − 0 = (−1)2s and hence x must be even, i.e.
2k 2s
3 − 8 = 11 (where k ∈ N). Accordingly:
32k − 8 = 112s → 32k − 112s = 8 → (3k − 11s )(3k + 11s ) = 8
Now, if we consider the factorization of 8 then we can easily conclude that the only possibility is
3k − 11s = 2 and 3k + 11s = 4, i.e. k = 1 and s = 0 and hence (x, y) = (2, 0). However, we are currently
assuming xy 6= 0 (noting that this solution is obtained already).
So, the only solution to this equation is (x, y) = (2, 0).
(d) This equation has no solution if xy = 0. Hence, in the following we assume xy 6= 0.
3
If we reduce the equation in modulo 3 we get (−1)x − 0 = (−1)y and hence x and y must have the same
parity.
5 4 5
If we reduce the equation in modulo 5 we get 0 + 1 = 2y . Now, 2 y=0,1,2,3 = 1, 2, 4, 3 and hence we must
4
have y = 0 (say y = 4s where s ∈ N). But since x and y have the same parity then x must be even
(say x = 2k where k ∈ N). Accordingly:
52k − 9 = 24s → 52k − 9 = 42s → 52k − 42s = 9 → (5k − 4s )(5k + 4s ) = 9
Now, if we consider the factorization of 9 then we can easily conclude that the only possibility is
5k − 4s = 1 and 5k + 4s = 9, i.e. k = s = 1.
5.3 Exponential Diophantine Equations 71

So, the only solution to this equation is (x, y) = (2, 4).


(e) This equation has no solution if xy = 0. Hence, in the following we assume xy 6= 0.
4
If we reduce the equation in modulo 4 we get 0 − (−1)y = −1 and hence y must be even (say y = 2s
where s ∈ N). Accordingly:
4x − 32s = 7 → 22x − 32s = 7 → (2x − 3s )(2x + 3s ) = 7
Now, if we consider the factorization of 7 then we can easily conclude that the only possibility is
2x − 3s = 1 and 2x + 3s = 7, i.e. x = 2 and s = 1.
So, the only solution to this equation is (x, y) = (2, 2).
6 9
(f ) In modulo 9 we have 5 x=0,1,2,3,4,5 = 1, 5, 7, 8, 4, 2. Also:
9 9 9
3y = 1 (if y = 0) 3y = 3 (if y = 1) 3y = 0 (if y > 1)
So, 5x − 3y can be congruent to 2 (mod 9) only in the following two cases:
9 9
• 5x = 5 and 3y = 3: i.e. 5x − 31 = 2 which has only the solution (x, y) = (1, 1).
9 9 6
• 5x = 2 and 3y = 0: i.e. x = 5 and y > 1. Hence, we have (where k, s ∈ N0 ):
28 28
55+6k − (9)3s = 2 → 17 − (9)3s = 2 → (9)3s = 15 →
s 28 s 28 s 28
3 = 9∗ × 15 → 3 = 25 × 15 3 = 11
6
s=0,1,2,3,4,5 28
The last congruence has no solution (noting that 3 = 1, 3, 9, 27, 25, 19). Hence, we have no
solution in this case.
So in brief, the given equation has only one solution: (x, y) = (1, 1).
9 6 9
(g) In modulo 9 we have 3 x=0,1,>1 = 1, 3, 0 and 5 y=0,1,2,3,4,5 = 1, 5, 7, 8, 4, 2. So, 3x − 5y can be con-
gruent to 4 (modulo 9) only in the following two cases:
9 9
• 3x = 3 and 5y = 8 : i.e. 31 − 5y = 4 which has no solution.
x 9 y 9 6
• 3 = 0 and 5 = 5: i.e. x > 1 and y = 1. Hence, we have (where k, s ∈ N0 ):
28 28
(9)3s − 51+6k = 4 → (9)3s − 5 = 4 → (9)3s = 9 →
s 28 s 28 s 28
3 = 9∗ × 9 → 3 = 25 × 9 3 =1
0
The last congruence has the solution s = 6a (where a ∈ N ). Accordingly:
3x − 5y = 4 → 32+6a − 5y = 4 → 32+6a − 4 = 5y → (31+3a − 2)(31+3a + 2) = 5y
i.e. 31+3a − 2 = 5m and 31+3a + 2 = 5n (where m, n ∈ N0 with m < n and m + n = y). Now, if we add
the last two equations we get:
2(31+3a ) = 5m + 5n → 2(31+3a ) = 5m (1 + 5n−m )
Thus, m must be zero (because there is no factor on the LHS that can match a natural power of 5) and
hence we have:
31+3a − 2 = 1 → 31+3a = 3 → a=0
i.e. x = 2 and hence 32 − 5y = 4 whose solution is y = 1.
So in brief, the given equation has only one solution: (x, y) = (2, 1).
5. Find all x, y, z ∈ N0 such that:
(a) 3x + 4y = 8z . (b) 4x − 2y = 15z . (c) 4x − 3y = 15z . (d) 4x + 15y = 2z .
(e) 4x + 5y = 6z . (f ) 13x + 9y = 14z . (g) 3x + 4y = 5z .
Solution:
(a) We obviously have parity violation unless:
• y = 0 and z 6= 0 and hence we have 3x + 1 = 8z . On reducing this equation in modulo 7 we get
7 7
3x + 1 = 1 (i.e. 3x = 0) which has no solution. So, we have no solution in this case.
• y 6= 0 and z = 0 and hence we have 3x + 4y = 1. The LHS is obviously greater than 1 and hence we
have no solution in this case.
So in brief, this equation has no solution.
5.3 Exponential Diophantine Equations 72

(b) We obviously have parity violation unless:


• x = 0 and y 6= 0 and hence we have 1 − 2y = 15z which obviously has no solution because the LHS is
negative while the RHS is positive.
• x 6= 0 and y = 0 and hence we have 4x − 1 = 15z . Now, if we reduce this equation in modulo 5 we
5
get (−1)x − 1 = 0 and hence x must be even (say x = 2k where k ∈ N). Accordingly:
42k − 1 = 15z → (4k − 1)(4k + 1) = 15z
Now, the difference between (4k − 1) and (4k + 1) is 2 (noting that 4k − 1 and 4k + 1 cannot match 15z
in factorization sensibly unless 4k − 1 = 3 and 4k + 1 = 5) and hence the only possibility is k = z = 1.
So in brief, the only possible solution to the given equation is (x, y, z) = (2, 0, 1).
3
(c) If both y and z are greater than zero then we have no solution because in modulo 3 we have 1−0 = 0
which is nonsensical. Hence, if we have any solution then y or z must be zero. So, we have two cases:
• y = 0 and hence 4x − 1 = 15z . This equation was solved in part (b) where we found that the solution
is (x, y, z) = (2, 0, 1).
• z = 0 and hence 4x − 3y = 1. This equation was solved in Problem 3 of § 4.1.7 of V1 where we found
that its only solution is x = y = 1. Hence, in this case we have (x, y, z) = (1, 1, 0).
So in brief, the only solutions to the given equation are (x, y, z) = (2, 0, 1) and (1, 1, 0).
(d) We obviously have parity violation unless:
• x 6= 0 and z = 0 and hence 4x + 15y = 1. This case has obviously no solution because the LHS is
greater than 1.
• x = 0 and z 6= 0 and hence 1 + 15y = 2z . Now:
If y = 0 then we have z = 1 and hence (x, y, z) = (0, 0, 1).
3
If y > 0 then on reducing the equation in modulo 3 we get 1 + 0 = 2z and hence z must be even (say
2 3
z = 2k where k ∈ N) because 2 z=0,1 = 1, 2. Therefore, we have:
1 + 15y = 22k → 15y = 22k − 1 → 15y = (2k − 1)(2k + 1)
Now, the difference between (2k − 1) and (2k + 1) is 2 and hence one of these factors must be of mag-
nitude 3 and the other of magnitude 5 (noting that no other possibility can match the factorization
of 15y ). Simple inspection will reveal that k must be 2 (i.e. z = 4) and hence y = 1. So, we have
(x, y, z) = (0, 1, 4).
So in brief, the given equation has only two solutions: (x, y, z) = (0, 0, 1) and (x, y, z) = (0, 1, 4).
(e) We obviously have parity violation unless:
• x 6= 0 and z = 0 and hence we have 4x + 5y = 1. The LHS is obviously greater than 1 and hence we
have no solution in this case.
4
• x = 0 and z 6= 0 and hence we have 1+5y = 6z . On reducing this equation in modulo 4 we get 1+1 = 2z
4
and hence z must be 1 (because 2 y=0,1,>1 = 1, 2, 0) and so we get the solution (x, y, z) = (0, 1, 1).
So in brief, the given equation has only one solution: (x, y, z) = (0, 1, 1).
(f ) We have two main cases to consider:
• xyz = 0: it is obvious that z must be greater than 0 to avoid parity violation (as well as magnitude
violation). Moreover, x and y cannot be both 0 because the LHS will become less than the RHS. So,
EITHER:
x = 0 and y 6= 0 and hence we have 1 + 9y = 14z . If we reduce this equation in modulo 4 we get
4 4
1 + 1 = 2z whose only solution is z = 1 (noting that 2 z=0,1,>1 = 1, 2, 0). However, 1 + 9y = 141 has no
solution and hence x = 0 and y 6= 0 do not lead to a solution to the given Diophantine equation. OR:
x 6= 0 and y = 0 and hence we have 13x + 1 = 14z . If we reduce this equation in modulo 4 we
4 4
get 1 + 1 = 2z whose only solution is z = 1 (noting that 2 z=0,1,>1 = 1, 2, 0). Accordingly, we have
13x + 1 = 141 whose solution is x = 1 and hence the given Diophantine equation has the solution
(x, y, z) = (1, 0, 1).
4 4
• xyz 6= 0: in modulo 4 we have 1 + 1 = 2z and hence z must be 1 (noting that 2 z=0,1,>1 = 1, 2, 0). So,
x y 1
we have 13 + 9 = 14 which has no solution because the LHS is greater than the RHS (noting that
x > 0 and y > 0).
5.4 Mixed Polynomial-Exponential Diophantine Equations 73

So in brief, the given equation has only one solution, i.e. (x, y, z) = (1, 0, 1).
(g) We have two main cases to consider:
• xyz = 0: it is obvious that x = y = z = 0 is not a possibility. Similarly, exactly two of the three
variables are zero is not a possibility. Regarding the case of exactly one of the three variables is zero,
we have:
z = 0 and hence 3x + 4y = 1 which has no solution because the LHS is > 1.
y = 0 and hence 3x + 1 = 5z which is impossible because of parity violation.
3
x = 0 and hence 1 + 4y = 5z . Now, in modulo 3 we have 1 + 1 = 2z and hence z is odd (say z = 2t + 1
2 3
where t ∈ N0 ) noting that 2z=0,1 = 1, 2. So we have (see Eq. 12 in V1):
P2t P2t
1 + 4y = 52t+1 → 4y = 52t+1 − 1 → 4y = (5 − 1) k=0 5k → 4y = 4 k=0 5k
P2t k
Now, if y = 1 then we have 1 = k=0 5 and henceP t = 0, i.e. z = 1. So, we have the solution:
2t
(x, y, z) = (0, 1, 1). But if y > 1 then we have 4y−1 = k=0 5k . On reducing this equation in modulo
4 P2t
4 we get 0 = k=0 1 which is nonsensical because the sum on the RHS is odd. So, we have no more
solutions in this case.
3
• xyz 6= 0: if we reduce the equation 3x + 4y = 5z in modulo 3 we get 0 + 1 = (−1)z and hence z must
be even (say z = 2t where t ∈ N). Also, if we reduce the equation 3x + 4y = 5z in modulo 4 we get
4
(−1)x + 0 = 1 and hence x must be even. So in brief, both x and z are even. Accordingly:
3x + 4y = 5z → 3x + 22y = 52t → 52t − 22y = 3x → (5t − 2y )(5t + 2y ) = 3x
i.e. 5t − 2y = 3m and 5t + 2y = 3n (where m, n ∈ N0 with m < n and m + n = x). Now, if we add the
last two equations we get:
2(5t ) = 3m + 3n → 2(5t ) = 3m (1 + 3n−m )
Thus, m must be zero (because there is no factor on the LHS that can match a natural power of 3) and
hence we have:
5t − 2y = 1 and 5t + 2y = 3x
Now, if we reduce the equation 5t − 2y = 1 in modulo 3 we get:
3
(−1)t − (−1)y = 1
So, t must be odd and y must be even. Now:
If y = 2 then from the equation 5t − 2y = 1 we get t = 1 (i.e. z = 2) and hence x = 2. So, we have the
solution (x, y, z) = (2, 2, 2).
8
If y > 2 then if we reduce the equation 5t + 2y = 3x in modulo 8 we get 5t + 0 = 1 (since x is even
2 8 2 8
noting that 3x=0,1 = 1, 3) and hence t must be even (noting that 5t=0,1 = 1, 5). But this contradicts
what we found earlier that t is odd. So, this contradiction leads to the conclusion that y cannot be
greater than 2.
So in brief, the only solutions to the given equation are (x, y, z) = (0, 1, 1) and (2, 2, 2).

5.4 Mixed Polynomial-Exponential Diophantine Equations


1. Find all the solutions of the following Diophantine equations (where x ∈ Z and y ∈ N0 ):
(a) x2 + x + 1 = 3y . (b) x2 + x + 1 = 4y . (c) x2 + x + 1 = 5y .
Solution:
(a) We have three cases to consider:
• y = 0 and hence x2 + x = 0 whose solutions are x = 0 and x = −1. Hence, (x, y) = (0, 0) and
(x, y) = (−1, 0) are solutions.
• y = 1 and hence x2 + x − 2 = 0 whose solutions are x = −2 and x = 1. Hence, (x, y) = (−2, 1) and
(x, y) = (1, 1) are solutions.
9
• y > 1 and hence x2 +x+1 = 9(3y−2 ). Now, if we reduce this equation in modulo 9 we get x2 +x+1 = 0
which has no solution and hence the original equation has no solution.
5.4 Mixed Polynomial-Exponential Diophantine Equations 74

So in brief, the given Diophantine equation has only those four solutions.
(b) We have two cases to consider:
• y = 0 and hence (from part a) we get (x, y) = (0, 0) and (x, y) = (−1, 0).
4
• y > 0 and hence on reducing the equation x2 + x + 1 = 4y in modulo 4 we get x2 + x + 1 = 0 which
has no solution and hence the original equation has no solution.
So in brief, the given Diophantine equation has only those two solutions.[45]
(c) This is exactly like part (b) (but we reduce in modulo 5 instead of modulo 4) and hence the only
solutions are (x, y) = (0, 0) and (x, y) = (−1, 0).
2. Let x, y ∈ N0 . Show that 4x − 3y = z has no solution for z = 2, 4, 5, 6, 8, 9, 10, 11, 12.
Solution: We note first that if xy = 0 then there is no solution to 4x − 3y = z for any one of these
values of z (as direct test can easily reveal) and hence in the following we assume x, y > 0.
Now, (4x − 3y ) is odd for all x, y ∈ N and hence z cannot be 2, 4, 6, 8, 10, 12. Hence, 4x − 3y = z has
no solution for z = 2, 4, 6, 8, 10, 12.
3
Regarding 4x − 3y = 5, if we reduce this equation modulo 3 we get 1x = 2 which has no solution and
hence 4 − 3 = 5 has no solution (see § 2.7.6 of V1). This similarly applies to 4x − 3y = 11 and hence
x y

4x − 3y = 11 has no solution.
3
Regarding 4x − 3y = 9, if we reduce this equation modulo 3 we get 1x = 0 which has no solution and
hence 4x − 3y = 9 has no solution.
3. Solve the following Diophantine equations (where m, n ∈ N0 and k ∈ Z):
(a) 7m = 8n + 2k. (b) 7m = 8n + k.
Solution:
(a) We have 4 main cases:
• m = n = 0: the solution is (m, n, k) = (0, 0, 0).
• m = 0 and n > 0: there is no solution due to parity violation. 
m
• m > 0 and n = 0: the solutions are (m, n, k) = m, 0, 7 2−1 , e.g. (1, 0, 3), (2, 0, 24), (3, 0, 171).
• m > 0 and n > 0: there is no solution due to parity violation.
(b) We have 4 main cases:
• m = n = 0: the solution is (m, n, k) = (0, 0, 0).
• m = 0 and n > 0: the solutions are (m, n, k) = (0, n, 1 − 8n ), e.g. (0, 1, −7), (0, 2, −63), (0, 3, −511).
• m > 0 and n = 0: the solutions are (m, n, k) = (m, 0, 7m − 1), e.g. (1, 0, 6), (2, 0, 48), (3, 0, 342).
• m > 0 and n > 0: the solutions are (m, n, k) = (m, n, 7m − 8n ), e.g. (1, 1, −1), (1, 2, −57), (2, 1, 41),
(2, 2, −15).
4. Find all x, y ∈ N0 and z ∈ Z such that:
(a) 2x − 3y = z 2 . (b) 2x + 3y = z 2 .
Solution:
(a) We consider and inspect the following cases:
• x = 0: the only solution (by inspection) is (x, y, z) = (0, 0, 0) because the LHS must be non-negative.
• x = 1: the only solutions (by inspection) are (x, y, z) = (1, 0, ±1) because the LHS must be non-
negative.
• x = 2: the only solutions (by inspection) are (x, y, z) = (2, 1, ±1) because the LHS must be non-
negative.
8 2 8
• x > 2: there is no solution. This is because in modulo 8 we have 2x = 0 and 3 y=0,1 = 1, 3. Accordingly:
8 8 8 8
2x − 3y = z 2 → 0 − 1 = z 2 or 0 − 3 = z 2 → 7 = z 2 or 5 = z 2
Noting that 7 and 5 are quadratic non-residues of 8 (see § 1.6) we conclude that there is no solution to
the given Diophantine equation for x > 2.
So in brief, the given Diophantine equation has only the above five solutions.
(b) We consider and inspect the following cases:

[45] In
fact, we can obtain this result more easily by noting that y must be zero (to avoid parity violation) and hence we
must have only those two solutions.
5.4 Mixed Polynomial-Exponential Diophantine Equations 75

• x = 0: the only solutions are (x, y, z) = (0, 1, ±2). This is because 3y = z 2 − 1 = (z − 1)(z + 1) which
implies (considering the factorization of 3y noting as well that y = 0 is not a possibility) that one of
the factors (z − 1) and (z + 1) must be of unity magnitude (noting that the difference between z − 1
and z + 1 is 2) and hence z = ±2 which leads to the given solutions.
3
• x = 1: there is no solution. This is because in modulo 3 we have 21 + 0 = z 2 which has no solution
since 2 is a quadratic non-residue of 3.
8 2 8
• x = 2: there is no solution. This is because in modulo 8 we have 22 + 3y = z 2 . However, 3 y=0,1 = 1, 3
8 8
and hence we have either 5 = z 2 or 7 = z 2 which have no solution because 5 and 7 are quadratic
non-residues of 8.
• x > 2: the only solutions are (x, y, z) = (3, 0, ±3) and (4, 2, ±5). This is because in modulo 8 we have
8 2 8 8
2x = 0 and 3 y=0,1 = 1, 3 while z 2 = 0, 1, 4 and this implies that if we have any solution then y = 2k
(where k ∈ N0 ). Accordingly, the given Diophantine equation becomes:
2x + 32k = z 2 → 2x = z 2 − 32k → 2x = (z − 3k )(z + 3k )
i.e. z − 3k = 2m and z + 3k = 2n (where m, n ∈ N with m < n and m + n = x).[46] Now, if we subtract
the first of the last two equations from the second we get:
2(3k ) = 2n − 2m → 3k = 2m−1 (2n−m − 1)
Now, 3k is odd and hence both 2m−1 and (2n−m − 1) must be odd, and this implies m = 1 and hence
3k = 2n−1 − 1. Accordingly:
If n = 1 then we have 3k = 21−1 − 1 = 0 which has no solution (noting that k ∈ N0 ).[47]
If n = 2 then we have 3k = 22−1 − 1 = 1 which has only one solution, i.e. k = 0. As a result, we have
x = m + n = 1 + 2 = 3 and y = 2k = 2(0) = 0 and hence (x, y, z) = (3, 0, ±3).
If n = 3 then we have 3k = 23−1 − 1 = 3 which has only one solution, i.e. k = 1. As a result, we have
x = m + n = 1 + 3 = 4 and y = 2k = 2(1) = 2 and hence (x, y, z) = (4, 2, ±5).
8 8 8
If n > 3 then we have 2n−1 = 0 and hence we get 3k = 0 − 1 = 7 which has no solution since the
8
residues of 3k (modulo 8) are either 1 or 3 and hence 3k 6= 7. This means that there is no solution to
the given Diophantine equation for n > 3 (i.e. x > 4).
So in brief, the given Diophantine equation has only the above six solutions.
5. Find all x, y ∈ N0 and z ∈ Z such that:
(a) 3x − 4y = z 2 . (b) 4x − 3y = z 2 . (c) 4x + 3y = z 2 . (d) 3x + 5y = z 2 .
Solution:
(a) For x = 0 the only solution (by inspection) is (x, y, z) = (0, 0, 0) because the LHS must be non-
negative.
For x > 0 there is no solution. This is because if we reduce the given equation in modulo 3 we get
3 3
−1 = z 2 (i.e. 2 = z 2 ) which has no solution because 2 is a quadratic non-residue of 3 (see § 1.6). So,
the only solution to the given equation is (x, y, z) = (0, 0, 0).
(b) For x = 0 the only solution (by inspection) is (x, y, z) = (0, 0, 0) because the LHS must be non-
negative.
For x = 1 the only solutions (by inspection) are (x, y, z) = (1, 1, ±1) because the LHS must be non-
negative.
For x > 1 there is no solution. This is because if we reduce the given equation in modulo 8 we get
8 8 8 8 2 8
0−1 = z 2 or 0−3 = z 2 (i.e. 7 = z 2 or 5 = z 2 ) since 3 y=0,1 = 1, 3. However, neither of these congruences
has a solution because 7 and 5 are quadratic non-residues of 8 (see § 1.6). So, the only solutions are
(x, y, z) = (0, 0, 0) and (1, 1, ±1).
(c) If we write this equation as 2X + 3y = z 2 (where X = 2x) then this equation is the same as the

[46] Although z ∈ Z we can make z ∈ N at this stage noting that z is squared and hence its sign does not matter; moreover
within the imposed conditions z cannot be 0. We should also note that 2x + 32k = z 2 implies that z is odd and hence
z − 3k 6= 1.
[47] In fact, we can also rule out this possibility by the condition m < n noting that m = 1.
5.5 Diophantine Equations Involving Roots 76

equation of part (b) of Problem 4 (with X replacing x). Now, if we note that X = 2x then we can
conclude (by using the solutions of part b of Problem 4) that the only solutions to the given equation
are (x, y, z) = (0, 1, ±2) and (2, 2, ±5).
(d) We have three cases to consider and inspect:
• x = 0: i.e. 5y = z 2 − 1 = (z − 1)(z + 1). Noting that the difference between (z − 1) and (z + 1) is 2,
we can see that no value of z can make these expressions non-negative powers of 5. Hence, we have no
solution in this case. 2
3 3
• x = 1: if we reduce the equation in modulo 3 we get 5y = z 2 . Now, 5 y=0,1 = 1, 2 and hence y must
be even (noting that 2 is not a quadratic residue of 3). So, the original equation becomes 3 + 52k = z 2
(where k ∈ N0 ), i.e. 3 = z 2 − 52k = (z − 5k )(z + 5k ). Therefore, one of the factors (z − 5k ) and
(z + 5k ) must be of magnitude 1 while the other must be of magnitude 3. Simple algebraic inspection
shows that we must have k = 0 (and hence y = 0) and z = ±2. So, the only solutions in this case are
(x, y, z) = (1, 0, ±2).
• x > 1: we note first that z must be even (because the LHS is even) and hence z 2 is a multiple of 4.
4 2 4
Now, if we reduce the equation in modulo 4 then we get 3x + 1 = 0. So, if we note that 3x=0,1 = 1, 3
then x must be odd (say x = 2s + 1 where s ∈ N). Hence, the given equation becomes 32s+1 + 5y = z 2 .
Now, EITHER:
y = 0 and hence:
32s+1 + 1 = z 2 → 32s+1 = z 2 − 1 → 32s+1 = (z − 1)(z + 1)
However, the difference between (z − 1) and (z + 1) is 2 and this implies that 32s+1 must be made of
a factor of magnitude 1 and another factor of magnitude 3, i.e. s = 0 which is impossible because we
are currently assuming x > 1 (i.e. s ∈ N) although we should note that this will lead to the previous
solutions, i.e. (x, y, z) = (1, 0, ±2). OR:
5
y > 0 and hence if we reduce the equation 32s+1 + 5y = z 2 in modulo 5 then we get 32s+1 = z 2 which
5
has no solution. This is because 32s+1 = 2, 3 (corresponding to s odd and s even) and hence we must
5
have z 2 = 2, 3 which has no solution because 2 and 3 are quadratic non-residues of 5. This means that
for x > 1 we have no solution.
So in brief, the given Diophantine equation has only the two solutions: (x, y, z) = (1, 0, ±2).

5.5 Diophantine Equations Involving Roots


1. Find all x, y ∈ Z that satisfy the following equations:
√ √ √ √ √ √ √
(a) x + y = 5. (b) x − y = 5. (c) x − 3 y = 5. (d) x + 3 y = 5.
√ √ √ √ √ √
(e) 3 x + 3 y = 13. (f ) 3 x − 3 y = 13. (g) 3x + y = 21. (h) 5x + 3 y = 128.
Solution:
(a) x and y must be perfect squares.[48] So, the easiest way to solve an equation like this is to enumerate
over the perfect squares x, y = 0, 1, 4, 9, 16, 25 (noting that exceeding 25 will make the LHS greater than
5). If we do so we get the following (x, y) solutions:
(0, 25) (1, 16) (4, 9) (9, 4) (16, 1) (25, 0)
√ √ √
(b) If we write the equation as x = y + 5 and square it we get x = y + 10 y + 25. Accordingly, y
must be a perfect square. So, if y = s2 (where s ∈ Z) then the solutions are (x, y) = (s2 +10 |s|+25, s2 ).
(c) y must be a perfect cube (say y = s3 where s ∈ Z) and hence x = 5 + s. So, the solutions are
(x, y) = (5 + s, s3 ).
(d) We have two cases: √
• y ≥ 0 and hence the only possible values of x are 0, 1, 2, 3, 4, 5 (noting that other values will make
the LHS > 5). This leads to the following (x, y) solutions:
(0, 125) (1, 64) (4, 27) (9, 8) (16, 1) (25, 0)
[48] Although
the algebraic√sum of two irrational numbers can be rational (or integer) this does not apply here and hence we

can assume here that x and y must be integers.
5.5 Diophantine Equations Involving Roots 77


• y < 0 and hence if y = s3 (wheres ∈ Z) then x − |s| = 5, i.e. x = (5 + |s|)2 . So, the solutions in
this case are: (x, y) = [5 + |s|]2 , s3 .
So in brief, the solutions of the given equation are the union of the sets of solutions in these two cases.
(e) If x = k 3 (where k ∈ Z) then:
√ √ √ √
3
x + 3 y = 13 → k + 3 y = 13 → 3 y = 13 − k → y = (13 − k)3
So, the solutions are: (x, y) = (k 3 , [13 − k]3 ).
(f ) If we follow the approach of part (e) then we get: (x, y) = (k 3 , [k − 13]3 ).

(g) Let y = s (i.e. y = s2 ) where s ∈ N0 and hence s = 21 − 3x where (21 − 3x ) ≥ 0 and x ∈ N0 .
It is obvious that only x = 0, 1, 2 satisfy the condition (21 − 3x ) ≥ 0 and hence the solutions are:
(x, y) = (0, 400), (1, 324) and (2, 144).

(h) Let 3 y = s (i.e. y = s3 ) where s ∈ Z and hence s = 128 − 5x where x ∈ N0 . Therefore, the
solutions are: (x, y) = (k, [128 − 5k ]3 ) where k ∈ N0 .
2. Find all x, y, z ∈ Z that satisfy the following equations:
√ √ √ √ √ √ √ √ √
(a) x + y + z = 5. (b) x − y − z = 5. (c) x + y − z = 5.
√ √ √ √ √ √
(d) x + y + 3 z = 5. (e) x y + y x = z. (f ) 3x + 5y − 3 z = 7.
Solution:
(a) If we do what we did in part (a) of Problem 1 we get the following (x, y, z) solutions:
(0, 0, 25) (0, 1, 16) (0, 4, 9) (0, 9, 4) (0, 16, 1) (0, 25, 0) (1, 0, 16)
(1, 1, 9) (1, 4, 4) (1, 9, 1) (1, 16, 0) (4, 0, 9) (4, 1, 4) (4, 4, 1)
(4, 9, 0) (9, 0, 4) (9, 1, 1) (9, 4, 0) (16, 0, 1) (16, 1, 0) (25, 0, 0)
2 2 2 0
(b) Let x = k , y = s and z = t where k, s, t ∈ N . So, we can write the given equationas k −s−t = 5,
i.e. k = 5 + s + t. Accordingly, the solutions are given by: (x, y, z) = [5 + s + t]2 , s2 , t2 . For example,
given s = 2 and t = 7 we get the solution (x, y, z) = (196, 4, 49).
(c) We have 3 cases:
• x = z and hence y must be 25. Thus the solutions are: (x, y, z) = (k, 25, k) where k ∈ N0 .
• y = z and hence x must be 25. Thus the solutions are: (x, y, z) = (25, k, k) where k ∈ N0 .
• x 6= z and y 6= z and hence x, y, z are perfect squares. So, let x = k 2 , y = s2 and z = t2 (where
k, s, t ∈ N0 ) and hence we can write the given equation ask + s − t = 5, i.e. t = k + s − 5. Accordingly,
the solutions are given by: (x, y, z) = k 2 , s2 , [k + s − 5]2 . However, we need to impose the condition
that (k + s) ≥ 5. For example, given k = 2 and s = 7 we get the solution (x, y, z) = (4, 49, 16).
(d) We have two cases to consider:
• z ≥ 0 and hence if we do what we did in part (a) we get the following (x, y, z) solutions:
(0, 0, 125) (0, 1, 64) (0, 4, 27) (0, 9, 8) (0, 16, 1) (0, 25, 0) (1, 0, 64)
(1, 1, 27) (1, 4, 8) (1, 9, 1) (1, 16, 0) (4, 0, 27) (4, 1, 8) (4, 4, 1)
(4, 9, 0) (9, 0, 8) (9, 1, 1) (9, 4, 0) (16, 0, 1) (16, 1, 0) (25, 0, 0)
3
√ √ √ √
•√z < 0 and hence if z = t (where t ∈ Z) then x + y − |t| = 5, i.e. |t| = x + y − 5 where

( x + y) > 5. Therefore, the solutions in this case are: (x, y, z) = k 2 , s2 , [5 − k − s]3 where
k, s ∈ N0 and 5 < (k + s).
So in brief, the solutions of the given equation are the union of the sets of solutions in these two cases.[49]
(e) x and y are perfect squares and hence
 let x = k 2 and y = s2 where k, s ∈ Z. Therefore, the solutions
2 2 2 2
are: (x, y,
√ z) = k , s , k |s| + s |k| .
(f ) Let 3 z = t (i.e. z = t3 ) where t ∈ Z and hence t = 3x + 5y − 7 where x, y ∈ N0 . Therefore, the
solutions are: (x, y, z) = (k, s, [3k + 5s − 7]3 ) where k, s ∈ N0 .

[49] We note that the solution in the second case applies even to the solutions of the first case (by keeping the condition
k, s ∈ N0 and dropping the condition 5 < k + s) and hence we could have considered only one case. However, we preferred
to deal with two separate cases to show the finitely many solutions in the case of z ≥ 0 and the infinitely many solutions
in the case of z < 0.
5.6 Diophantine Equations Involving Fractions 78

5.6 Diophantine Equations Involving Fractions


1. Find all x, y ∈ Z that satisfy the following equations:
(a) x1 + y1 = 1. (b) x1 + y1 = 5. (c) x1 + y1 = 23 . (d) x1 + y2 = 43 .
Solution:
(a) xy 6= 0. On multiplying the two sides by xy we get x + y = xy, i.e. xy − x − y + 1 = 1 and hence
(1 − x)(1 − y) = 1. So, 1 − x = −1 and 1 − y = −1 (i.e. x = y = 2) or 1 − x = 1 and 1 − y = 1 (i.e.
x = y = 0 which is not acceptable). Therefore, the only solution is x = y = 2. Also see Problem 9 of §
5.2.
(b) xy 6= 0. The maximum value of the LHS is 2 (i.e. when x = y = 1) and hence this equation has no
solution.
(c) xy 6= 0. Also, x and y cannot be both negative. Hence, we have two main cases: both x and y are
positive or one negative and one positive. In the following we investigate these cases where we exploit
the symmetry in x and y:
• Both positive: x = 1 is not possible because the LHS becomes > 2/3 (noting that y > 0). x = 2 leads
to the solutions: (x, y) = (2, 6) and (x, y) = (6, 2). x = 3 leads to the solution: (x, y) = (3, 3). x = 4
and x = 5 do not lead to solutions. x = 6 was already found by symmetry. x ≥ 7 do not lead to any
solution because the LHS becomes either > 2/3 (i.e. if y = 1) or < 2/3 (i.e. if y > 1).
• Only one positive: x = 1 leads to the solutions: (x, y) = (1, −3) and (x, y) = (−3, 1). x > 1 do not
lead to any solution because the LHS becomes < 2/3.
So in brief, we have only 5 solutions: (x, y) = (2, 6), (6, 2), (3, 3), (1, −3), (−3, 1).
(d) xy 6= 0. Let us use a method similar to the method of part (c) and hence we have three main cases:
• Both positive: y = 1, 2 are not possible because the LHS becomes > 3/4. y = 3 leads to x = 12.
y = 4 leads to x = 4. y = 5, 6, 7 do not lead to solutions. y = 8 leads to x = 2. y > 8 do not lead to
any solution because the LHS becomes either > 3/4 (i.e. when x = 1) or < 3/4 (i.e. when x > 1).
• Only x positive: x = 1 leads to y = −8. x > 1 do not lead to any solution because the LHS becomes
< 3/4.
• Only y positive: y = 1 is not possible because the LHS becomes > 3/4. y = 2 leads to x = −4. y > 2
do not lead to any solution because the LHS becomes < 3/4.
So in brief, we have only 5 solutions: (x, y) = (12, 3), (4,4), (2,8), (1, −8), (−4, 2).
2. Find all x, y, z ∈ Z that satisfy the following equations:
(a) x1 + y1 + z1 = 1. (b) x1 + y1 + z1 = 2. (c) x1 + y1 + z1 = 3. (d) x1 + y1 + z1 = 4.
Solution: We solved these equations in V1 for x, y, z ∈ N (see Problem 7 of § 4.1.10 of V1). So, all we
need to do here is to consider the possibility of having more solutions with some (but not all) of the
variables being negative (noting that none of the variables can be 0, i.e. we must have xyz 6= 0).
(a) The solutions are the same as the solutions of Problem 19 of § 5.2 (of the present volume) excluding
the zero solutions, i.e. any (x, y, z) such that xyz = 0.
(b) If any one of the variables is negative then the LHS will be less than the RHS. Hence, the solutions
are only those with x, y, z ∈ N (which we found in V1), i.e. (x, y, z) = (1, 2, 2), (2, 1, 2), (2, 2, 1).
(c) As in part (b), no one of the variables can be negative (for the same reason), and hence the solutions
are only those with x, y, z ∈ N (which we found in V1), i.e. (x, y, z) = (1, 1, 1).
(d) This equation has no solution because the LHS cannot be greater than 3, i.e. when x = y = z = 1.
3. Investigate the solutions of the following Diophantine equation:

x2 y + x + y
=z
xy 2 + y + a
where x, y, z ∈ N and a is a specific natural number.
Solution: We have two categories of solutions for this equation:
(a) Solutions of general type, i.e. those solutions that can be inferred from the form of this equation.
We can easily identify two solutions of general type:
5.6 Diophantine Equations Involving Fractions 79

• (x, y, z) = (az 2 , az, z): this is because:

x2 y + x + y (az 2 )2 (az) + az 2 + az a3 z 5 + az 2 + az a3 z 4 + az + a
2
= 2 2
= 3 4 = 3 4 z=z
xy + y + a (az )(az) + az + a a z + az + a a z + az + a

• (x, y, z) = (a2 , 1, a2 − a + 1): this is because:

x2 y + x + y (a2 )2 (1) + a2 + (1) a4 + a2 + 1 (a2 + a + 1)(a2 − a + 1)


2
= 2 2
= 2 = = a2 − a + 1 = z
xy + y + a (a )(1) + (1) + a a +a+1 a2 + a + 1

(b) Solutions of special type, i.e. those solutions that depend (in their existence and nature) on the
specific a. For example, if a = 5 then (x, y, z) = (11, 2, 5) is also a solution to this equation while
if a = 13 then (x, y, z) = (47, 1, 37) and (49, 2, 23) are also solutions. These solutions should be
investigated within the specific problem (as determined by the specific value of a).
4. Investigate the solutions of the following equations:
(a) xy + xy = z (x, y, z ∈ Z). (b) x1 + y1 = z1 (x, y, z ∈ N).
Solution:
(a) It is obvious that y 6= 0 and x must be divisible by y. So, if y = s (where Z ∋ s 6= 0) then x = ks
(where k ∈ Z) and hence z = k +ks2 . So, the solution of the given equation is (x, y, z) = (ks, s, k +ks2 ).
(b) Let x = k and y = s where k, s ∈ N. Hence:
1
x + y1 = z1 → 1 1
k + s = z
1
→ k+s
ks = z
1
→ ks
z = k+s
Now, since z ∈ N then we must  impose the condition that (k + s)|(ks). So, the general solution of the
ks
given equation is: (x, y, z) = k, s, k+s where k, s ∈ N and (k + s)|(ks). The following are some of the
specific solutions:
(2, 2, 1) (3, 6, 2) (4, 4, 2) (4, 12, 3) (5, 20, 4) (6, 3, 2) (6, 6, 3)
It is worth noting that the solution (x, y, z) = (2n, 2n, n) (which is a special case of the above general
solution) applies to all n ∈ N.
5. Find all the solutions of the equation xy + xy = a (where x, y ∈ Z) for a = 0, 1, 2.
Solution: This equation is the same as the equation of part (a) of Problem 4. So, all we need to do is
to find k, s ∈ Z such that k + ks2 = 0, 1, 2. Now:
• For a = 0 we have k + ks2 = k(1 + s2 ) = 0. So, k = 0 (noting that 1 + s2 6= 0) and hence the solution
of the given equation is (x, y) = (0, s) where Z ∋ s 6= 0.
• For a = 1 we have k + ks2 = 1 which has no solution for k = 0. For k 6= 0 we divide the equation by
k to obtain 1 + s2 = 1/k which implies that k|1 and hence k = ±1. Now:
If k = −1 then we have s2 + 2 = 0 which has no solution.
If k = 1 then we have s2 = 0 (i.e. s = 0) which is not acceptable.
So in brief, for a = 1 the given equation has no solution.[50]
• For a = 2 we have k + ks2 = 2 which has no solution for k = 0. For k 6= 0 we divide the equation by
k to obtain 1 + s2 = 2/k which implies that k|2 and hence k = ±1, ±2. Now:
For k = −1 we have s2 + 3 = 0 which has no solution.
For k = +1 we have s2 − 1 = 0 (i.e. s = ±1) and hence (x, y) = (1, 1) and (x, y) = (−1, −1).
For k = −2 we have s2 + 2 = 0 which has no solution.
For k = +2 we have s2 = 0 (i.e. s = 0) which is not acceptable.
So in brief, for a = 2 the given equation has only two solutions: (x, y) = (1, 1) and (x, y) = (−1, −1).
6. Find all x, y, z ∈ N such that: z = x1 + y1 + xy
2
.
Solution: If we multiply the two sides by xy we get xyz = x + y + 2. Now, we have two cases:
• z = 1 and hence xy = x + y + 2. Now, it is obvious that x = 1 or y = 1 is not a possibility (because
we get 0 = 3). So, we must have x > 1 and y > 1. However, if x > 1 and y > 1 then the LHS of
[50] Another (and simpler) approach to reach this conclusion is that x and y must have the same sign (because otherwise the
sum will be negative) and hence (whether x ≥ y or x < y) the LHS must be greater than 1 (noting that xy = 0 is not a
possibility), i.e. the equation has no solution.
5.6 Diophantine Equations Involving Fractions 80

xy = x + y + 2 becomes greater than its RHS if x > 4 or y > 4. So, all we need to do is to test
the (nine) combinations of x = 2, 3, 4 and y = 2, 3, 4 (to see which combinations satisfy the equation
xy = x + y + 2). On doing so we get only two solutions: (x, y, z) = (2, 4, 1) and (4, 2, 1).
• z > 1 and hence the LHS of xyz = x + y + 2 becomes greater than its RHS if x > 3 or y > 3. So, all
we need to do is to test the (nine) combinations of x = 1, 2, 3 and y = 1, 2, 3 (to obtain the values of
z corresponding to these combinations). On doing so we get only three solutions: (x, y, z) = (1, 1, 4),
(1, 3, 2) and (3, 1, 2).
So in brief, the given equation has only these five solutions.
7. Find all x, y, z ∈ N that satisfy the following equations:
(a) x3 + y7 = z. (b) x1 + y2 + z3 = 4.
Solution:
(a) The LHS cannot exceed 10 (i.e. when x = y = 1). Therefore, all we need to do is to solve the
equation: x3 + y7 = z for z = 1, 2, . . . , 10. Accordingly:
• x3 + y7 = 1: we must have x > 3 and y > 7 (because otherwise the LHS becomes > 1). We must also
have x < 25 and y < 29 (because otherwise the LHS becomes < 1). So, on testing these possibilities
(i.e. x = 4, 5, . . . , 24 and y = 8, 9, . . . , 28) we find the following four solutions: (x, y, z) = (4, 28, 1),
(6, 14, 1), (10, 10, 1) and (24, 8, 1).
• x3 + y7 = 2: by a similar argument to that in the previous point we must have 1 < x < 13 and 3 < y <
15, and hence on testing these possibilities we find the following four solutions: (x, y, z) = (2, 14, 2),
(3, 7, 2), (5, 5, 2) and (12, 4, 2).
• For z = 3, 6, 7, 9 we find no solution.
• For z = 4, 5, 8, 10 we find the following five solutions: (x, y, z) = (1, 7, 4), (6, 2, 4), (2, 2, 5), (3, 1, 8)
and (1, 1, 10).
So in brief, this equation has only these 13 solutions.
(b) If z > 3 then the LHS becomes less then 4. So, we must have z = 1, 2, 3 and hence:
• z = 1 and hence x1 + y2 = 1. Now, we must have x > 1 and y > 2. However, if y > 2 then we must
have x < 4. So in brief, we must have x = 2, 3 that is: y2 = 12 (i.e. y = 4) and y2 = 32 (i.e. y = 3). So,
we found the following two solutions: (x, y, z) = (2, 4, 1) and (3, 3, 1).
• z = 2 and hence x1 + y2 = 25 , i.e. x2 + y4 = 5. Now, we must have y = 1 and hence x = 2. So, we found
the following solution: (x, y, z) = (2, 1, 2).
• z = 3 and hence x1 + y2 = 3. The only possibility in this case is x = y = 1. So, we found the following
solution: (x, y, z) = (1, 1, 3).
So in brief, this equation has only these 4 solutions.
8. Find all x, y, z ∈ N that satisfy the following equations:
(a) xy + yz + xz = 1. (b) xy + yz + xz = 2. (c) xy + yz + xz = 3.
Solution:[51]
(a) The LHS of this equation is greater than 1 because at least one of the variables is greater than or
equal to another variable and hence one term at least is greater than or equal to 1 and thus the sum
of the three terms must be greater than 1 (noting that the sum of the other two terms is greater than
0).[52] Hence, this equation has no solution.
(b) We have two cases to consider:
• The triple equality x = y = z does hold and hence the LHS of the equation is 3, i.e. there is no
solution.
• The triple equality x = y = z does not hold and hence one of the variables x, y, z must be greater
than another variable. So, let assume (without loss of generality since it is a matter of labeling) that x
is the greater variable. Hence, (with a proper labeling of y and z) we have one of the following three
situations:
⋆ x = y > z and hence xy = 1 while yz > 1. So, the LHS is greater than 2, i.e. there is no solution.
[51] We refer the reader to Problem 8 of § 7.3 for another method for solving this Problem.
[52] For example, if x ≥ y ≥ z then (x/y) ≥ 1 while if x ≤ y ≤ z then (z/x) ≥ 1.
5.7 Diophantine Equations Involving Roots and Fractions 81

⋆ x > y = z and hence xy > 1 while yz = 1. So, the LHS is greater than 2, i.e. there is no solution.
⋆ x > y > z and hence xy > 1 and yz > 1. So, the LHS is greater than 2, i.e. there is no solution.
So in brief, this equation has no solution.
(c) We have two cases to consider:
• The triple equality x = y = z does hold and hence the LHS of the equation is 3. So, in this case we
have the solution (x, y, z) = (k, k, k) where k ∈ N.
• The triple equality x = y = z does not hold and hence one of the variables x, y, z must be greater
than another variable. So, let assume (without loss of generality) that x is the greater variable. Hence,
we have one of the following three situations:
⋆ x = y > z and hence we have:
1 + xz + xz = 3 → x z
z + x =2 → x2 − 2xz + z 2 = 0 → (x − z)2 = 0
i.e. x = z which is a contradiction. Hence, there is no solution.
⋆ x > y = z and hence we have:
x y x y
y +1+ x =3 → y + x =2 → x2 − 2xy + y 2 = 0 → (x − y)2 = 0
i.e. x = y which is a contradiction. Hence, there is no solution.
⋆ x > y > z and hence x = z + a and y = z + b where 2 ≤ a and 1 ≤ b with a > b. Accordingly:
x y z z+a z+b z
+ + = + +
y z x z+b z z+a
a2 z + ab2 + 2abz + 3az 2 + b2 z + 3bz 2 + 3z 3
=
abz + az 2 + bz 2 + z 3
2(abz + az + bz 2 + z 3 ) a2 z + ab2 + az 2 + b2 z + bz 2 + z 3
2
= +
abz + az 2 + bz 2 + z 3 abz + az 2 + bz 2 + z 3
a z + ab + az + b z + bz + z 3
2 2 2 2 2
= 2+
abz + az 2 + bz 2 + z 3
a z + ab2 + b2 z + (az 2 + bz 2 + z 3 )
2
= 2+
abz + (az 2 + bz 2 + z 3 )

Now, (a2 z + ab2 + b2 z) > abz (noting that a2 z > abz since a > b) and hence the last term in the last
equation is greater than 1, i.e. the LHS of the given equation is greater than 3 and hence there is no
solution.
So in brief, the only solution of this equation is (x, y, z) = (k, k, k) where k ∈ N.

5.7 Diophantine Equations Involving Roots and Fractions


1. Find all x, y ∈ N that satisfy the following equations:
(a) √1x + √1y = 12 . (b) √1x + √1y = 13 . (c) √1x − √1y = 12 . (d) √1x − √1y = 31 .
Solution: We note first that the square roots of all positive integers (excluding perfect squares) are
irrational, and hence if a square root of an integer is rational then the integer is a perfect square (i.e.
the square root is an integer).
(a) We have:

y−2
√1 + √1y = 12 → √1 = 1
− √1 → √1 = √ →
x x 2 y x 2 y
 2  √ 2 √

y−2 y−4 y+4 xy+4x−4y
√1 = √ → 1
= → y=
x 2 y x 4y 4x
2
Therefore, y must be a perfect square (say y = s where s ∈ N) noting that the RHS is rational. By a
similar argument (or by symmetry) x must also be a perfect square. Hence:
√  2
y−4 y+4 4s2
1
x = 4y → x = y−44y

y+4 → x = s2 −4s+4 → x = s−2 2s

2s
Therefore, s − 2 must divide 2s (since x is a perfect square noting as well that s−2 is rational). Now,
s − 2 divides 2s − 4 and s − 2 supposedly divides 2s and hence s − 2 divides their difference which is 4.
5.8 Diophantine Equations Involving Factorials 82

So, s − 2 = ±1, ±2, ±4 and hence s = 1, 3, 4, 6 (where we take only the positive values of s). On trying
 2
2s
these values of s on the equation x = s−2 we find that only s = 3, 4, 6 produce valid solutions to
the original equation.
So in brief, the solutions of the given Diophantine equation are: (x, y) = (36, 9), (16, 16) and (9, 36).
 2
3s
(b) If we repeat the argument of part (a) with replacing 2 by 3 we get x = s−3 and hence s − 3
divides 9. So, s − 3 = ±1, ±3, ±9 and hence s = 2, 4, 6, 12 (where we take only the positive values of
 2
3s
s). On trying these values of s on the equation x = s−3 we find that only s = 4, 6, 12 produce valid
solutions to the original equation.
So in brief, the solutions of the given Diophantine equation are: (x, y) = (144, 16), (36, 36) and (16, 144).
(c) We choose to solve this part (more simply) √ by a logical argument (rather than by a mathematical
argument as we did in part a), that is: 1/ x must √ be 1 because otherwise the LHS will be less than
1/2 (noting that the√highest magnitude that 1/ x can assume if it is not 1 is 1/2 since x must be a

perfect square). So, x must be 1 (i.e. x = 1) and hence y must be 2 (i.e. y = 4).
So in brief, we have only one possible solution, i.e. (x, y) = (1, 4).
(d) We
√ argue logically (similar to what we did in part c) that is: √
• 1/ x cannot be 1 because otherwise the LHS will be either 0 (i.e. if 1/ y is 1) or greater than 1/3
√ √
(i.e. if 1/ y is less than 1 noting that the highest magnitude that 1/ y can assume if it is less than 1
is 1/2
√ since y must be a perfect square).
• 1/ x cannot be less√ than 1/2 because otherwise the LHS will be less than 1/3 (noting that the highest
magnitude that √ 1/ x can assume if it is less than 1/2 is 1/3 since x must be a perfect square).

Therefore, 1/ x must be 1/2 (i.e. x = 4) and hence 1/ y must be 1/6 (i.e. y = 36).
So in brief, we have only one possible solution, i.e. (x, y) = (4, 36).
2. Find all x, y, z ∈ N that satisfy the following equations:
(a) √1x + √1y + √1z = 2. (b) √1x + √1y = √1z .
Solution:
(a) x, y, z must be perfect squares (for reasons explained earlier). Now:
If all the square roots are greater than 1 then the LHS will be less than 2, and this implies that at least
one of the square roots must be 1 (i.e. at least one of the variables must be 1).
If more than one of the square roots are 1 then the LHS will be greater than 2, and this implies that
exactly one of the square roots must be 1 (i.e. exactly one of the variables must be 1).
If one of the remaining square roots is greater than 2 then the LHS will be less than 2, and this implies
that one of the remaining square roots must be 2 (i.e. one of the remaining variables must be 4).
Accordingly, the other remaining variable must be 4.
So in brief, the solutions of the given equation are: (x, y, z) = (1, 4, 4), (4, 1, 4) and (4, 4, 1).
We finally note that a simpler approach is to use the solutions of part (b) of Problem 2 of § 5.6 by
squaring the variables since the given equation is equivalent to X1 + Y1 + Z1 = 2 where X, Y, Z represent
the square roots of x, y, z. However, we preferred the above approach for the sake of diversity and
because it is not dependent on having the solutions of another equation (noting that we use the method
of comparison occasionally; see part b).
(b) If we write this equation as X1 + Y1 = Z1 (where these capital symbols represent radicals of their
corresponding variables) then we can obtain the solutions of the given equation from the solutions of
the equation of part (b) of Problem 4 of § 5.6 by squaring the values of the variables of those solutions.
The following are some solutions (corresponding to the sample solutions given in Problem 4 of § 5.6):
(4, 4, 1) (9, 36, 4) (16, 16, 4) (16, 144, 9) (25, 400, 16) (36, 9, 4) (36, 36, 9)

5.8 Diophantine Equations Involving Factorials


1. Show that the following equations have no solutions (where x ∈ Z and y ∈ N0 ):
(a) 11x − y! = 13. (b) 15x − 19y! = 538. (c) x3 + 13y! = 31.
5.8 Diophantine Equations Involving Factorials 83

Solution:
13
(a) By inspection, this equation has no solution for y < 13. For y ≥ 13 we have 11x = 0 whose only
solution is x = 13k where k ∈ Z. On substituting this in the given equation we get:
11(13k) − y! = 13 → y!+13
k = 11×13 → k = (y!/13)+1
11
Now, 11 divides y!/13 (noting that y ≥ 13) but it does not divide 1 and hence 11 does not divide
(y!/13) + 1. This means that there is no integer k that satisfies the given equation and hence the given
equation has no solution.
7
(b) By inspection, this equation has no solution for y < 7. For y ≥ 7 we have x = 6, i.e. x = 6 + 7k
where k ∈ Z. On substituting this in the given equation we get:
15(6 + 7k) − 19y! = 538 → k = 19y!+448
105
Now, 105 divides 19y! (noting that 105 = 3 × 5 × 7 and y ≥ 7) but it does not divide 448 and hence
105 does not divide 19y! + 448. This means that there is no integer k that satisfies the given equation
and hence the given equation has no solution.
7
(c) By inspection, this equation has no solution for y < 7. For y ≥ 7 we have x3 = 3 which has no
solution. Hence, the given equation has no solution.
2. Find all the solutions of the following equations (where x ∈ Z and y ∈ N0 ):
(a) x2 − y! = 2. (b) x2 − y! = 3. (c) x2 − y! = 1. (d) 16x + 9y! = 121.
Solution:
3 3
(a) For y > 2 we have x2 = 2. However, x2 = 2 has no solution (because 2 is quadratic non-residue of
3; see § 1.6). So, if there is any solution then we must have y = 0 (and hence x2 − 1 = 2 which has no
solution) or y = 1 (and hence x2 − 1 = 2 which has no solution) or y = 2 (and hence x2 − 2 = 2, i.e.
x = ±2). So, the solutions are: (x, y) = (±2, 2).
4 4
(b) For y > 3 we have x2 = 3. However, x2 = 3 has no solution (because 3 is quadratic non-residue of
4). So, if there is any solution then we must have y = 0 (and hence x2 − 1 = 3, i.e. x = ±2) or y = 1
(and hence x2 − 1 = 3, i.e. x = ±2) or y = 2 (and hence x2 − 2 = 3 which has no solution) or y = 3
(and hence x2 − 6 = 3, i.e. x = ±3). So, the solutions are: (x, y) = (±2, 0), (±2, 1), (±3, 3).
(c) This is known as Brocard’s problem. The only known solutions are: (x, y) = (±5, 4), (±11, 5),
(±71, 7). It is unknown if the problem can have more solutions (so the problem is in the research
domain and hence it deserves the attention of the young ambitious mathematicians).
(d) For y = 0 and y = 1 we have x = 7. For y > 1 the LHS is even while the RHS is odd and hence
there is no solution. So, the only solutions to this equation are: (x, y) = (7, 0) and (x, y) = (7, 1).
3. Find all the solutions of the following equations (where x, y ∈ Z and z ∈ N0 ):
(a) 2x + 3y − 6z! = 222. (b) 3x + 5y + 15z! = 17. (c) x2 + y 2 + z! = 24. (d) x2 + y 2 − z! = 3.
Solution:
3
(a) On reducing the equation in modulo 3 we get 2x = 0, i.e. x = 3k where k ∈ Z.
2
On reducing the equation in modulo 2 we get y = 0, i.e. y = 2s where s ∈ Z.
On substituting these into the original equation we get:
2(3k) + 3(2s) − 6z! = 222 → 6k + 6s − 6z! = 222 → k + s − z! = 37 → s = z! + 37 − k
So, the solutions are: (x, y, z) = (3k, 2t! + 74 − 2k, t) where k ∈ Z and t ∈ N0 .
5
(b) On reducing the equation in modulo 5 we get 3x = 2, i.e. x = 4 + 5k where k ∈ Z.
3
On reducing the equation in modulo 3 we get 2y = 2, i.e. y = 1 + 3s where s ∈ Z.
On substituting these into the original equation we get:
3(4 + 5k) + 5(1 + 3s) + 15z! = 17 → 12 + 15k + 5 + 15s + 15z! = 17 → s = −k − z!
0
So, the solutions are: (x, y, z) = (4 + 5k, 1 − 3k − 3t!, t) where k ∈ Z and t ∈ N .
(c) z cannot be greater than 4 because otherwise the LHS will be greater than 24. So, all we need to
do is to consider z = 0, 1, 2, 3, 4. On doing so we get the following five solutions:
(x, y, z) = (−3, ±3, 3) (x, y, z) = (0, 0, 4) (x, y, z) = (3, ±3, 3)
5.9 Trigonometric Diophantine Equations 84

4
(d) For z > 3 we have x2 +y 2 = 3 which has no solution. So, all we need to do is to consider z = 0, 1, 2, 3.
On doing so we get the following twenty solutions:
(±3, 0, 3) (±2, −1, 2) (±2, 0, 0) (±2, 0, 1) (±2, 1, 2)
(±1, −2, 2) (±1, 2, 2) (0, ±3, 3) (0, ±2, 0) (0, ±2, 1)

5.9 Trigonometric Diophantine Equations


1. Find all x, y ∈ Z that satisfy the following equations:
    
(a) 3 sin xπ2 − 4 sin yπ2 = 1. (b) 5 sin xπ2 + cos(yπ) = 3. (c) 2 sin xπ2 + 3 cos yπ
2 = 2.
Solution:
4
(a) The sine function of integer multiples of π/2 takes the values 0, 1, 0, −1 corresponding to x = 0, 1, 2, 3
(and similarly
 for y). So, the only possibility for the LHS of this equation to be equal to 1 is when

sin xπ2 = sin 2 = −1 so that the LHS becomes 3(−1) − 4(−1) = 1. So, the solutions of the given
equation are (x, y) = (3 + 4k, 3 + 4s) where k, s ∈ Z.
(b) The sine function of integer multiples of π/2 takes the values 0, 1, −1 while  the cosine function of
integer multiples of π takes the values 1, −1. Accordingly, the term 5 sin xπ 2 takes the values 0, 5, −5
while the term cos(yπ) takes the values 1, −1. As we see there is no combination of these values that
can make the sum of the terms on the LHS to be equal to 3. So, the given equation has no solution.
 4
(c) If we argue as in the previous parts then 2 sin xπ 2 = 0, 2, 0, −2 corresponding to x = 0, 1, 2, 3 while
 4 4
3 cos yπ2 = 3, 0, −3, 0 corresponding to y = 0, 1, 2, 3. So, their sum is equal to 2 when (x, y) = (1, 1)
4
and (x, y) = (1, 3). Hence, the solutions of the given equation are (x, y) = (1 + 4k, 1 + 2s) where
k, s ∈ Z.
2. Find all x, y, z ∈ Z that satisfy the following equations:
   
(a) sin xπ2 + 5 cos(yπ) = 6 cos(zπ). (b) tan xπ + π3 + 2 sin yπ + 2π
3 = 2 cos zπ
6 .
Solution:
(a) We have:
 4
sin xπ
2 = 0, 1, 0, −1 for x = 0, 1, 2, 3
2
5 cos(yπ) = 5, −5 for y = 0, 1
2
6 cos(zπ) = 6, −6 for z = 0, 1
So, the two sides become equal in the following two cases (where k, s, t ∈ Z):
(x, y, z) = (1 + 4k, 2s, 2t) (x, y, z) = (3 + 4k, 1 + 2s, 1 + 2t)
So, these are the solutions of the given equation.
(b) We have:
 √
tan xπ + π3 = 3 for all x ∈ Z
 √ √ 2
2 sin yπ + 2π
3 = 3, − 3 for y = 0, 1
 √ √ √ √ 12
2 cos zπ
6 = 2, 3, 1, 0, −1, − 3, −2, − 3, −1, 0, 1, 3 for z = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
So, the two sides become equal in the following two cases (where k, s, t ∈ Z):
(x, y, z) = (k, 1 + 2s, 3 + 12t) (x, y, z) = (k, 1 + 2s, 9 + 12t)
These cases can be combined in the following single formula (which represents all the solutions of the
given equation): (x, y, z) = (k, 1 + 2s, 3 + 6t).
Chapter 6
Diophantine Systems
In this chapter we investigate some examples of systems of Diophantine equations of various types and
how they are solved. In fact, this chapter should be regarded as continuation to the previous chapter as
both chapters are essentially about solving Diophantine equations (i.e. individually or collectively).[53]

6.1 General Issues about Diophantine Systems


1. What we mean by “the solution of a system of Diophantine equations”?
Solution: A solution of a system of Diophantine equations is a solution that satisfies all the equations
in the system simultaneously, and hence the solution of a system of Diophantine equations is the set
of all such solutions. Accordingly, the set of solutions of a system of Diophantine equations (which
is “the solution of a system of Diophantine equations”) is the intersection of the sets of solutions of
its individual equations. So, when we tackle a problem of a system of Diophantine equations we are
actually trying to find the intersection of the sets of solutions of its individual equations.
2. What we mean by “solving a system of Diophantine equations”?
Solution: “Solving” (or “finding the solution”) of a system of Diophantine equations should mean
proving (by an irrefutable logical/mathematical argument) that there is no solution (i.e. when there
is no solution) or finding all solutions of the system (either explicitly or through a sort of closed form
formula or formulae) with an irrefutable argument that there are no other solutions to the system. So,
a system of Diophantine equations is not solved, for instance, by finding a number of solutions (e.g.
through inspection or through computational search) even if we are absolutely certain that there are
no other solutions to the system.
3. Outline the criterion for the solvability of a system of Diophantine equations.
Solution: As we already said, the set of solutions of a system of Diophantine equations is the intersec-
tion of the sets of solutions of its individual equations. As a result, a system of Diophantine equations
is solvable only if its individual equations are solvable, although the converse is not true in general.
This means that a system of Diophantine equations has no solution if some of its equations have no
solution, but a system may not have a solution even though all its individual equations have solutions
(i.e. when the intersection of these solutions is the empty set). In other words, the solvability (i.e.
having solution) of the individual equations of a system is a necessary but not sufficient condition for
the solvability of the system itself.
4. Outline the main methods for solving a system of Diophantine equations.
Solution: There are two main methods for solving a system of Diophantine equations in number theory:
• The first method employs a “collective approach” (i.e. by solving the system as a whole) which is
based on using the traditional methods of solving systems of multivariate equations (as investigated in
algebra and linear algebra for instance) such as by substitution or comparison or use of the techniques
of matrices (see for instance § 4.3 of V1).
• The second method employs an “individual approach”, i.e. by solving the individual equations of the
system separately (either by the general methods of algebra or by the special methods and techniques
of number theory as seen for instance in chapter 5) and selecting the solutions that satisfy the system
as a whole (i.e. by accepting only the solutions which are common to all the equations). In this context,
we should pay special attention to the method of having (or obtaining) the solution of one equation
and test it on the other equations in the system (see the last point of Problem 6).
It should be obvious that any solution found by these methods is acceptable only if it is an integer

[53] In fact, it is also continuation to the material about this topic which we investigated in the first volume of this book.

85
6.1 General Issues about Diophantine Systems 86

solution (or sub-integer solution if there are extra conditions imposed on the system by the given
problem such as being positive or non-negative or within certain range as demanded for instance by
physical requirements).
5. Discuss briefly “linear” and “non-linear” systems of Diophantine equations.
Solution: We note the following:
• Systems of Diophantine equations can be classified into two main categories: linear (when all the
equations of the system are linear) and non-linear (when some or all of the equations of the system are
non-linear).
• Systems of linear Diophantine equations can be easily solved by the well known (and standard)
methods of linear algebra where only the integer (or sub-integer such as positive integer) solutions are
accepted. Other methods (including the methods used for solving systems of non-linear equations) are
also possible to use in general for solving systems of linear equations (as will be discussed later).
• Non-linear systems of Diophantine equations can be solved usually by the well known algebraic
methods of solving systems of equations (which are not restricted to Diophantine equations) such as
by elimination, comparison and substitution where only integer (or sub-integer) solutions are accepted.
However, it should be noted that certain methods (which are mostly investigated in linear algebra)
are not applicable in solving non-linear Diophantine systems since these methods are specific to linear
systems.
6. Outline some general recommendations or guidelines that should be followed in solving systems of
Diophantine equations (especially the non-linear ones).
Solution: For example:
• Initial sensibility checks (such as parity or modularity or sign or magnitude checks) are strongly
recommended (if not required) as the first step in tackling and solving Diophantine systems as well as
in tackling and solving individual Diophantine equations (see Problem 5 of § 5.1 as well as Problem 7
of the present section). In many cases, solving the given system of equations does not need more than
these initial sensibility checks since these checks can reveal that the system either has no solution (e.g.
because one of the equations has no solution due to parity violation or modularity inconsistency or
because some of the equations require conditions that contradict the conditions required by the other
equations) or because the solution becomes so obvious by these initial sensibility checks.
• It is recommended to test all the obtained solutions on the given system of equations. This is because
some of the algebraic manipulations which are (usually) required during the process of solving systems of
non-linear equations (such as raising to powers or multiplication or division by a variable) can introduce
foreign solutions and hence by testing the obtained solutions we make sure that no foreign solution is
introduced during these manipulations.
• Systems of linear equations can be considered as a special case of systems of non-linear equations
and hence they can be solved by the methods of systems of non-linear equations (when applicable) as
well as by the methods and techniques which are specific to systems of linear equations (such as by the
methods of matrices of linear algebra).
• Unlike linear systems of Diophantine equations, there is no standard (or systematically applicable)
method or technique for solving non-linear systems of Diophantine equations and hence solving these
systems is a mix of art and science (where the art is required for selecting the main approach or strategy
for solving the system while the science is needed for employing and applying the technicalities of the
selected approach). Therefore, it is recommended to investigate various potential methods or strategies
before setting off and making the choice of the best (or even applicable) strategy to use. Investing
some time and effort in this initial investigation can be very rewarding and beneficial and can save
considerable amounts of time and effort in trying to solve the system in a rather random approach and
chaotic manner (i.e. by a “hit-and-miss” approach).
• If the system of Diophantine equations contains an equation whose solution is known (or can be
obtained easily or more easily) then the best approach for solving the system is to test the solutions
of that equation on the other equations where only the common solutions (if any) to all equations are
accepted.[54] This is particularly true when some of the equations in the (non-linear) system are linear.
[54] This is based on the obvious fact that the solution of the system is the intersection of the solutions of the individual
6.2 Systems of Diophantine Equations 87

This approach usually saves considerable amounts of time and effort in trying to solve the system by
other methods. In fact, in some cases this can be the only viable method for solving the system.
7. Discuss (briefly) initial sensibility checks and the importance of applying them when tackling a Dio-
phantine system problem.
Solution: Conducting initial sensibility checks as a first step in dealing with Diophantine problems
applies not only to single Diophantine equations (which we investigated in Problem 5 of § 5.1) but also
to systems of Diophantine equations. So, if a system contains a non-solvable equation then the system
is not solvable. Therefore, it is worthwhile to inspect the individual equations of the system (to check
if they are solvable or not) before trying to solve the system. For example, if we are given the following
system:
x2 + y 3 − z 4 = 3 2x + y 2 − 3y − 6z 2 = 75 (x, y, z ∈ Z)
then a quick initial inspection should reveal that the second equation has no solution (due to parity
violation) and hence the system has no solution (with no need for inspecting the first equation or the
system as a whole).
It is also worthwhile to inspect the characteristics of the system as a whole (i.e. not only its individual
equations separately) to see if it is sensible for the system to have a solution or not. For example, if we
are given the following system of Diophantine equations:
3x4 + 7y 2 + z 2 = 0 x2 + y 4 = 37 (x, y, z ∈ Z)
then a quick initial inspection should reveal that the first equation has only the trivial solution (i.e.
x = y = z = 0), while the second equation can have only non-trivial solutions (i.e. it cannot accept
the trivial solution). This means that the two equations cannot have a common solution and hence the
system has no solution (although both equations are solvable individually). Initial inspection to the
system as a whole should also reveal that the following system:
3x2 + 5y 2 − z = 0 2x2 + 7y 4 + z 3 + 9 = 0 x+y+z+1=0 (x, y, z ∈ Z)
has no solution because if the first equation has a solution then z must be non-negative, while if the
second equation has a solution then z must be negative. So, the two equations cannot have a common
solution and hence this system cannot have a solution (although each equation in the system is solv-
able).
Also see Problem 5 of § 5.1.

6.2 Systems of Diophantine Equations


1. Solve the following systems of Diophantine equations in the unknowns x, y ∈ Z:
(a) 3x2 + 4y = 19 5x − 2y = 3.

(b) x − 11y 2 = 8 4xy − 1033y 2 = 411.
(c) x3 y + y 3 x − xy = 0 x2 + y 2 − 2xy − x = 0.
(d) x3 + y + 2xy = 0 y 3 + x + 2xy = 0.
(e) x2 − 2x + 4 + y = 0 x2 + y 2 + 6x − 10y + 30 = 0.
(f ) 15x + 13xy − 20y = 0 3x4 + 2y 3 + 202 = 0 7x5 − 4y 2 − 9x3 y = 484.
(g) x2 − 3y = 19 13y 3 + 6x = 11 x2 + y 2 = 17.
(h) 3xy + x2 − 5y = 33 5x3 + 10xy + 11y 2 = 23 17x + 4xy 2 = 147.
Solution:
(a) From the second equation we get 2y = 5x − 3. On substituting this into the first equation and
simplifying we get 3x2 + 10x − 25 = 0 whose only (integer) solution is x = −5 (and hence y = −14).

equations (see Problem 1) and hence the set of solutions of the system cannot exceed the set of solutions of any one of
the equations in the system, i.e. the set of solutions of the system is a (proper or improper) subset of the set of solutions
of any one of the equations in the system.
6.2 Systems of Diophantine Equations 88

So, the only solution to this system is (x, y) = (−5, −14). Also see part (a) of Problem 1 of § 6.3.
(b) From the first equation we get x = (11y 2 + 8)2 . On substituting this into the second equation and
simplifying we get 484y 5 + 704y 3 − 1033y 2 + 256y = 411 whose only (integer) solution is y = 1 (and
hence x = 192 = 361). So, the only solution to this system is (x, y) = (361, 1).
(c) We have two cases:
• x = 0 and hence (from the second equation) we get y = 0.
• x 6= 0 and hence:
If y = 0 then (from the second equation) we get x2 − x = 0 whose solution is x = 1 (noting that x 6= 0).
If y 6= 0 then (from the first equation) we get:
x3 y + y 3 x − xy = 0 → x3 y + y 3 x = xy → x2 + y 2 = 1
The last equation has no solution (noting that x 6= 0 and y 6= 0).
So in brief, the given system has only two solutions: (x, y) = (0, 0) and (x, y) = (1, 0).
(d) If xy = 0 then (x, y) = (0, 0) is a solution.
If xy 6= 0 then on dividing the first equation by x and the second equation by y we get:
x2 + xy + 2y = 0 and y 2 + xy + 2x = 0
This implies that y = ±x. On substituting these into the first equation we get:[55]
x3 + x + 2x2 = 0 and x3 − x − 2x2 = 0
On solving these equations we get x = −1 from the first equation (and no integer solution 6= 0 from
the second equation). On substituting x = −1 in any one of the given equations and solving for y we
get y = −1.
So in brief, the given system has only two solutions: (x, y) = (0, 0) and (x, y) = (−1, −1).
(e) Someone with modest knowledge in mathematics should immediately realize that the first equation
represents a parabola while the second equation represents a circle, and hence the problem can be solved
“graphically” (possibly with no need to make any plot). If we put these equations in their standard
forms (so that we can easily identify the shape and position of the graphs they represent) then we have:
y + 3 = −(x − 1)2 (x + 3)2 + (y − 5)2 = 4
So, now it is obvious that the first equation represents a parabola which concaves down with vertex at
(x, y) = (1, −3) while the second equation represents a circle with radius 2 and center at (x, y) = (−3, 5)
and hence they cannot have a common point. Therefore, this system obviously has no solution. Also
see part (d) of Problem 1 of § 6.3.
(f ) In part (j) of Problem 1 of § 4.1.5 of V1 we obtained the solutions of 15x + 13xy − 20y = 0 which
are: (x, y) = (2, −5), (0, 0), (−10, −1). So, the easiest approach for solving this system is to test the
solutions of this equation on the other equations in the system where we accept only the solutions
which are common to all the equations in the system.[56] If we do so we will find out that only the
solution (x, y) = (2, −5) satisfies all the equations of the system and hence this is the only solution to
the system.
(g) We note that the last equation in this system is easy to solve (since we have a few possibilities for
x and y to satisfy this equation). The solutions of the last equation are: (x, y) = (±1, 4), (±1, −4),
(±4, 1) and (±4, −1). On testing these eight solutions on the other two equations in the system we find
that only the solution (x, y) = (4, −1) satisfies the other two equations. Hence, this system has only
one solution, i.e. (x, y) = (4, −1). Also see part (c) of Problem 1 of § 6.3.
(h) Initial inspection should reveal that the second equation has no solution because in modulo 5
5
this equation becomes y 2 = 3 which has no solution since 3 is not a quadratic residue of 5. So, this
system has no solution although the other two equations in the system have a common solution, i.e.
(x, y) = (7, −1).

[55] Thesame result will be obtained from substitution into the second equation.
[56] Thejustification of this approach is that the solution of the system is the intersection of the solutions of the individual
equations and hence the set of solutions of the system cannot exceed the set of solutions of any one of the equations in
the system, i.e. the set of solutions of the system is a (proper or improper) subset of the set of solutions of any one of
the equations in the system. Also see Problem 6 of § 6.1.
6.2 Systems of Diophantine Equations 89

2. Solve the following systems of Diophantine equations in the unknowns x, y, z ∈ Z:



(a) x − y 2 − z 2 + 13 = 0 2y 2 + z 2 − x = 22.
(b) x2 − x + 3y 2 + 14z 3 = 34 6x3 + 4xy + 5y 3 − 2z = 13.
√ √ √ √ √ √
(c) 7 x + 3 y + 2 z = 66 3 x + 5 y − z = 19.
(d) 2x + 8y 2 + 4z = 77 x3 + 3y 2 − 5z = 34.
(e) x3 − y 3 + 3xy + z 3 = 103 3x + 8y 2 − z 3 = 191 3y 3 − 8xy − 3z 3 = 101.

(f ) 9x2 + z 2 = 90 13x + 11y + 2 z = 15 2x2 + 5y 2 + 3z = 49.
Solution: √
(a) x must be a perfect square (because of x) and hence let x = X 2 where X ∈ N0 . So, the equations
become:
X − y 2 − z 2 + 13 = 0 2y 2 + z 2 − X 2 = 22
Now, if we add these equations side by side we get:
y2 − X 2 + X = 9 → 4y 2 − 4X 2 + 4X = 36 → 4y 2 − (4X 2 − 4X) = 36 →
4y 2 − (4X 2 − 4X + 1) = 35 → 4y 2 − (2X − 1)2 = 35
So, by factoring the two sides of the last equation we get:
(2y − 2X + 1)(2y + 2X − 1) = (−1)(−35) = (1)(35) = (−5)(−7) = (5)(7)
Now, if we consider all these eight possibilities (by comparing the factors on the two sides in both or-
ders) then we get eight systems of simultaneous equations. On solving these eight systems (accepting
only the solutions with X ≥ 0) we get the following solutions:
(X, y) = (9, −9) (9, 9) (0, −3) (1, −3) (1, 3) (0, 3)
(x, y) = (81, −9) (81, 9) (0, −3) (1, −3) (1, 3) (0, 3)
On inserting these values in the original equations and solving for z (accepting only the consistent so-
lutions) we get: (x, y, z) = (0, ±3, 2) and (x, y, z) = (0, ±3, −2). So, these four solutions are the only
solutions to the given system.
(b) If the first equation has any solution then y must be even, while if the second equation has any solu-
tion then y must be odd. This parity inconsistency of the system makes the given system non-solvable,
i.e. it has no solution in integers.
(c) x, y, z must be perfect squares. If we add twice the second equation to the first equation and simplify
we get: √ √
x+ y =8 (27)
√ √
Now, it is obvious that x and y cannot exceed 8 (because otherwise the LHS of Eq. 27 will be > 8).
So, it is obvious that only the following nine pairs satisfy Eq. 27:
(x, y) = (0, 64) (1, 49) (4, 36) (9, 25) (16, 16) (25, 9) (36, 4) (49, 1) (64, 0)
Now, if we try these nine pairs on the equations of the given system we find that all these pairs produce
valid solutions. So, the solutions of the given system are: (x, y, z) = (0, 64, 441), (1, 49, 361), (4, 36, 289),
(9, 25, 225), (16, 16, 169), (25, 9, 121), (36, 4, 81), (49, 1, 49), (64, 0, 25). √ √ √
Finally, it is worth noting that this system can be treated as a system of linear equations in x, y, z
(where the domain of these roots is the set of non-negative integers) and hence it is solved as such
(where the final x, y, z solutions are obtained by squaring the values of the variables in the solutions of
the system of linear equations).
(d) We must have z ≥ 0. From the first equation, z must be zero (due to parity requirement). So, the
system becomes:
2x + 8y 2 = 76 x3 + 3y 2 = 35
Now, from the first of these equations we get x = 38−4y 2 . On substituting this into the second equation
and simplifying we get: 64y 6 − 1824y 4 + 17325y 2 = 54837 whose only (integer) solutions are y = ±3
6.2 Systems of Diophantine Equations 90

(and hence x = 2). So, the given system has only two solutions, i.e. (x, y, z) = (2, ±3, 0).
(e) We have:
 
3 x3 − y 3 + 3xy + z 3 + 3y 3 − 8xy − 3z 3 = (3 × 103) + 101
3x3 + xy = 410
410
y = − 3x2
x
i.e. x is a divisor of 410. Now, the divisors of 410 are 1, 2, 5, 10, 41, 82, 205, 410 and their negatives
(i.e. 16 divisors in total). So, from the last equation we obtain the value of y corresponding to each one
of these 16 divisors (which represent the values of x) and hence we get 16 (x, y) pairs. On trying these
16 pairs on the three equations of the system and solving for z we find that only the pair (x, y) = (5, 7)
produces a consistent result (where z corresponding to this pair is 6). Hence, the only solution of the
given system is (x, y, z) = (5, 7, 6).
(f ) The second equation implies z ≥ 0 while the third equation implies z ≤ 16. So, all we need to do
is to try the values z = 0, 1, . . . , 16 in the first equation to get the corresponding values of x and hence
obtaining 34 pairs of (±|x|, z). On trying these 34 pairs[57] in the second and third equations we get
the corresponding values of y. On doing this we find that only the pair (x, z) = (−1, 9) produces a
consistent result (where y corresponding to this pair is 2). Hence, the only solution of the given system
is (x, y, z) = (−1, 2, 9).
3. Find all x, y ∈ Z such that f1 = f2 = f3 = f4 where:

f1 (x, y) = x2 − y 3 + 3xy + 7788


f2 (x, y) = x3 − 2y 3 + 51x2 − 5y − 5652
f3 (x, y) = x2 − 22y + 3xy + 1347
f4 (x, y) = xy 2 + y 3 + 55y + 4146

Solution: If f1 = f2 = f3 = f4 then: f1 = f2 , f1 = f3 and f1 = f4 . So, this Problem can be solved as


a system of multivariate Diophantine equations, i.e.
f1 − f2 = 0 f1 − f3 = 0 f1 − f4 = 0
On solving this system[58] we find that f1 = f2 = f3 = f4 for (x, y) = (−33, 19).
4. Class A, B, C of orange cost $1.71, $1.63, $1.51 per kg, while class A, B, C of apple cost $1.57, $1.49,
$1.42 per kg. An 11% (9%) discount is offered to anyone who buys more than $1000 of orange (apple)
with the condition that he should buy at least 100 kg of any class he buys in multiples of 100’s (i.e.
100, 200, 300, . . .). We bought 1000 kg of orange and 1000 kg of apple and paid $2753.55 where we
benefited from both discounts on the entire deal. How many kilograms of each class of orange and
apple we bought?
Solution: Let a be the cost of 1000 kg of orange before discount and b be the cost of 1000 kg of apple
before discount. It should be obvious that a and b are integers (noting the 100 kg condition in multiples
of 100’s). Now, from the discount offer we get:

0.89a + 0.91b = 2753.55 (28)

Also, from the price limits and the purchased quantities we get the following inequalities:
1510 ≤ a ≤ 1710 and 1420 ≤ b ≤ 1570
Now, if we solve Eq. 28 considering the restrictions imposed by these inequalities we get only one ac-
ceptable integer solution which is (a, b) = (1598, 1463).[59] Accordingly:
[57] Actually, we try only the integers of these pairs.
[58] The easiest way to solve this system is by solving the equation f1 − f3 = 0, i.e. 22y − y 3 + 6441 = 0. The only (integer)
solution of this equation is y = 19 and hence x = −33 (where this can be obtained, for instance, from f1 − f2 = 0).
[59] From Eq. 28 we have a = (2753.55 − 0.91b)/0.89. So, on trying 1420 ≤ b ≤ 1570 we get only two integer solutions:

(a, b) = (1598, 1463) and (1507, 1552). However, the latter solution is not acceptable because 1510 ≤ a ≤ 1710.
6.3 Solving Systems of Diophantine Equations Graphically 91

• Regarding the orange deal we have the following system of simultaneous equations:
1.71x + 1.63y + 1.51z = 1598 and x + y + z = 1000
where x, y, z are the numbers of kilograms of class A, B, C of orange which we bought. On solving this
system[60] we get: (x, y, z) = (1.5z − 400, 1400 − 2.5z, z). Now, we must have:
x ≥ 100 → 1.5z − 400 ≥ 100 → z ≥ 500/1.5 → z ≥ 334
y ≥ 100 → 1400 − 2.5z ≥ 100 → z ≤ 1300/2.5 →
z ≤ 520
   
So, z = 400 and thus (x, y, z) = (200, 400, 400) or z = 500 and thus (x, y, z) = (350, 150, 500) . How-
ever, the latter solution is not acceptable because it violates the condition of multiples of 100’s. So,
(x, y, z) = (200, 400, 400).
• Regarding the apple deal we have the following system of simultaneous equations:
1.57X + 1.49Y + 1.42Z = 1463 and X + Y + Z = 1000
where X, Y, Z are the numbers of kilograms of class A, B, C of apple which we bought. On solving this
system[61] we get: (X, Y, Z) = (0.875Z − 337.5, 1337.5 − 1.875Z, Z). Now, we must have:
X ≥ 100 → 0.875Z − 337.5 ≥ 100 → Z ≥ 437.5/0.875 → Z ≥ 500
Y ≥ 100 → 1337.5 − 1.875Z ≥ 100 →
Z ≤ 1237.5/1.875 → Z ≤ 660
   
So, Z = 500 and thus (X, Y, Z) = (100, 400, 500) or Z = 600 and thus (X, Y, Z) = (187.5, 212.5, 600) .
However, the latter solution is obviously not acceptable. So, (X, Y, Z) = (100, 400, 500).

6.3 Solving Systems of Diophantine Equations Graphically


Many systems of Diophantine equations lend themselves to a graphic approach where their solutions can be
identified and obtained graphically by using graphic tools, considerations and reasoning (possibly without
need for plotting and creating actual graphs). This is particularly true when we deal with 2-variable
systems of Diophantine equations of various types (such as polynomials and exponentials).
The idea of using graphic approach should be obvious, i.e. we plot the graphs (possibly in our mind)
representing the equations of the system to see where (or if) they meet and hence in most cases we can
easily see graphically the solutions (if exist) as well as the impossibility of having more solutions (noting
that graphs of different equations usually meet only in a few points in a certain region of their domain space
and they depart from each other in all other regions making the impossibility of having more solutions
definite and certain and hence it is a “graphic proof”).
Problems
1. Find (graphically) all the solutions of the following systems of Diophantine equations:
(a) 3x2 + 4y = 19 5x − 2y = 3. (x, y ∈ Z)
x y 2 2
(b) 3 − 5 = 2 x + y = 13. (x, y ∈ N0 )
(c) x2 − 3y = 19 13y 3 + 6x = 11 x2 + y 2 = 17. (x, y ∈ Z)
(d) x2 − 2x + 4 + y = 0 x2 + y 2 + 6x − 10y + 30 = 0. (x, y ∈ Z)
Solution:
(a) If we plot these equations we get what we see in the left frame of Figure 1. From this Figure it is
obvious that this system has a maximum of two solutions. Now, if we zoom on the point at the upper
right (see the middle frame of Figure 1) we see that it is not a possible (integer) solution. If we zoom
on the point at the bottom left (see the right frame of Figure 1) we see that it is a possible (integer)
[60] Wehave:
1.71x + 1.63y + 1.51z − 1.63(x + y + z) = 1598 − 1.63(1000) → 0.12z − 0.08x = 32 → x = 1.5z − 400
1.71x + 1.63y + 1.51z − 1.71(x + y + z) = 1598 − 1.71(1000) → 0.08y + 0.20z = 112 → y = 1400 − 2.5z
[61] Wehave:
1.57X + 1.49Y + 1.42Z − 1.49(X + Y + Z) = 1463 − 1.49(1000) → X = 0.875Z − 337.5
1.57X + 1.49Y + 1.42Z − 1.57(X + Y + Z) = 1463 − 1.57(1000) → Y = 1337.5 − 1.875Z
6.3 Solving Systems of Diophantine Equations Graphically 92

solution. On testing (x, y) = (−5, −14) on the system we find this is a solution. Hence, we conclude
graphically that (x, y) = (−5, −14) is the only solution of this system (which is a conclusion that we
obtained algebraically in part a of Problem 1 of § 6.2).

Figure 1: The plot of part (a) of Problem 1 of § 6.3.

(b) If we plot these equations we get what we see in Figure 2. From this Figure it is obvious that this
system has only one possible solution (noting that x, y ∈ N0 because of the exponential equation) which
(by graphic inspection and verification) is (x, y) = (3, 2).

Figure 2: The plot of part (b) of Problem 1 of § 6.3. The parts of the curves outside the first quadrant
should be ignored.

(c) If we plot these equations we get what we see in Figure 3. This Figure (associated with the aware-
ness that all the “potential solutions” that belong to the circle are within the plotted area) should lead
to the definite conclusion that the only solution to this system is (x, y) = (4, −1). This conclusion was
obtained algebraically in part (g) of Problem 1 of § 6.2).
(d) In part (e) of Problem 1 of § 6.2, this system was “solved graphically” without visualization (i.e.
we used a “graphic argument” without plotting any graph). In the present Problem we plot the graphs
6.4 Final Thought about how to Solve Diophantine Problems 93

Figure 3: The plot of part (c) of Problem 1 of § 6.3.

representing the two equations of this system to confirm our solution in that Problem (see Figure 4).

Figure 4: The plot of part (d) of Problem 1 of § 6.3.

6.4 Final Thought about how to Solve Diophantine Problems


Solving Diophantine problems (whether individual equations or systems of equations) is usually a big task.
In this final section of this chapter[62] we present a list of recommendations and guidelines that can (and
should) be used as a reference in tackling Diophantine problems. In fact, most of these recommendations
are based on (and extracted from) our experience (in the present and previous chapter as well as in V1)
related to the methods and techniques used in solving Diophantine problems.
1. Conduct an initial (and basic) sensibility checks (or tests) such as parity consistency checks, simple
divisibility tests, primality/composity tests, sign tests, and so on (see for instance § 1.11 and § 4.1 of
[62] Wenote that this section is mostly about the previous chapter but it was deferred to this position because it is about
systems as well as equations.
6.4 Final Thought about how to Solve Diophantine Problems 94

V1 for some recommendations and guidelines; also see Problem 5 of § 5.1 and Problem 6 of § 6.1 of
the present volume). Many Diophantine problems do not need in their solution more than an informed
inspection based on these initial and simple checks and tests and hence it is worthwhile to spend a few
minutes on doing this sort of initial inspection and tests which can save a considerable amount of time
and effort in trying to solve the given problem by the use of sophisticated approaches and techniques
(which may or may not lead to the required result).
2. Use computational tools (such as coding or spreadsheets or software packages) to give you an initial
impression and insight about the nature of the expected (and sought-after) solution(s). In fact, this
initial computational inspection can be a great help in identifying and producing a theoretical and
general argument (or proof or formulation or . . .) that solves the problem completely and unequivocally.
3. Use graphic tools (when possible and applicable) for initial inspection of systems of Diophantine equa-
tions by plotting the equations on the same graph to see if and where they have points of intersection
(see § 6.3). In fact, the use of these tools can lead to the final solution of the problem without further
inspection or work.
4. Classify the problem such as linear or non-linear, exponential or polynomial (involving quadratic or/and
cubic or . . .), 2- or 3- · · · or n-variable problem, etc.
5. Recall the standard methods of solution for the specific type (as identified according to the recommen-
dation of the previous point). Use previously-solved problems (related to the identified specific type)
as prototypes and models to see if it is possible to apply their methods of solution to the problem at
hand.
6. Consider comparing the given Diophantine equation to a similar equation whose solutions are known or
whose solutions are easier to obtain and hence obtain the solutions of the given equation with minimal
effort (or with no effort). See for instance Problem 3 of § 5.1.
7. Look for symmetry in the variables which can be exploited (for instance) in assuming temporarily
that the variables have a certain increasing or decreasing order. This should facilitate the search for a
solution (where the final and complete solution can be obtained eventually by permuting the solution
obtained on the base of ordering assumption). Also look for cyclic pattern in the variables where this
pattern can be exploited similarly (e.g. by assuming certain ordering in the variables).
8. Consider reducing the domain of solution temporarily until a solution is found (for the reduced domain)
where this solution can be extended and generalized later on to reach the final and complete solution
for the entire domain. For example, if we are dealing with a Diophantine equation in the domain of
integers Z involving variables with even powers then we can start by considering its solution in the
domain of natural numbers N (instead of Z) where the final and complete solution can be obtained
trivially later on by extending the domain to the negative integers (noting that even powers do not
distinguish between positive and negative bases).
9. Consider producting a factored expression involving variables (on the LHS) that is equal to a specific
number (on the RHS) where the factors involving variables (on the LHS) can be matched with numeric
factors (on the RHS) to produce systems of simultaneous equations that can be solved to produce the
solution(s) of the given problem. The number of the possible factors on the two sides should also be
considered in some problems since it can eliminate certain possibilities for the solution (see for instance
Problem 7 of § 5.2). Also consider employing divisibility arguments of one side (or of factors of one
side) by the other side (or by factors of the other side).
10. Consider employing modular arithmetic to reduce the given equation in certain moduli where the
relationship between ordinary and congruence equations (see § 2.7.6 of V1) can be exploited to infer
the solutions of the given equation (or to conclude that the given equation has no solution).
11. Recall basic rules and principles (such as ordering rules and principles). Examples of these rules and
principles are:
No (perfect) square can be between consecutive squares, no (perfect) cube can be between consecutive
cubes, and so on.
No (perfect) square can be the sum of two odd squares.
Any (perfect) cube can be expressed as a difference of two squares.
Fermat’s last theorem can also be considered in this regard since it eliminates certain possibilities of
6.4 Final Thought about how to Solve Diophantine Problems 95

solution.
12. Remember Pell’s equation (see § 1.2) when dealing with quadratic polynomial equations in 2-variables.
Consider manipulating the equation (if necessary) to put it in a standard Pell’s form (e.g. by scaling
the equation and completing squares to simplify the expressions and reducing the number of terms as
well as organizing the equation to identify and recognize the pattern). Also consider the generalized
form of Pell’s equation (not only its standard form). As soon as we solve the obtained Pell equation
we can try obtaining the solutions of the original equation by the reverse transformation (where we
accept only the integer solutions). However, we should keep in mind that the existence of solution to
the transformed Pell equation does not guarantee the existence of solution to the original equation (see
§ 1.2) since the reverse transformation may not produce integer solutions.
13. Remember Pythagorean triple rules and theorems when dealing with quadratic equations in 3 variables.
As in the previous point, consider manipulating the equation (if necessary) to put it in a standard
Pythagorean triple equation form (e.g. by completing the squares or/and by transforming the variables).
14. Consider upper and lower bounds on the potential solutions (e.g. when dealing with equations involving
fractions).
15. Consider sign bounds and bounding inequalities (e.g. when dealing with polynomials and exponentials).
16. Recall Wilson’s theorem when the equation involves factorial.
17. Consider special (or limiting or obvious or eccentric or . . .) cases and instances such as when one (or
more) of the variables is 0 or ±1 or goes to infinity. Such considerations can give an insight in the
solution (or reduce the possibilities or organize the approach of solution or . . .).
Give special attention to the dominating terms which can (for instance) impose limits or determine the
eventual tendency of the equation.
18. Use computational tools (such as coding or spreadsheets or software packages) to check the final answer
(if necessary) especially when you have some doubt or when the produced argument (or proof or
formulation or . . .) is very messy and susceptible to errors and mistakes.
Chapter 7
Inequalities
7.1 General Issues about Inequalities
1. Outline some basic rules that govern inequalities and hence they can (and should) be used to solve
inequality problems in number theory (as well as in other mathematical branches like analysis).
Solution: For example:
• We can add and subtract the same quantity to both sides.
• We can multiply and divide each side by the same (non-zero) quantity but the sense of inequality
should be reversed if the quantity is negative.
• The factorial function n! grows faster than the corresponding exponential function an (where a > 1
is constant) and hence n! becomes > an eventually (i.e. at high values of n).
• The exponential function an (a > 1, n > 0) grows faster than the corresponding polynomial function
(e.g. n5 ) and hence an becomes > n5 eventually.
• Higher order polynomials (e.g. n3 ) grows faster than the corresponding lower order polynomials (e.g.
n + 99) and hence the higher order becomes bigger (in magnitude) than the lower order eventually. In
particular, any (non-constant) polynomial will eventually exceed (in magnitude) any constant (polyno-
mial) function.
• An inequality involving absolute value represents double inequality. For example, |n| < 3 means
−3 < n < 3 while |n| > 3 means n < −3 and n > 3.
• Taking the absolute value of the two sides of an inequality whose both sides are negative should reverse
the sense of inequality (because it is equivalent to multiplication by −1). For example, if m, n < 0 and
m < n then |m| > |n|.
2. List some tools and techniques that can (and should) be used (at least as a first step) in inspecting and
investigating inequality problems.
Solution: The most common tools and techniques are:
• Graphs (whether in 1D or 2D or 3D depending on the nature of the problem and the number of
variables).[63]
• Tables of values (such as spreadsheets) where the sense of inequality can be observed as a function of
the value of variable(s).
• Tables of sign (see for instance Problem 3 of § 2).
• Coding and programming by using computer languages for systematic search and inspection. In fact,
this tool is usually more powerful than graphs and tables (especially in multivariate inequalities and
could be the only viable choice in such cases) since it can inspect a huge amount of possibilities and
values in reasonable time and with maximum reliability (if vigilance and caution are observed).
3. Which of the following inequalities is correct/incorrect:
(a) 92793284 > 39794729 . (b) 4321! > 1711251 . 2388
(c) C991 2388
< C1397 . 1127
(d) P528 1324
< P444 .
Solution: All these inequalities are incorrect because:
(a) The number of digits of 92793284 is (see Problem 10 of § 2):
⌊3284 log10 9279⌋ + 1 = ⌊13029.274⌋ + 1 = 13030
while the number of digits of 39794729 is:
⌊4729 log10 3979⌋ + 1 = ⌊17023.331⌋ + 1 = 17024
[63] 1Dgraph refers to the common technique of using number line (possibly truncated) to mark the critical values for the
inequality. 2D and 3D graphs should be obvious (e.g. the x, y and the x, y, z plots which are commonly used in calculus
and analysis).

96
7.2 Univariate Inequalities 97

(b) The number of digits of 4321! is (see Problem 9 of § 2):


$4321 %
X
log10 (k) + 1 = ⌊13834.990⌋ + 1 = 13835
k=1

while the number of digits of 1711251 is (see Problem 10 of § 2):

⌊11251 log10 17⌋ + 1 = ⌊13843.781⌋ + 1 = 13844


2388 2388
(c) We have C991 = C1397 because 1397 = 2388 − 991.
1127
(d) The number of digits of P528 is (see Problem 11 of § 2):
$ 1127
% $ 1127 %
X X
log10 (k) + 1 = log10 (k) + 1 = ⌊1546.669⌋ + 1 = 1547
k=1127−528+1 k=600

1324
while the number of digits of P444 is:
$ 1324
% $ 1324 %
X X
log10 (k) + 1 = log10 (k) + 1 = ⌊1349.497⌋ + 1 = 1350
k=1324−444+1 k=881

7.2 Univariate Inequalities


1. Find all n ∈ N0 such that n6 + 3n4 + 2 > n!.
Solution: The factorial function grows faster than the polynomial functions and hence we expect n!
to become bigger than (n6 + 3n4 + 2) at high values of n (see Problem 1 of § 7.1). On inspecting the
low values of n (say up to n = 10) we find that n6 + 3n4 + 2 > n! is true only for n = 0, 1, . . . , 9.
To make sure that this does not hold for any n > 9 we can use induction. So, for n = 10 we have
n6 + 3n4 + 2 < n!. Now, let assume that this is true for a given n ≥ 10 (as it is the case for n = 10) and
hence we will prove that if so then it must also be true for n + 1, i.e. (n + 1)6 + 3(n + 1)4 + 2 < (n + 1)!.
On multiplying both sides of n6 + 3n4 + 2 < n! by n + 1 we get:

(n + 1)(n6 + 3n4 + 2) < (n + 1)!


(n + n + 3n5 + 3n4 + 2n + 2)
7 6
< (n + 1)!
(n7 + 3n5 + 2n) + (n6 + 3n4 + 2) < (n + 1)! (29)

Also, on substituting (n + 1) in the polynomial (n6 + 3n4 + 2) we get:

(n + 1)6 + 3(n + 1)4 + 2 = n6 + 6n5 + 18n4 + 32n3 + 33n2 + 18n + 6


= (6n5 + 15n4 + 32n3 + 33n2 + 18n + 4) + (n6 + 3n4 + 2) (30)

So, to prove that (n + 1)6 + 3(n + 1)4 + 2 < (n + 1)! we need (by comparing Eqs. 29 and 30) to show
that:
(n7 + 3n5 + 2n) ≥ (6n5 + 15n4 + 32n3 + 33n2 + 18n + 4) (31)
Now:
n7 + 3n5 + 2n 1 + 3n−2 + 2n−6
=
6n5 + 15n4 + 32n3 + 33n2 + 18n + 4 6n−2 + 15n−3 + 32n−4 + 33n−5 + 18n−6 + 4n−7
> 1 + 3n−2 + 2n−6

where the last inequality is justified by the fact that for n ≥ 10 the denominator of the last fraction is
< 1 (as well as positive). Now, since (1 + 3n−2 + 2n−6 ) > 1 the inequality of Eq. 31 is true and hence
(n + 1)6 + 3(n + 1)4 + 2 < (n + 1)!. So, by mathematical induction we conclude that n6 + 3n4 + 2 < n!
for all n ≥ 10 and hence n6 + 3n4 + 2 > n! is true only for n = 0, 1, . . . , 9.
7.2 Univariate Inequalities 98

2. Find all n ∈ N0 such that 5n > n!.


Solution: The factorial function grows faster than the exponential function and hence we expect n! to
become bigger than 5n at high values of n (see Problem 1 of § 7.1). On inspecting the low values of n
(say up to n = 15) we find that 5n > n! is true only for n = 1, 2, . . . , 11. To make sure that this does
not hold for any n > 11 we can use induction (as we did in Problem 1). In brief, if 5n < n! for a given
n > 11 (as it is the case for n = 12) then on multiplying the two sides of this inequality by n + 1 we
get:
(n5n + 5n ) < (n + 1)! (32)
Also, on substituting (n + 1) in the exponential we get:

5n+1 = 5 × 5n = (4 × 5n ) + 5n (33)

Now, for all n > 11 we have (4 × 5n ) < n5n and hence (from Eqs. 32 and 33) we get:

5n+1 = (4 × 5n ) + 5n < (n5n + 5n ) < (n + 1)!

So, 5n > n! is true only for n = 1, 2, . . . , 11.


3. Find all values of n ∈ N0 such that n! > 5n + n5 − 10.
Solution: We note that this inequality is true for n = 0 and n = 1. Moreover, because at high values
of n the factorial function (n!) grows faster than the exponential and polynomial functions (i.e. 5n and
n5 − 10), we know that n! will eventually exceed both 5n and n5 − 10 and their sum. So, we need to
test the low values of n (i.e. which are > 1) until we reach a “critical” value of n at which n! becomes
bigger than 5n + n5 − 10 and hence we conclude that all values of n equal and bigger than this critical
value should also satisfy this inequality. On doing this we find that the critical value is n = 12. Hence,
we conclude that n! > 5n + n5 − 10 for all n ∈ N0 excluding 2 ≤ n ≤ 11.
4. Find all n ∈ Z such that P1 > P2 > P3 > P4 where:

P1 (n) = n4 − 164n3 + 8106n2 − 119804n + 416245


P2 (n) = n4 − 155n3 + 7850n2 − 144520n + 616704
P3 (n) = −n4 + 145n3 − 6321n2 + 88119n − 211302
P4 (n) = −10n3 + 1480n2 − 53450n − 54940

Solution: If P1 > P2 > P3 > P4 then:

P1 > P2 & P2 > P3 & P3 > P4 → P1 − P2 > 0 & P2 − P3 > 0 & P3 − P4 > 0

Now, if we solve the last three inequalities we get:


• P1 − P2 > 0 for n < −44 and 7 < n < 66.
• P2 − P3 > 0 for n < 5 and 25 < n < 44 and n > 75.
• P3 − P4 > 0 for 1 < n < 78.
These three inequalities are satisfied simultaneously for n = 26, 27, . . . , 43.
5. Show that nn > n! for all N ∋ n > 1.
Solution: We prove this by induction. It is obvious that this inequality is true for n = 2. Now, if we
assume that it is true for a given N ∋ n > 1 then we have:

(n + 1)n+1 = (n + 1)n (n + 1) > nn (n + 1) > n!(n + 1) = (n + 1)!

i.e. (n + 1)n+1 > (n + 1)!. Hence, by mathematical induction this inequality is true for all N ∋ n > 1.
7
6. Find n ∈ N such that 10n < 56 < 10n+1 .
Solution: We have:
7 7 67
log10 56 = 279936 log10 5 → 56 = 10log10 5 = 10279936 log10 5 ≃ 10195666.867

Hence, n = 195666.
7.3 Multivariate Inequalities 99

7.3 Multivariate Inequalities


1. Find the condition(s) for the validity of the following relations (where x, y, z ∈ N):
(a) x2 z ≤ xy ≤ y 2 z. (b) x3 y 2 − x3 y + x2 y − 7xy ≥ 0. (c) x2 − 2xy − 3y 2 ≥ 0.
Solution:
(a) If we start with x2 ≤ xy ≤ y 2 then it is obvious that the condition for the validity of the given
relation without z (or rather with z = 1) is x ≤ y because both x2 ≤ xy and xy ≤ y 2 lead (by division
by x and y respectively) to x ≤ y. Now, if we multiply y 2 by z (i.e. x2 ≤ xy ≤ y 2 z) then the validity of
the relation is not affected (i.e. it is still valid for any z as long as x ≤ y) because the y 2 side represents
the higher (and hence “open” or unbounded) end and hence multiplying by z does not impose a new
restriction. So, a new restriction is imposed only when we multiply x2 (which is the lower and “closed”
or bounded end) by z (noting that z ≥ 1). In other words, the restriction is imposed only on the
relation x2 z ≤ xy. This relation obviously leads (by dividing by x) to xz ≤ y.
So in brief, the condition for the validity of the given relation is xz ≤ y or x ≤ (y/z).
(b) If we write the given relation as x3 y 2 + x2 y ≥ x3 y + 7xy and compare the terms on the two sides
then it is obvious that x3 y 2 ≥ x3 y for all x, y. So, any potential violation to the validity of this relation
should originate only from the last terms on the two sides. Now, it is obvious that x2 y ≥ 7xy is valid
for all x ≥ 7 (regardless of y). So, all we need is to investigate the cases x = 1, 2, . . . , 6 with correspond-
ingly low values of y. On doing this we find that this relation is violated only in the following cases:
x = 1, 2, . . . , 6 with y = 1, x = 1, 2 with y = 2, and x = 1 with y = 3, 4, 5, 6.
So in brief, the conditions for the validity of the given relation are: (x, y) 6= (m, 1), (x, y) 6= (n, 2), and
(x, y) 6= (1, k) where m = 1, 2, . . . , 6, n = 1, 2 and k = 3, 4, 5, 6.
(c) We have:
x2 − 2xy − 3y 2 ≥ 0 → x2 − 2xy + y 2 − 4y 2 ≥ 0 → (x − y)2 − 4y 2 ≥ 0 →
  
(x − y) − 2y (x − y) + 2y ≥ 0 → (x − 3y)(x + y) ≥ 0
Now, (x + y) > 0 and hence we must have (x − 3y) ≥ 0, i.e. (x/3) ≥ y.
So in brief, the condition for the validity of the given relation is (x/3) ≥ y.
2. Find all m ∈ N such that mn − nm ≥ 0 for all n ∈ N0 .
Solution: Only m = 3 meets this requirement.
For m = 1, mn − nm < 0 for all n > 1.
For m = 2, mn − nm < 0 for n = 3.
For m > 3, mn − nm < 0 for some n < m.
3. Find all x, y, z, w ∈ N such that x1 + y1 + z1 ≥ w.
Solution: The maximum value of the LHS is 3 (i.e. when x = y = z = 1). So, we have only three
cases to consider:
• w = 3: we have only one possibility, i.e. (x, y, z) = (1, 1, 1).
• w = 2: at least one of x, y, z must be 1 (say x = 1), while at least one of the remaining variables must
be < 3 (say y < 3). Now, if y = 1 then z can take any value while if y = 2 then z < 3. Hence, the
following (x, y, z) triplets and their permutations
 (due to the symmetry  in x, y, z) are valid solutions in
this case: (x, y, z) = (1, 1, a) and (1, 2, b) where a ∈ N and N ∋ b < 3 .
• w = 1: at least one of x, y, z must be < 4 (say x < 4).
If x = 1 then y and z can take any value.
If x = 2 then at least one of y, z must be < 5 (say y < 5). If y = 1 or 2 then z can take any value. If
y = 3 then z can take any value < 7. If y = 4 then z can take any value < 5.
If x = 3 then at least one of y, z must be < 4 (say y < 4). If y = 1 then z can take any value. If y = 2
then z can take any value < 7. If y = 3 then z can take any value < 4.
Hence, the following (x, y, z) triplets and their permutations are valid solutions in this case:[64]
(1, a, b) (2, 1, a) (2, 2, a) (2, 3, c) (2, 4, d) (3, 1, a) (3, 3, e)

[64] We ignored the triplet (3, 2, c) because it is included by permutation.


7.3 Multivariate Inequalities 100

where a, b ∈ N, N ∋ c < 7, N ∋ d < 5, N ∋ e < 4.


4. Find all x, y, z, w ∈ N such that x1 + y1 + z1 < w.
Solution: We do not need to solve this Problem independently because the solutions of this Problem
can be obtained from the solutions of Problem 3 (i.e. the solutions of this Problem are the complement
of the solutions of Problem 3).
5. Let x, y ∈ N and x < y. Find all (x, y) pairs such that xy < y x .
For x = 1 and y ≥ 2 we have: 1y < y 1 for all y ≥ 2.
For x = 2 and y ≥ 3 we have 2y < y 2 only for y = 3. √ √
Regarding x ≥ 3, it is shown in calculus that if 2 < x < y then x x > y y. Now, if we raise both sides
of the last inequality to xy we get xy > y x .
So in brief, if x < y then xy < y x only when (x, y) = (1, y) and (x, y) = (2, 3). Also see Problem 14 of
§ 2.
2 2
6. Let z = x +x+yxy
+y
where x, y ∈ N. Show that if z is to be an integer then z > 2.
Solution: If z is an integer then it must be a natural number (noting that x, y ∈ N). So, all we need
to do is to prove that z cannot be 1 or 2. Thus, we have two cases to consider:
• z = 1, i.e. xy = x2 + x + y 2 + y which is impossible because if (we assume with no loss of generality
that) x ≤ y then xy ≤ y 2 and hence xy < x2 + x + y 2 + y.
• z = 2, i.e. 2xy = x2 + x + y 2 + y. Now, x = y is not a possibility (because it implies x + y = 0) and
hence let assume (with no loss of generality) that x < y. So, from 2xy = x2 + x + y 2 + y we get:
xy − x2 + xy − y 2 = x + y → x(y − x) + y(x − y) = x + y → x(y − x) = x + y + y(y − x)
The last equation is nonsensical because x(y − x) < y(y − x).
7. Show that for all x, y, z ∈ N the following relation holds: xy + yz + xz ≥ 3.
Solution: If µa is the arithmetic mean of a set of positive numbers and µg is their geometric mean
then the following relation holds:
µa ≥ µg (34)
where the equality holds iff all the numbers in the set are identical (noting that in this case both the
arithmetic
n meanoand the geometric mean are equal to that “identical” number). Now, µa and µg for
x y z
the set y, z, x are:

x
+ y
+ z r r √
y z x x y z xyz 3
µa = µg = 3
× × = 3
= 1=1
3 y z x xyz

On substituting these in Eq. 34 we get:


x y z
y + z + x x y z
≥1 → + + ≥3
3 y z x
8. Repeat Problem 8 of § 5.6 using this time the result of Problem 7.
Solution:
(a) According to Problem 7, xy + yz + xz ≥ 3 and hence xy + yz + xz = 1 has no solution.
(b) According to Problem 7, xy + yz + xz ≥ 3 and hence xy + yz + xz = 2 has no solution.
(c) According to Problem 7, xy + yz + xz ≥ 3 where the equality holds iff xy = yz = xz , i.e. x = y = z (see
Problem 16 of § 2). This means that we have solution only when x = y = z. Hence, the only solution
to the equation xy + yz + xz = 3 is (x, y, z) = (k, k, k) where k ∈ N (noting that x, y, z ∈ N).
Chapter 8
Congruence Equations
8.1 General Issues about Congruence Equations
1. What is the number of solutions a congruence equation can have?
Solution: A congruence equation can have no solution, or a single solution, or finitely many solutions
(i.e. in modular arithmetic sense).
p p
2. Show that m2 = n2 iff m = ±n (where m, n ∈ Z and p ∈ P).
p
Solution: If m = ±n then by squaring both sides (according to the power rule of congruence) we get
p
m2 = n 2 .
p p p
If m2 = n2 then m2 − n2 = 0, i.e. (m − n)(m + n) = 0 which means that p divides (m − n)(m + n). So,
p p
either p divides (m − n) or p divides (m + n), i.e. either m = +n or m = −n.
3. Show that if n is a quadratic residue of an odd prime p = 4k − 1 (where k ∈ N) then the solutions of
p p
the congruence equation x2 = n are x = ±n(p+1)/4 .
Solution: We have:
p p
h i2
x2 = n = n × 1 = n × n(p−1)/2 = n(p+1)/2 = ±n(p+1)/4

where we used Euler’s criterion in step 3 (see § 1.9). It is worth noting that since p = 4k − 1 then
(p + 1)/4 is integer.
k k/g
4. Let m = aµ and n = aν where m, a, µ, n, ν ∈ Z. Show that if m = n then µ = ν where g = gcd(a, k).
Solution: We have:
k
m=n (given)
k
aµ = aν (m = aµ, n = aν)
k/g
µ = ν (rule 8 of § 2.7 of V1; see Problem 5 of § 2.7 of V1)

Note: the result of this Problem implies that we can divide the two sides of a congruence equation by
an integer a (which is a common factor of the two sides) without affecting the validity of the congruence
iff a is coprime to the modulo k.
p
5. Show that m = n iff m = n for every p ∈ P (where m, n ∈ Z).[65]
p
Solution: Regarding the if part, m = n means p|(m − n). Now, whatever the magnitude of (m − n)
there should be some p whose magnitude is bigger than the magnitude of m − n (due to the fact that
there are infinitely many primes). Noting that 0 is the only integer that is divisible by an integer which
is bigger in magnitude, we conclude that m − n = 0, i.e. m = n.
Regarding the only if part, m = n means m − n = 0 and hence p|(m − n) for any p ∈ P since 0
is divisible by any other integer. The result will follow from the fact that p|(m − n) is equivalent to
p
m = n.
p
Note: “the only if part” of this proposition is straightforward because if m = n then m = n for
every p ∈ P. However, “the if part” of this proposition requires some clarification to avoid potential
misunderstanding. In the above proof of “the if part” we are implicitly assuming that (m − n) has a
[65] Ina sense, this proposition is a stronger version of the proposition that we stated in § 2.7.6 of V1 (with minor differences
m
in symbolism), that is: x = y iff x = y for all m (where x, y ∈ Z and N ∋ m > 1). This is because m should have a
certain prime factorization where the divisibility by m depends on the divisibility by its prime factors. We did not use
this stronger version in V1 for the sake of simplicity noting that the version of V1 was sufficient for our purposes.

101
8.1 General Issues about Congruence Equations 102

given magnitude and this should suggest that m and n are fixed integers. So, “the if part” is essentially
about m and n as fixed integers and not about
 them as integers
 in whatever shape or form.
For instance, if n = 0 while m is a function say m ≡ f (x) such that for every p ∈ P we have f (x) = kp
p p
(for some x, k ∈ Z and k 6= 0) then we have f (x) = 0 for every p ∈ P (i.e. m = n for every p ∈ P)
although f (x) 6= 0 (i.e. m 6= n). The explanation of this is that the meaning of zero in a congruence
is not the same as the meaning of zero in an ordinary equality (and this should shed more light on the
meaning of zero in the above proof).
In this regard, we should mention the function f (x) = 6x2 + 5x + 1 which is proved in the literature
p
to be congruent to 0 for every p ∈ P (i.e. 6x2 + 5x + 1 = 0 has an integer solution for every p ∈ P)
p
although 6x2 + 5x + 1 = 0 has no integer solution. In other words, m = n for every p ∈ P while m 6= n
p
(where = and 6= indicate the existence and non-existence of an integer solution x).
k
6. Find the number of (modular) solutions of the exponential congruence equation ax = b (where a, b ∈ Z
are given constants, x ∈ N0 and k is a modulo that possesses a primitive root and it is coprime to a
and b).
Solution: Let r be a primitive root of k. Now, if we take the index of both sides of the given congruence
equation (see § 1.5) then we get:
φ(k) φ(k)
Ik,r (ax ) = Ik,r (b) → x Ik,r (a) = Ik,r (b)
This is a linear congruence equation which (accordingto the LCE theorem;
 see §3.2.1 of V1) has either
no solution if d6 | Ik,r (b) or has d modular solutions in mod φ(k) if d|Ik,r (b) where d is the gcd of
Ik,r (a) and φ(k) .
7. Find the necessary and sufficient conditions for the following congruence quadratic equation to have
solutions:
p
ax2 + bx + c = 0 (a, b, c, x ∈ Z, a 6= 0, p is odd prime coprime to a)
Solution: Regarding the necessary condition, let assume that the given congruence is solvable and
p p
hence we have some X ∈ Z such that aX 2 + bX + c = 0, i.e. aX 2 + bX = −c. Now:
p
(2aX + b)2 = 4a2 X 2 + 4abX + b2 = 4a(aX 2 + bX) + b2 = 4a(−c) + b2 = b2 − 4ac ≡ ∆ (35)
p
i.e. we have an integer (2aX + b) such that (2aX + b)2 = ∆. This means that the necessary condition
for the given congruence quadratic equation to have solutions is that its discriminant is a quadratic
residue of p (where “quadratic residue” here includes 0; see the preamble of § 1.6).
Regarding the sufficient condition, we will show that this condition is also sufficient, i.e. if the
discriminant is a quadratic residue of p then the given congruence is solvable. So, let us verify this
p
claim by proving that if there is some Y ∈ Z such that ∆ = Y 2 then the given congruence is solvable.
p
Now, according to the LCE theorem (noting that 2a and p are coprime; see § 3.2.1 of V1) Y = 2ax + b
p
is solvable, i.e. there is some X ∈ Z such that Y = 2aX + b. Moreover, from Eq. 35 (read in the
p
reverse direction) ∆ = Y 2 means that the existence of such X is equivalent to the solvability of the
given congruence. So, we conclude that if the discriminant is a quadratic residue of p then the given
congruence is solvable. This means that the sufficient condition for the given congruence quadratic
equation to have solutions is that its discriminant is a quadratic residue of p.
8. Prove the following proposition using modular arithmetic: an integer is divisible by 3 (9) iff the sum
of its digits is divisible by 3 (9).
Solution: Let n = dk . . . d2 d1 d0 (where dk , . . . , d2 , d1 , d0 are digits) and m = 3 (9). So, we have:
n = dk . . . d2 d1 d0 = dk × 10k + . . . + d2 × 102 + d1 × 101 + d0
m
= dk × 1k + . . . + d2 × 12 + d1 × 11 + d0 = dk + . . . + d2 + d1 + d0
This (read in both directions) should prove the equivalence between the divisibility of an integer by 3
(9) and the divisibility of the sum of its digits by 3 (9).
8.1 General Issues about Congruence Equations 103

9. Prove the following using modular arithmetic: an integer is divisible by 11 iff the alternating sum of
its digits is divisible by 11.
Solution: Let n = dk . . . d3 d2 d1 d0 (where dk , . . . , d3 , d2 , d1 , d0 are digits). So, we have:

n = dk . . . d3 d2 d1 d0 = dk × 10k + . . . + d3 × 103 + d2 × 102 + d1 × 101 + d0


11
= dk × (−1)k + . . . + d3 × (−1)3 + d2 × (−1)2 + d1 × (−1)1 + d0
= (−1)k dk + . . . − d3 + d2 − d1 + d0

This (read in both directions) should prove the equivalence between the divisibility of an integer by
11 and the divisibility of the alternating sum of its digits by 11 (noting that the sign does not affect
divisibility since divisibility is an attribute of the magnitude).
p
10. Show that the congruence equation ax2 = b (where p is an odd prime) is solvable iff a and b are both
quadratic residues of p or both quadratic non-residues of p.
p p
Solution: ax2 = b implies x2 = a∗ b and hence (see Problem 13 of § 1.8)[66] a∗ b is a quadratic residue
p p
of p (i.e. x2 = a∗ b is solvable and hence ax2 = b is solvable) iff a∗ and b are either both quadratic
residues of p or both quadratic non-residues of p. Now, a and a∗ are either both quadratic residues or
p
both quadratic non-residues (see Problem 14 of § 1.8). Therefore, ax2 = b is solvable iff a and b are
both quadratic residues of p or both quadratic non-residues of p.
p p p
11. Show that the congruence equation x2 = mn is solvable iff x2 = m and x2 = n are both solvable or
both non-solvable (where p is an odd prime and mn is coprime to p).
Solution: This is a corollary of Problem 13 of § 1.8 (noting the connection between solvability and
quadratic residue).
12. One of the practical applications of congruence equations is in random number generation which is
widely used in many branches and disciplines of computer science (and computing in general) and its
many applications (in theories as well as in real life). In this Problem we outline the basic idea of using
modular arithmetic in the generation of sequences of (pseudo) random numbers.
So, let us create a simple modular arithmetic “model” to generate (pseudo) random numbers ri between
0 and 10000, i.e. 0 ≤ ri ≤ 9999 where i = 1, 2, . . .. This model is based on the following congruence
equation:
k
ri = mri−1 + d
where r0 (i.e. r1−1 ) is the seed (which determines the progress of the sequence), k (which is equal to
10000 in our case) is the upper limit of the generated random numbers, m is a natural number between
1 and k (i.e. 2 ≤ m ≤ 9999), and d is a given integer increment (e.g. d = 713).
For example, if r0 = 93, m = 381 and d = 11 then our random number generation model will generate
the following sequence of random numbers:

5444, 4175, 686, 1377, 4648, 899, 2530, 3941, 1532, 3703, 854, 5385, 1696, 6187, 7258, 5309, 2740, 3951, . . .

This random number generation model (or “device”) can be easily implemented in a few lines of computer
code or in a simple spreadsheet. It is obvious that if the random numbers are required to be between
0 and 1 (instead of being between 0 and k) then we simply divide these numbers by k.
Also see Problem 2 of § 18.1.
13. Discuss the difference between Legendre’s symbol and Jacobi’s symbol as metrics for determining the
solvability of quadratic congruence equations.
Solution: From point 8 in the preamble of § 1.11, we can see that Legendre’s symbol is a full metric for
solvability of quadratic congruence equations since it can determine its solvability and non-solvability,
while Jacobi’s symbol is a partial metric for solvability of quadratic congruence equations since it can
determine only its non-solvability.
71 101 2

For instance, we can conclude that x2 = 2 is solvable and x2 = 2 is non-solvable because 71 = 1 and
[66] It
is obvious that we are assuming a and p are coprime (noting that otherwise the case is trivial and obvious and can be
excluded or included according to the convention about quadratic residue; see § 1.6).
8.2 Univariate Congruence Equations 104

2

101 = −1.
21 2

On the other hand, we can conclude that x2 = 2 is non-solvable because = −1, but we cannot
21
2 21 2 21 16

conclude
 that x = 16 and x = 5 are solvable (or non-solvable) from the fact that 21 = 1 and
5
21 = 1 (noting that the first is solvable while the second is not).

8.2 Univariate Congruence Equations


m
1. Consider the congruence equation ax = 1 (where a, x, m ∈ Z with 1 ≤ a ≤ m and m > 1). How many
values of a make this congruence equation solvable?
m
Solution: According to the LCE theorem (see § 3.2.1 of V1) we must have gcd(a, m)|1 if ax = 1 is to
be solvable. This means that gcd(a, m) = 1, i.e. a and m are coprime. Now, the number of integer
values between 1 and m (inclusive) which are coprime to m is given by φ(m). So, the number of values
m
of a (where 1 ≤ a ≤ m) that make the congruence ax = 1 solvable is φ(m).
p p
2. Let p ∈ P and x ∈ Z. Show that x = x has exactly p modular solutions.
Solution: This is no more than (the essence of) Fermat’s little theorem (see § 2.9.3 of V1), i.e. the
p
congruence xp = x is satisfied by the entire residue system of p and hence this congruence has exactly
p modular solutions (noting that a complete residue system modulo p contains p residue classes, i.e.
p
x = 0, 1, 2, . . . , p − 1).
p
3. Let x ∈ Z and q, p ∈ P with q < p. Show that the congruence equation xq = x cannot be satisfied by
p
all the residue classes of p, i.e. we must have some x ∈ Z such that xq 6= x.
Solution: In fact, this is an implication (or requirement or instance) of Lagrange’s polynomial roots
theorem. However, let us establish it in a different way.
p
p must have a primitive root (see point 5 in the preamble of § 1.4). Now, “xq = x for every x ∈ Z”
means that all the residue classes of p satisfy this congruence with natural powers of x (i.e. xq ) which
are less than (p − 1). This implies that p has no primitive root (noting that the order of a primitive
p
root of p is p − 1). So, this contradiction should lead to the conclusion that the congruence xq = x
cannot be satisfied by all the residue classes of p.
p
Note: the implication of this Problem is that if xq = x for all x ∈ Z then q ≥ p.
p p
4. Show that the only (distinct modular) solutions to the congruence equation x2 = 1 are x = 1 and
p
x = p − 1 (where p is an odd prime).
p p p
Solution: The congruence x2 = 1 has obviously one solution (which is x = 1 since 12 = 1) and hence
it must have exactly two distinct modular solutions (see Problem 1 of § 1.6). We also have:
p
(p − 1)2 = p2 − 2p + 1 = 1

p p
i.e. x = p − 1 is the other solution. It should be obvious that 1 6= (p − 1) because otherwise:
p p
1 = (p − 1) → p=2 → p|(p − 2)
p
which is nonsensical since p > (p − 2) and (p − 2) 6= 0 noting that p is an odd prime.[67] So, x = 1 and
p p
x = p − 1 are the only (distinct modular) solutions to the congruence equation x2 = 1.
2
Note: we may also prove the given proposition (more easily) by noting that (±1) = 1 and hence the
p p p p
distinct modular solutions of x2 = 1 are x = 1 and x = −1 = p − 1 (noting that modular distinction
p
is because p is an odd prime). We may also prove it by using Problem 2 of § 8.1, i.e. if x2 = 12 then
p p p
x = ±1 (where x = −1 = p − 1 noting again that modular distinction is because p is an odd prime).
4
5. Show that if n ∈ Z is a solution of the congruence equation n3 + 6n2 + n + 6 = 0 then n cannot be the
difference of two squares.
4 4
Solution: The only solution to n3 + 6n2 + n + 6 = 0 is n = 2 (see § 3.2.1 of V1). Now, if n is the
[67] We p p
may similarly say: p = 2 means 0 = 2 which is nonsensical because p is an odd prime.
8.2 Univariate Congruence Equations 105

difference between two squares then we have 4 possibilities regarding the parity of the squares (where
m, k ∈ Z):
4 4
n = (2m + 1)2 − (2k + 1)2 = 0 n = (2m)2 − (2k)2 = 0
4 4
n = (2m + 1)2 − (2k)2 = 1 n = (2m)2 − (2k + 1)2 = 3
As we see, there is no n which is a difference between two squares that is congruent (mod 4) to 2, and
4
hence if n is a difference between two squares then it cannot be a solution to n3 + 6n2 + n + 6 = 0.
th
6. Let P (x) (where x ∈ Z) be an n degree polynomial none of its coefficients is zero. Create examples
for the following:[68]
k
(a) n = 2 and P = 0 (k = 3, 5, 7, 11) has root 0 for all these moduli.
k
(b) n = 3 and P = 0 (k = 2, 6, 9, 13, 15) has root 1 for all these moduli.
12
(c) n = 3 and P = 0 has the following roots (and possibly other roots): 1, 3, 4, 7, 10.
Solution:
(a) If we start with a quadratic whose constant coefficient is 0 (say x2 − x) then it is obvious that
k
x2 − x = 0 (k = 3, 5, 7, 11) has root 0 for all these moduli. Now, if we add to this polynomial the least
common multiple of these moduli (i.e. their product which is 1155) then P = x2 − x + 1155 should
meet all the given conditions.
k
(b) If we start with the linear polynomial (x − 1) then it is obvious that x − 1 = 0 (k = 2, 6, 9, 13, 15)
has root 1 for all these moduli. Now, if we multiply (x − 1) by a quadratic polynomial with non-
zero coefficients (say x2 − 4x + 3) then we get a cubic that meet all the given conditions, i.e. P =
(x − 1)(x2 − 4x + 3) = x3 − 5x2 + 7x − 3.
12
(c) Let the congruence equation be ax3 + bx2 + cx + d = 0 (where a, b, c, d ∈ Z). Now, if this equation
has the given roots (i.e. 1, 3, 4, 7, 10) then we must have:
12
a(1)3 + b(1)2 + c(1) + d = 0
3 2 12
a(3) + b(3) + c(3) + d = 0
12
a(4)3 + b(4)2 + c(4) + d = 0
3 2 12
a(7) + b(7) + c(7) + d = 0
12
a(10)3 + b(10)2 + c(10) + d = 0

On solving this system of congruences for the variables a, b, c, d (see § 4.4.1 of V1 as well as chapter 9
12
of the present volume) we get: (a, b, c, d) = (2, 2, 8, 12). Hence, P = 2x3 + 2x2 + 8x + 12 should meet
all the given conditions.
p
7. Show that the congruence equation n6 − 11n4 + 36n2 − 36 = 0 is always solvable (where p ∈ P and
n ∈ Z).
Solution: We have three (comprehensive) cases to consider:
• p = 2: the polynomial n6 − 11n4 + 36n2 − 36 is even and hence the given congruence is solvable.
3
• p = 3: we have n6 − 11n4 + 36n2 − 36 = 0 which has the solution n = 3k (k ∈ Z).
• p > 3: we have:
n6 − 11n4 + 36n2 − 36 = (n2 − 2)(n2 − 3)(n2 − 6)
Now, from Problem 3 of § 1.8 at least one of 2, 3, 6 must be a quadratic residue (mod p) which means
p
that at least one of the three congruences: n2 − a = 0 (a = 2, 3, 6) is solvable. Therefore, the given
congruence equation is solvable.
So, in all three cases the given congruence equation is solvable and hence it is always solvable.
[68] ThisProblem (and its alike) is about obtaining polynomial congruences with given conditions. The purpose of it is to
improve the skill of constructing such congruences when needed during investigating and solving some number theory
problems.
8.2 Univariate Congruence Equations 106

2010
8. Show that 98n − 68n − 31n + 1 = 0 for all n ∈ N.
Solution: We have 2010 = 2 × 3 × 5 × 67. Now:
2
• 98n − 68n − 31n + 1 is even and hence 98n − 68n − 31n + 1 = 0 for all n ∈ N.
n n n 3 n n n
• 98 − 68 − 31 + 1 = 2 − 2 − 1 + 1 = 0 for all n ∈ N.
5
• 98n − 68n − 31n + 1 = 3n − 3n − 1n + 1 = 0 for all n ∈ N.
67
• 98n − 68n − 31n + 1 = 31n − 1n − 31n + 1 = 0 for all n ∈ N.
2010
Hence, 98n − 68n − 31n + 1 = 0 for all n ∈ N (see rule 14 of § 2.7 of V1).
9. Which of the following quadratic congruence equations are solvable:
3797 5281
(a) 3x2 − 15x + 221 = 0. (b) 11x2 + 4x + 311 = 0.
7171 199
(c) x2 − 19x − 52 = 0. (d) 26x4 + 31x3 − 85x2 − 111x − 5 = 0.
Solution: We use the proposition of Problem 7 of § 8.1 (where Legendre’s symbol criterion is used to
[69]
determine if the discriminant ∆ is a quadratic residue of the modulo or not). 
2 −2427
(a) 3797 is prime. We have ∆ = (−15) − 4 × 3 × 221 = −2427. Now, 3797 = 1 (i.e. ∆ is a quadratic
residue of 3797) and hence the given congruence equation is solvable. 
(b) 5281 is prime. We have ∆ = (4)2 − 4 × 11 × 311 = −13668. Now, −13668 3797 = −1 (i.e. ∆ is a
quadratic non-residue of 5281) and hence the given congruence equation is not solvable.
71
(c) 7171 = 71 × 101. If the given congruence equation is solvable then we must have x2 − 19x − 52 = 0
101  
and x2 − 19x − 52 = 0. We have ∆ = (−19)2 − 4 × (−52) = 569. Now, 569 71 = 1 and 569
101 = 1 and
hence the given congruence is solvable.
(d) 199 is prime. Also, 26x4 + 31x3 − 85x2 − 111x − 5 = (2x2 − x − 5)(13x2 + 22x + 1). So, if the given
199 199
congruence equation is solvable then we must have 2x2 − x − 5 = 0 or/and 13x2 + 22x + 1 = 0.
41
 199
For 2x2 − x − 5 we have ∆ = (−1)2 − 4 × 2 × (−5) = 41. Now, 199 = −1 and hence 2x2 − x − 5 = 0
is not solvable. 
432 199
For 13x2 +22x+1 we have ∆ = (22)2 −4×13×1 = 432. Now, 199 = −1 and hence 13x2 +22x+1 = 0
is not solvable.
Therefore, the given congruence equation is not solvable.
10. Find the number of (modular) solutions of the following exponential congruence equations (where
n ∈ N):
7 10 27 25 22
(a) 5n = 6. (b) 3n = 1. (c) 4n = 7. (d) 7n = 1. (e) 3n = 5.
Solution: We use the proposition of Problem 6 of § 8.1 (noting that all these congruences meet the
required conditions of that proposition where we take r = 5, 3, 2, 2, 7 for k = 7, 10, 27, 25, 22).
7
(a) The congruence 5n = 6 has one solution (mod 6) because I7,5 (5) = 1 and φ(7) = 6 and hence their
gcd is 1.
10
(b) The congruence 3n = 1 has one solution (mod 4) because I10,3 (3) = 1 and φ(10) = 4 and hence
their gcd is 1.
27
(c) The congruence 4n = 7 has two solutions (mod 18) because I27,2 (4) = 2 and φ(27) = 18 and hence
their gcd is 2 (noting that 2 divides I27,2 7 which is 16).
25
(d) The congruence 7n = 1 has five solutions (mod 20) because I25,2 (7) = 5 and φ(25) = 20 and hence
their gcd is 5 (noting that 5 divides I25,2 1 which is 20).
22
(e) The congruence 3n = 5 has two solutions (mod 10) because I22,7 (3) = 4 and φ(22) = 10 and hence
their gcd is 2 (noting that 2 divides I22,7 5 which is 2).
11. Find the solutions of the congruence equations of Problem 10 using the index of integer method.
k
Solution: According to Problem 6 of § 8.1, the congruence equation an = b can be solved by the index
of integer method using the equation:
φ(k)
n Ik,r (a) = Ik,r (b) (36)
[69] For how to evaluate Legendre symbols we refer the reader to § 1.8 (see for instance Problem 8 of § 1.8).
8.2 Univariate Congruence Equations 107

6 6
(a) From Eq. 36 we have n × 1 = 3. So, the solution is n = 3.
4 4
(b) From Eq. 36 we have n × 1 = 4. So, the solution is n = 0.
18 18 9
(c) From Eq. 36 we have n × 2 = 16. So, the solutions are n = 8, 17 (i.e. n = 8).
20 20 4
(d) From Eq. 36 we have n × 5 = 20. So, the solutions are n = 0, 4, 8, 12, 16 (i.e. n = 0).
10 10 5
(e) From Eq. 36 we have n × 4 = 2. So, the solutions are n = 3, 8 (i.e. n = 3).
12. Find all primes p such that the following congruences have solutions:
p p p
(a) x2 − 1 = 0. (b) x2 + 1 = 0. (c) x2 − 2 = 0.
p p p
(d) x2 + 2 = 0. (e) x2 − 4 = 0. (f ) x2 + 4 = 0.
Solution: We note first that all these congruences are solvable for p = 2 and hence in the following we
consider only odd primes.
p
(a) We have x2 = 1, i.e. 1 is a quadratic residue of p. Now, 1 is a quadratic residue for all odd primes
and hence the given congruence is solvable for all p (see Problem 2 of § 1.6).  
p
(b) We have x2 = −1, i.e. −1 is a quadratic residue of p. Now, the Legendre symbol −1 p is +1 for
all p = 4k + 1 and −1 for all p = 4k − 1 (see Problem 9 of § 1.8). So, the given congruence is solvable
for all p = 4k + 1 and non-solvable for all p = 4k − 1.
p
(c) We have x2 = 2, i.e. 2 is a quadratic residue of p. So, from Eq. 7 we conclude that the given
8 8
congruence is solvable for all p = ±1 and non-solvable for all p = ±3.     
p
(d) We have x2 = −2, i.e. −2 is a quadratic residue of p. Now, form Eq. 8 we have −2 p = −1 p
2
p ,
     
i.e. −2 p = 1 if −1p and p2 have the same sign. So, from parts (b) and (c) we conclude that the
8 8 8 8
given congruence is solvable if p = 4k + 1 and p = ±1 (i.e. p = 1) or p = 4k − 1 and p = ±3 (i.e. p = 3)
and non-solvable otherwise.
p
(e) We have x2 = 4, i.e. 4 is a quadratic residue of p. Now, 4 is a quadratic residue for all odd primes
and hence the given congruence is solvable for all p (see Problem 2 of § 1.6).
p
(f ) We have x2 = −4, i.e. −4 is a quadratic residue of p. Now, form Eqs. 8 and 9 we have:
       2    2  
−4 −1 4 −1 2 −1 2 −1
= = = =
p p p p p p p p

So, as in part (b) the given congruence is solvable for all p = 4k + 1 and non-solvable for all p = 4k − 1.
Pp−2 k p
13. Let x ∈ N and P ∋ p > 3. Find all the solutions of the following congruence equation: k=0 x = 0.
p Pp−2 k p p
Solution: We note first that x = 1 is not a possible solution because k=0 1 = p − 1 = −1 6= 0.
p Pp−2 p p
Similarly, x = p is not a possible solution because k=0 pk = 1 6= 0. So, any potential solution must
p
be among x = 2, 3, . . . , p − 1.
We have (see Eq. 12 in V1):
P  P  p
p−2 k p−1 p−2 k
(x − 1) k=0 x = x − 1 → (x − 1) k=0 x = xp−1 − 1 →
P  p p
p−2 k
(x − 1) k=0 x = 0 (x = 2, 3, . . . , p − 1)
p
where we used Fermat’s little theorem in the Plast step(noting that p6 | x for x = 2, 3, . . . , p − 1). The
p−2 k p
last congruence means that p divides (x − 1) k=0 x . Now, for x = 2, 3, . . . , p − 1 we have p6 | (x − 1)
P  Pp−2 p p
p−2 k
and hence we must have p k=0 x , i.e. k=0 xk = 0 for x = 2, 3, . . . , p − 1. So, the solutions of the
Pp−2 p p
congruence k=0 xk = 0 are x = 2, 3, . . . , p − 1.
323
14. Show that the following congruence equation has no solution: 4x4 + 4 = 0.
323 323
Solution: If 4x4 + 4 = 0 then x4 + 1 = 0 (because 4 and 323 are coprime; see rule 7 of § 2.7 of V1).
323
Noting that 323 = 17 × 19, x4 + 1 = 0 means that x4 + 1 is divisible by 17 and divisible by 19, i.e.
8.2 Univariate Congruence Equations 108

17 19 17 17
x4 + 1 = 0 and x4 + 1 = 0. It is fairly obvious that x4 + 1 = 0 has a solution (e.g. x = 2) and hence
323 19 19
x4 + 1 = 0 has a solution iff x4 + 1 = 0 has a solution. So, let us see if x4 + 1 = 0 has a solution
19
(where from now on we can assume that x and 19 are coprime noting that 0 + 1 6= 0).
19 19 19
x4 + 1 = 0 implies x4 = −1 and hence x8 = 1. Now, from Problem 1 of § 1.3 we conclude that O19 x|8,
i.e. O19 x = 1 or O19 x = 2 or O19 x = 4 or O19 x = 8. Now:
19 19 19
• If O19 x = 1 then x1 = 1 and hence x4 = 1 which contradicts x4 = −1.
19 19 19
• If O19 x = 2 then x2 = 1 and hence x4 = 1 which contradicts x4 = −1.
19 19
• If O19 x = 4 then x4 = 1 which contradicts x4 = −1.
So, we must have O19 x = 8. Now, from Problem 3 of § 1.3 we must have 8|φ(19), i.e. 8|18 which is
19 323 323
untrue. This means that x4 + 1 = 0 has no solution and hence x4 + 1 = 0 (as well as 4x4 + 4 = 0)
has no solution.
15. Find all the solutions of the following exponential congruence equations (where x ∈ N):
33 9 15
(a) 13x = 1. (b) 7x = 4. (c) 22x = 13.
Solution: We use points 1 and 2 in the preamble of § 1.3.
10
(a) We have O33 13 = 10 and hence the solutions are x = 0 (i.e. x = 10, 20, 30, . . .).
9 3
(b) We have O9 7 = 3 and 72 = 4 and hence the solutions are x = 2 (i.e. x = 2, 5, 8, . . .).
15 4
(c) We have O15 22 = 4 and 223 = 13 and hence the solutions are x = 3 (i.e. x = 3, 7, 11, . . .).
16. Find an integer a such that:
107 107 107
(a) The congruence equation ax2 = 5 has the solutions x = 4 and x = 103 (where 0 < a < 107).
29 29
(b) The congruence equation ax19 = 43 has the solution x = 21 (where 0 < a < 29).
Solution:
(a) A primitive root of 107 is 2. Taking the index of both sides of the given congruence equation (see
§ 1.5) we have:
 φ(107) 106
I107,2 ax2 = I107,2 (5) → I107,2 (a) + 2I107,2 (x) = I107,2 (5) →
106 106
I107,2 (a) = I107,2 (5) − 2I107,2 (x) → I107,2 (a) = 47 − 2I107,2 (x)
107
Now, if x = 4 then I107,2 (4) = 2 and hence:

106 φ(107)
I107,2 (a) = 47 − 2 × 2 that is I107,2 (a) = 43
107 107
Thus, a = 243 = 7, i.e. a = 7 (noting that 0 < a < 107).
107
Similarly, if x = 103 then I107,2 (103) = 55 and hence:

106 φ(107)
I107,2 (a) = 47 − 2 × 55 that is I107,2 (a) = 43
107
i.e. we get the same result as for x = 4. Therefore, a = 7.
(b) A primitive root of 29 is 2. Taking the index of both sides of the given congruence equation (see §
1.5) we have:
 φ(29) 28
I29,2 ax19 = I29,2 (43) → I29,2 (a) + 19I29,2 (x) = I29,2 (43) →
28 28
I29,2 (a) = I29,2 (43) − 19I29,2 (x) → I29,2 (a) = 13 − 19I29,2 (x)
29
Now, if x = 21 then I29,2 (21) = 17 and hence:

28 φ(29)
I29,2 (a) = 13 − 19 × 17 that is I29,2 (a) = 26
29 29
Thus, a = 226 = 22, i.e. a = 22 (noting that 0 < a < 29).
8.3 Multivariate Congruence Equations 109

17. Solve the following congruence equations (where n ∈ N0 ):


11 263 13
(a) n! = 10. (b) (n + 1)! − n! = 0. (c) 6n! + 7(n − 3)! = 0.
Solution:
11
(a) For all n > 10 we have n! = 0. So, we need only to test n = 0, 1, . . . , 10. On doing this we find that
11 11
n! = 10 is only for n = 5 and n = 10. Hence, the only solutions of n! = 10 are n = 5 and n = 10.
(b) We have:
263   263 263
(n + 1)! − n! = 0 → n! (n + 1) − 1 = 0 → n!(n) = 0
Now, we have two obvious cases in which this congruence is satisfied: n = 0 and n > 262. For
1 ≤ n ≤ 262 we note that 263 is prime and hence it can divide neither n nor n!. Hence, the solutions
of the given congruence are n = 0, 263, 264, . . ..
(c) Because the factorial is defined only for non-negative integers, we must have n ≥ 3. Now, for
13 13
(n − 3) ≥ 13 (i.e. n ≥ 16) we have n! = 0 and (n − 3)! = 0 and hence the given congruence is satisfied.
So, all we need to do is to test 3 ≤ n ≤ 15. On doing this we find out that this congruence has no
solution for any value of 3 ≤ n ≤ 15. So, the solutions of the given congruence are n ≥ 16.

8.3 Multivariate Congruence Equations


In § 4.2 of V1 we investigated multivariate congruence equations of various types (such as polynomials
and exponentials) and how they are solved (giving sufficient examples of them with their solutions). So,
in the following Problems we just do a little more investigation to this type of congruence equations (so
that we keep the space for other issues which were less investigated).
Problems
p
1. Find all P ∋ p < 1000 such that x7 + y 19 = 153 has no solution (where x, y ∈ Z).
19
Solution: If p 6= 1 then y 19 will cycle over all the residue classes of p and hence we must have a
19
solution. So, all we need to do is to test the p’s which are equal to 1 (mod 19), i.e. p = 1. Now, the only
p
p < 1000 which meet this condition are: 191, 229, 419, 457, 571, 647, 761. On testing x7 + y 19 = 153
for these values of p we find that this congruence has solutions for all these values of p. So, there is no
p
P ∈ p < 1000 such that x7 + y 19 = 153 has no solution. Also see Problem 2 of § 18.3.
11
2. Show that the following congruence equation has no solution: x5 + y 6 = 7.
Solution: The residues of x5 (mod 11) are 0, 1, 10 while the residues of y 6 (mod 11) are 0, 1, 3, 4, 5, 9.
Hence, no combination of these residues can add up to 7 (mod 11). Therefore, this congruence equation
has no solution.
3. Solve the following linear polynomial congruence equations (where x, y, z ∈ Z):
3 5 5
(a) 2x + y = 0. (b) x − 2y = 3. (c) x − 4y = 2.
7 2 3
(d) 5x + y = 1. (e) x + y − z = 0. (f ) 2x + y + z = 1.
Solution: All these congruences can be easily solved by considering all the modular combinations of
x, y, z (as we did in parts a, b and c of Problem 1 of § 4.2.1 of V1).
3
(a) (x, y) = (0, 0) (1, 1) (2, 2)
5
(b) (x, y) = (0, 1) (1, 4) (2, 2) (3, 0) (4, 3)
5
(c) (x, y) = (0, 2) (1, 1) (2, 0) (3, 4) (4, 3)
7
(d) (x, y) = (0, 1) (1, 3) (2, 5) (3, 0) (4, 2) (5, 4) (6, 6)
2
(e) (x, y, z) = (0, 0, 0) (0, 1, 1) (1, 0, 1) (1, 1, 0)
3
(f ) (x, y, z) = (0, 0, 1) (0, 1, 0) (0, 2, 2) (1, 0, 2) (1, 1, 1) (1, 2, 0) (2, 0, 0) (2, 1, 2) (2, 2, 1)
4. Solve the following non-linear polynomial congruence equations (where x, y, z ∈ Z):
8.3 Multivariate Congruence Equations 110

2 3 5 5
(a) x3 + y = 0. (b) x2 + y 3 = 1. (c) 3x2 + 4y 4 = 1. (d) x2 + 2y + 3z = 1.
Solution: All these congruences can be easily solved by considering all the modular combinations of
x, y, z (as we did in parts d, e and f of Problem 1 of § 4.2.1 of V1).
2
(a) (x, y) = (0, 0) (1, 1)
3
(b) (x, y) = (0, 1) (1, 0) (2, 0)
5
(c) (x, y) = (2, 1) (2, 2) (2, 3) (2, 4) (3, 1) (3, 2) (3, 3) (3, 4)
5
(d) (x, y, z) = (0, 0, 2) (0, 1, 3) (0, 2, 4) (0, 3, 0) (0, 4, 1) (1, 0, 0) (1, 1, 1) (1, 2, 2) (1, 3, 3)
(1, 4, 4) (2, 0, 4) (2, 1, 0) (2, 2, 1) (2, 3, 2) (2, 4, 3) (3, 0, 4) (3, 1, 0) (3, 2, 1)
(3, 3, 2) (3, 4, 3) (4, 0, 0) (4, 1, 1) (4, 2, 2) (4, 3, 3) (4, 4, 4)
5. Solve the following exponential congruence equations (where x, y, z ∈ N0 ):
5 7 11
(a) 3x + 4y = 2. (b) 3x + 5y = 1. (c) 5x + 7y = 10.
7 11 11
(d) 2x + 3y + 5z = 4. (e) 3x + 4y + 7z = 5. (f ) 2x + 3y + 5z = 4.
Solution: All these congruences can be easily solved by considering all the modular combinations of
the exponentials (as we did in § 4.2.2 of V1).
4 2
(a) (x =, y =) (0, 0) (1, 1)
6 6
(b) (x =, y =) (1, 1) (2, 3) (3, 4) (4, 2) (5, 5)
5 10
(c) (x =, y =) (0, 8) (1, 2) (2, 1) (3, 7) (4, 0)
3 6 6
(d) (x =, y =, z =) (0, 0, 4) (0, 2, 0) (0, 3, 2) (0, 4, 3) (0, 5, 1) (1, 0, 0) (1, 1, 3) (1, 3, 5)
(1, 4, 1) (1, 5, 2) (2, 0, 3) (2, 1, 2) (2, 2, 1) (2, 3, 0) (2, 4, 5) (2, 5, 4)
5 5 10
(e) (x =, y =, z =) (0, 0, 4) (0, 2, 5) (0, 3, 7) (0, 4, 0) (1, 0, 0) (1, 1, 8) (1, 2, 9) (1, 3, 6)
(1, 4, 5) (2, 0, 7) (2, 1, 4) (2, 2, 3) (2, 3, 8) (2, 4, 6) (3, 0, 5) (3, 1, 1)
(3, 2, 7) (3, 3, 3) (3, 4, 9) (4, 1, 9) (4, 2, 1) (4, 3, 4) (4, 4, 8)
10 5 5
(f ) (x =, y =, z =) (0, 2, 1) (0, 3, 4) (1, 0, 0) (1, 2, 3) (1, 4, 4) (3, 1, 3) (3, 2, 4) (3, 4, 2)
(4, 0, 4) (4, 2, 0) (4, 3, 1) (5, 0, 3) (5, 4, 0) (6, 0, 1) (6, 1, 2) (6, 3, 0)
(7, 1, 1) (7, 3, 2) (7, 4, 3) (8, 1, 4) (8, 2, 2) (9, 3, 3) (9, 4, 1)
6. Solve the following congruence equations (where m, n ∈ N0 and x ∈ Z):
7 11 5
(a) x2 + n! = 0. (b) 7m + n! = 1. (c) 2x2 + 3m + n! = 0.
Solution:
(a) We have five main cases to consider:
7
• n = 0, 1, 2, 5 and hence x2 + a = 0 (where a = 1, 1, 2, 120 respectively) which has no solution.
7 7
• n = 3 and hence x2 + 6 = 0 whose solutions are x = 1, 6.
7 7
• n = 4 and hence x2 + 24 = 0 whose solutions are x = 2, 5.
7 7
• n = 6 and hence x2 + 720 = 0 whose solutions are x = 1, 6.
7 7
• n > 6 and hence x2 = 0 whose solution is x = 0.
So in brief, the solutions of the given congruence equation are (where N ∋ b > 6 and k ∈ Z):
(n, x) = (3, 1 + 7k) (3, 6 + 7k) (4, 2 + 7k) (4, 5 + 7k) (6, 1 + 7k) (6, 6 + 7k) (b, 7k)
(b) We have:
10 11
7m =0,1,2,3,4,5,6,7,8,9 = 1, 7, 5, 2, 3, 10, 4, 6, 9, 8 and
11
n!(n = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, > 10) = 1, 1, 2, 6, 2, 10, 5, 2, 5, 1, 10, 0.
On considering all the possible combinations we get the following solutions (noting that m is in modulo
10 while n is in ordinary arithmetic):
(m, n) = (0, > 10) (1, 6) (1, 8) (3, 5) (3, 10) (5, 2) (5, 4) (5, 7) (7, 3)
8.3 Multivariate Congruence Equations 111

(c) We have:
5 5
2x2 (x = 0, 1, 2, 3, 4) = 0, 2, 3, 3, 2 and
4 5
3m=0,1,2,3 = 1, 3, 4, 2 and
5
n!(n = 0, 1, 2, 3, 4, > 4) = 1, 1, 2, 1, 4, 0.
On considering all the possible combinations we get the following solutions (noting that x is in modulo
5 and m is in modulo 4 while n is in ordinary arithmetic):
(x, m, n) = (0, 0, 4) (0, 1, 2) (0, 2, 0) (0, 2, 1) (0, 2, 3) (1, 0, 2) (1, 1, > 4)
(1, 2, 4) (1, 3, 0) (1, 3, 1) (1, 3, 3) (2, 0, 0) (2, 0, 1) (2, 0, 3)
(2, 1, 4) (2, 3, > 4) (3, 0, 0) (3, 0, 1) (3, 0, 3) (3, 1, 4) (3, 3, > 4)
(4, 0, 2) (4, 1, > 4) (4, 2, 4) (4, 3, 0) (4, 3, 1) (4, 3, 3)
Chapter 9
Congruence Systems
In this chapter we investigate some examples of systems of congruence equations of various types and how
they are solved. In fact, this chapter should be regarded as continuation to the previous chapter as both
chapters are essentially about solving congruence equations (i.e. individually or collectively).[70]

9.1 General Issues about Congruence Systems


1. Define the meaning of “solving a system of congruence equations”.
Solution: It means finding the intersection of solutions of the individual congruence equations (whether
this intersection is the empty set or not).
2. What is the number of solutions a system of congruence equations can have?
Solution: A system of congruence equations can have no solution, or a single solution, or finitely many
solutions (i.e. in modular arithmetic sense).
3. Investigate the solvability of the congruence equations of the following system as well as the solvability
of the system itself:
p p p
x2 = m x2 = n x2 = mn
where p is an odd prime, and m, n ∈ Z are coprime to p.
Solution: We have four cases to consider (noting that we use Problem 11 of § 8.1):
• m is a quadratic residue and n is a quadratic non-residue of p and hence only the first congruence is
solvable, i.e. the second and third congruences (as well as the system) are non-solvable.
• n is a quadratic residue and m is a quadratic non-residue of p and hence only the second congruence
is solvable, i.e. the first and third congruences (as well as the system) are non-solvable.
• Both m and n are quadratic non-residues of p and hence only the third congruence is solvable, i.e.
the first and second congruences (as well as the system) are non-solvable.
• Both m and n are quadratic residues of p and hence all the three congruences are solvable. Regarding
the solvability of the system, it is potentially solvable (noting that the solvability of the individual
equations of a system is a necessary but not sufficient condition for the solvability of the system).[71]
4. Propose a criterion for the solvability of a system of univariate linear congruence equations.
Solution: We use the following proposition (which may be regarded as an “addendum” or extension[72]
to the Chinese remainder theorem and can be used as a criterion for solvability): the following system
of simultaneous linear congruence equations in the unknown x ∈ Z:
m m m
x =1 n1 x =2 n2 ··· x =k nk

(where N ∋ m1 , m2 , . . . , mk > 1 and n1 , n2 , . . . , nk ∈ Z) is solvable iff ni − nj (i, j = 1, 2, . . . , k) is


divisible by gcd(mi , mj ) for every i and j (where i 6= j). When the system meets this criterion (i.e. it
m
is solvable) then the general solution of the system is represented by a single congruence x = n where
m = lcm(m1 , m2 , . . . , mk ) and n ∈ Z.

[70] In fact, it is also continuation to the material about this topic which we investigated in the first volume of this book.
[71] In fact, there are some details about the nature of m and n and if they belong to different residue classes or not. In
7 7 7
general, such a system is solvable in trivial cases like x2 = 8, x2 = 15, x2 = 120 (noting that 8, 15, 120 belong to the
same residue class modulo 7, i.e. 1).
[72] See Problem 3 of § 9.2.2 and Problem 5 of § 9.3.2 for more details about this issue.

112
9.2 Univariate Congruence Systems 113

9.2 Univariate Congruence Systems


9.2.1 Single Modulo
1. Solve the following systems of non-linear polynomial congruence equations (where x ∈ Z):
70 70
(a) 15x2 − x − 2 = 0 x3 + 2x2 + 5 = 0.
2210 2210
(b) x3 − x2 + 12 = 0 x3 + 305x2 − 612x − 226 = 0.
166 166
(c) 14x2 − 32 = 0 x3 − 50x2 − 69x − 18 = 0.
Solution:[73]
70
(a) The solutions of the first congruence are: x = 13, 23, 48, 58 while the solutions of the second con-
70 70
gruence are: x = 23, 65. So, the solution of the system is x = 23.
2210
(b) Both these congruences have the following solutions: x = 24, 219, 778, 908, 999, 1103, 1129, 1324,
1883, 2013, 2104, 2208. So, these are the solutions of this system.
166
(c) The solutions of the first congruence are: x = 21, 62, 104, 145 while the solutions of the second
166 166
congruence are: x = 62, 72, 82, 145, 155, 165. So, the solutions of the system are x = 62, 145.
0
2. Solve the following systems of exponential congruence equations (where x ∈ N ):
11 11
(a) 3x + 4x = 3 2x + 5x = 7.
17 17
(b) 5x + 7x + 8x = 10 2x + 4x + 9x = 16.
164 164
(c) 11x + 17x + 31x = 3 13x + 19x + 23x = 155.
Solution:
5 10
(a) The solutions of the first congruence are: x = 2, 3 (i.e. x = 2, 3, 7, 8) while the solutions of the
10 10
second congruence are: x = 1, 2, 8. So, the solutions of the system are x = 2, 8.
16
(b) The solutions of the first congruence are: x = 11, 14, 15 while the solutions of the second congru-
8 16 8
ence are: x = 2, 4, 6. Now, if we try all the 9 combinations of x = 11, 14, 15 with x = 2, 4, 6 (using the
16
Chinese remainder theorem) we find that the only solution to this system is x = 14.[74]
40
(c) The solutions of the first congruence are: x = 0, 21, 31 while the solutions of the second congruence
40 40
are: x = 21. Hence, the only solution to this system is x = 21.
3. Solve the following systems of mixed polynomial-exponential congruence equations (where x ∈ N0 ):
124 124
(a) 2x3 + 5x2 + 8x + 1 = 0 5x + 7x = 12.
77 77
(b) x4 + 12x2 + 7x + 22 = 0 13x + 25x = 2.
69 69
(c) 6x3 + 33x2 + 13x = 0 19x + 35x + 41x = 38.
Solution:
124
(a) The solutions of the first congruence are: x = 3, 17, 55, 65, 79, 117 while the solutions of the
30 124
second congruence are: x = 1, 17. Now, if we try the 12 combinations of x = 3, 17, 55, 65, 79, 117
30
with x = 1, 17 (using the Chinese remainder theorem) we find that the solutions of this system are:
1860
x = 17, 241, 437, 451, 737, 871, 947, 1171, 1367, 1381, 1667, 1801.
77
(b) The solutions of the first congruence are: x = 22, 55 while the solutions of the second congruence
30 77 30
are: x = 0, 12. Now, if we try the 4 combinations of x = 22, 55 with x = 0, 12 we find that the solutions

[73] For how to obtain the solutions of the individual congruence equations (in this and other Problems), we refer the reader
to the previous chapter (as well as V1).
[74] Alternatively (and more simply), if we convert modulo 8 to modulo 16 (similar to what we did in part a by converting
16
modulo 5 to modulo 10) then the solutions of the second congruence are: x = 2, 4, 6, 10, 12, 14 and hence we obtain the
same result.
9.2.2 Multiple Moduli 114

2310
of this system are: x = 132, 330, 792, 1980.
69
(c) The solutions of the first congruence are: x = 0, 33, 42 while the solutions of the second congruence
22 69 22
are: x = 13, 17, 19. Now, if we try the 9 combinations of x = 0, 33, 42 with x = 13, 17, 19 we find that
1518
the solutions of this system are: x = 171, 387, 525, 585, 723, 897, 1311, 1449, 1491.

9.2.2 Multiple Moduli


1. Solve the following system of non-linear polynomial congruence equations:
21 19
33x8 = 27 x3 − 4x2 + 3x + 5 = 0
Solution: The solutions of these equations (respectively) are (see for example § 3.2.1 of V1):
21 19
x = 2, 5, 9, 12, 16, 19 x = 6, 8, 9
7
The first of these congruences can be simplified to x = 2, 5.[75] Now, if we consider the 6 combinations
7 19
of x = 2, 5 with x = 6, 8, 9 then we obtain 6 systems of linear congruence equations which can be solved
(for instance) by the Chinese remainder theorem. These solutions are given in the following table:
19 19 19
x=6 x=8 x=9
7
x=2 44 65 9
7
x=5 82 103 47
133
So, the solutions of the given system of congruences are: x = 9, 44, 47, 65, 82, 103.
2. Which of the following systems of simultaneous linear congruence equations is solvable (giving their
solutions when they are solvable):
3 9 23
(a) x = 2 x=5 x = 8.
8 6 31
(b) x = 5 x = 11 x = 19.
11 16 99
(c) x = 1 x=7 x = 18.
29 34 48
(d) x = 19 x = 14 x = 13.
7 21 35 49
(e) x = 5 x = 12 x = 19 x = 33.
Solution: We use the criterion of Problem 4 of § 9.1.
(a) We have:
gcd(3, 9)|(5 − 2) gcd(3, 23)|(8 − 2) gcd(9, 23)|(8 − 5)
207
Hence, the system is solvable. Its solution is x = 77 noting that 207 = lcm(3, 9, 23).
(b) We have:
gcd(8, 6)|(11 − 5) gcd(8, 31)|(19 − 5) gcd(6, 31)|(19 − 11)
744
Hence, the system is solvable. Its solution is x = 701 noting that 744 = lcm(8, 6, 31).
(c) We have:
gcd(11, 16)|(7 − 1) gcd(11, 99)6 | (18 − 1) gcd(16, 99)|(18 − 7)
Hence, the system is not solvable.
(d) We have:
gcd(29, 34)|(19 − 14) gcd(29, 48)|(19 − 13) gcd(34, 48)6 | (14 − 13)
Hence, the system is not solvable.
(e) We have:

[75] Instead, 21 7
we could have simplified the congruence 33x8 = 27 to 11x8 = 9 (by using rule 9 of § 2.7 of V1) and hence obtain
7
the solution x = 2, 5.
9.2.2 Multiple Moduli 115

gcd(7, 21)|(12 − 5) gcd(7, 35)|(19 − 5) gcd(7, 49)|(33 − 5)


gcd(21, 35)|(19 − 12) gcd(21, 49)|(33 − 12) gcd(35, 49)|(33 − 19)
735
Hence, the system is solvable. Its solution is x = 474 noting that 735 = lcm(7, 21, 35, 49).
3. Discuss the extensions (or generalizations) that we introduced in the previous Problems on the (original)
Chinese remainder theorem (as given in § 2.7.3 of V1).
Solution: We can identify two extensions:
• The extension that was introduced (implicitly) in Problem 1 by lifting the restriction of linearity,[76]
i.e. when the system contains non-linear congruences then we “decompose” the non-linear congruences
to their linear solutions and consider the possible combinations of solutions (as we did in Problem
1). Although this is not an extension to the Chinese remainder theorem itself, it is an extension that
enables the employment of the Chinese remainder theorem to solve non-linear systems (i.e. systems
that include non-linear congruences).[77]
• The extension that was introduced in Problem 4 of § 9.1 by lifting the restriction of coprimality of
moduli, i.e. the condition of pairwise coprimality of the moduli m1 , m2 , . . . , mk (which we imposed
earlier in the statement of the Chinese remainder theorem; see § 2.7.3 of V1) does not appear in
this proposition and hence this proposition is an extension or generalization to the (original) Chinese
remainder theorem.
Also see Problem § 5 of § 9.3.2.
4. Solve the following systems of non-linear polynomial congruence equations (where x ∈ Z):
70 99
(a) 15x2 − x − 2 = 0 x3 + 2x2 + 21 = 0.
372 524
(b) 2x4 + 3x2 + 18x + 9 = 0 x4 − 33x3 − 28 = 0.
422 621
(c) x3 + 7x2 − x + 1 = 0 3x2 + 27x + 6 = 0.
Solution:
70
(a) The solutions of the first congruence are: x = 13, 23, 48, 58 while the solutions of the second con-
99 70 99
gruence are: x = 40, 58, 76. Now, if we try the 12 combinations of x = 13, 23, 48, 58 with x = 40, 58, 76
6930
(as we did in Problem 1) we find that the solutions of this system are: x = 58, 373, 2218, 2533, 2848,
3208, 3523, 3838, 5683, 5998, 6313, 6673.
372
(b) The solutions of the first congruence are: x = 69, 105, 255, 291 while the solutions of the second
524 372
congruence are: x = 18, 149, 280. Now, if we try the 12 combinations of x = 69, 105, 255, 291 with
524 48732
x = 18, 149, 280 we find only the following two solutions: x = 29493, 35781.
422
(c) The solutions of the first congruence are: x = 77, 361, 399 while the solutions of the second con-
207 422
gruence are: x = 31, 77, 121, 167. Now, if we try the 12 combinations of x = 77, 361, 399 with
207 87354
x = 31, 77, 121, 167 we find that the solutions of this system are: x = 77, 7573, 19489, 26663, 29057,
46075, 48469, 48929, 55643, 68341, 75055, 75515.
5. Solve the following systems of exponential congruence equations (where x ∈ N0 ):
11 19
(a) 3x + 4x = 3 2x + 5x = 7.
17 31
(b) 5x + 7x + 8x = 2 2x + 4x + 9x = 7.
164 175
(c) 11x + 17x + 31x = 3 13x + 19x + 23x = 3.
Solution:
5
(a) The solutions of the first congruence are: x = 2, 3 while the solutions of the second congruence are:
18
x = 1. On trying these two combinations (using the Chinese remainder theorem) we get the following

[76] Infact, this extension is also present in the upcoming Problems of this subsection.
[77] Actually, this extension normally deals with non-linear systems of polynomial type (although the idea is applicable to
other types of non-linear systems).
9.3 Multivariate Congruence Systems 116

90
two solutions: x = 37, 73.
16
(b) The solutions of the first congruence are: x = 2 while the solutions of the second congruence are:
15 240
x = 8, 10. On trying these two combinations we get the following two solutions: x = 98, 130.
40
(c) The solutions of the first congruence are: x = 0, 21, 31 while the solutions of the second congruence
60 120
are: x = 0. Hence, the only solution to this system is x = 0.
6. Solve the following systems of mixed polynomial-exponential congruence equations (where x ∈ N0 ):
124 144
(a) 2x3 + 5x2 + 8x + 1 = 0 5x + 7x = 12.
77 101
(b) x4 + 12x2 + 7x + 22 = 0 13x + 25x = 2.
69 117
(c) 6x3 + 33x2 + 13x = 0 19x + 35x + 41x = 3.
Solution:
124
(a) The solutions of the first congruence are: x = 3, 17, 55, 65, 79, 117 while the solutions of the second
12 124 12
congruence are: x = 1. On trying the 6 combinations of x = 3, 17, 55, 65, 79, 117 with x = 1 (using the
372
Chinese remainder theorem) we find that the only solutions of this system are: x = 241, 265, 313.
77
(b) The solutions of the first congruence are: x = 22, 55 while the solutions of the second congruence
50 77 50
are: x = 0. On trying the two combinations of x = 22, 55 with x = 0 we find that the solutions of this
3850
system are: x = 1100, 2750.
69
(c) The solutions of the first congruence are: x = 0, 33, 42 while the solutions of the second congruence
12 69 12
are: x = 0. On trying these three combinations of x = 0, 33, 42 with x = 0 we find that the solutions
276
of this system are: x = 0, 180, 240.

9.3 Multivariate Congruence Systems


9.3.1 Single Modulo
In § 4.4.1 of V1 we discussed systems of multivariate linear congruence equations with a single modulo and
how they are solved (giving some examples of them with their solutions). So, in the following Problems
we restrict our attention to systems of multivariate non-linear congruence equations with a single modulo.
Problems
1. Solve the following systems of non-linear polynomial congruences (where x, y, z ∈ Z):
17 17
(a) x3 + y = 0 3x2 + 4y 4 = 1.
41 41
(b) x2 + y 3 = 1 4x2 + 2y = 3.
88 88
(c) x3 + y 2 + 2z 2 = 1 x2 + 2y + 3z = 1.
Solution:
(a) The solutions of these equations are (see § 8.3):
17
(x, y) = (0, 0) (1, 16) (2, 9) (3, 7) (4, 4) (5, 11) (6, 5) (7, 14) (8, 15) (9, 2)
(10, 3) (11, 12) (12, 6) (13, 13) (14, 10) (15, 8) (16, 1)
17
(x, y) = (0, 3) (0, 5) (0, 12) (0, 14) (4, 1) (4, 4) (4, 13) (4, 16) (8, 2) (8, 8)
(8, 9) (8, 15) (9, 2) (9, 8) (9, 9) (9, 15) (13, 1) (13, 4) (13, 13) (13, 16)
As we see, what is common between these two sets of solutions (i.e. their intersection) are the following
17
4 solutions: (x, y) = (4, 4), (8, 15), (9, 2) and (13, 13). So, these are the solutions of the system.
Alternatively, we can solve this system more simply by just looping over x and y (e.g. by a simple code
or a spreadsheet) between 0 and 16 (considering all the 17 × 17 combinations) to get these 4 solutions.
(b) By looping (or by following a similar approach to that of part a) we get the following two solutions:
41
(x, y) = (2, 14) and (39, 14).
9.3.1 Single Modulo 117

 88
(c) By looping we get the following 32 solutions in modulo 88 i.e. (x, y, z) = :
(1, 0, 0) (1, 44, 0) (9, 12, 24) (9, 28, 72) (9, 56, 24) (9, 72, 72) (17, 28, 32)
(17, 72, 32) (21, 6, 84) (21, 38, 4) (21, 50, 84) (21, 82, 4) (33, 20, 64) (33, 40, 80)
(33, 64, 64) (33, 84, 80) (45, 22, 44) (45, 66, 44) (53, 6, 28) (53, 34, 68) (53, 50, 28)
(53, 78, 68) (61, 6, 76) (61, 50, 76) (65, 16, 48) (65, 28, 40) (65, 60, 48) (65, 72, 40)
(77, 18, 36) (77, 42, 20) (77, 62, 36) (77, 86, 20)
2. Solve the following systems of exponential congruence equations (where x, y, z ∈ N0 ):
19 19
(a) 3x + 4y = 2 3x + 5y = 1.
41 41
(b) 3x + 4y = 2 5x + 7y = 10.
11 11
(c) 2x + 3y + 5z = 4 3x + 4y + 7z = 5.
Solution:
(a) The solutions of these equations are (see § 8.3):
18 9
(x =, y =) (0, 0) (4, 2) (5, 7) (10, 8) (11, 6) (13, 3) (14, 5) (15, 4) (16, 1)
18 9
(x =, y =) (1, 4) (2, 3) (5, 1) (10, 8) (12, 5) (13, 2) (14, 7) (17, 6)
As we see, what is common between these two sets of solutions (i.e. their intersection) is only one so-
18 9
lution, i.e. x = 10 and y = 8. So, this is the only solution to this system.
(b) The solutions of these equations are:
8 10
(x =, y =) (0, 0) (1, 5) (3, 2)
20 40
(x =, y =) (0, 10) (1, 18) (2, 23) (3, 2) (5, 0) (6, 39) (7, 12) (8, 22)
(9, 14) (10, 37) (11, 3) (12, 19) (13, 13) (14, 6) (15, 31) (16, 15)
(17, 17) (18, 29) (19, 24)
Now, we form the following 57 systems of linear congruence equations in x (where the rows represent
x in mod 8 and the columns represent x in mod 20 while the entries represent x in mod 40 noting that
the empty entries mean no solution) and solve them (by the Chinese remainder theorem):
0 1 2 3 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
0 0 8 32 16
1 1 25 9 33
3 3 27 11 35 19
We also form the following 57 systems of linear congruence equations in y (where the rows represent y
in mod 10 and the columns represent y in mod 40 while the entries represent y in mod 40 noting that
the empty entries mean no solution) and solve them:
10 18 23 2 0 39 12 22 14 37 3 19 13 6 31 15 17 29 24
0 10 0
5 15
2 2 12 22
40
On comparing the two tables we can see that we have only 3 solutions: (x, y) = (0, 10), (3, 2) and (27, 12).
(c) The solutions of these equations are given in Problem 5 of § 8.3. Now if we consider the 529 (i.e.
23 × 23) combinations we can eliminate most of them and obtain the solutions as follows:
5 10
• For x = 0: we have a solution only for x = 0, 5. Moreover, because y must be identical (since it is
in mod 5 in both sets of solutions) then we have only the following 5 potentially solvable combinations
(noting that these combinations are one-to-one):
5 5 10
(x =, y =, z =) (0, 0, 4) (0, 2, 5) (0, 3, 7) (0, 4, 0)
10 5 5
(x =, y =, z =) (5, 0, 3) (0, 2, 1) (0, 3, 4) (5, 4, 0)
9.3.1 Single Modulo 118

However, considering the solvability of the z system, only the last combination has a solution, i.e.
10 5 10
(x =, y =, z =) = (5, 4, 0).
5
• For x = 1: following the procedure of the previous point we get the following 6 combinations:
5 5 10
(x =, y =, z =) (1, 0, 0) (1, 0, 0) (1, 1, 8) (1, 2, 9) (1, 3, 6) (1, 4, 5)
10 5 5
(x =, y =, z =) (1, 0, 0) (6, 0, 1) (6, 1, 2) (1, 2, 3) (6, 3, 0) (1, 4, 4)
10 5 10
However, only the first combination has a solution, i.e. (x =, y =, z =) = (1, 0, 0).
5
• For x = 2: we get the following 3 combinations:
5 5 10
(x =, y =, z =) (2, 1, 4) (2, 3, 8) (2, 4, 6)
10 5 5
(x =, y =, z =) (7, 1, 1) (7, 3, 2) (7, 4, 3)
However, none of these combination has a solution.
5
• For x = 3: we get the following 5 combinations:
5 5 10
(x =, y =, z =) (3, 1, 1) (3, 1, 1) (3, 2, 7) (3, 2, 7) (3, 4, 9)
10 5 5
(x =, y =, z =) (3, 1, 3) (8, 1, 4) (3, 2, 4) (8, 2, 2) (3, 4, 2)
10 5 10
However, only the fourth combination has a solution, i.e. (x =, y =, z =) = (8, 2, 7).
5
• For x = 4: we get the following 4 combinations:
5 5 10
(x =, y =, z =) (4, 2, 1) (4, 3, 4) (4, 3, 4) (4, 4, 8)
10 5 5
(x =, y =, z =) (4, 2, 0) (4, 3, 1) (9, 3, 3) (9, 4, 1)
However, none of these combinations has a solution.
10 5 10
So in brief, this system has only three solutions, i.e. (x =, y =, z =) = (1, 0, 0), (5, 4, 0) and (8, 2, 7).
3. Solve the following system of mixed polynomial-exponential congruences (where x, y ∈ N0 ):
11 11
x3 + y = 0 3x + 4y = 2.
Solution: The solutions of these equations are (see § 8.3):
11
(x, y) = (0, 0) (1, 10) (2, 3) (3, 6) (4, 2) (5, 7) (6, 4) (7, 9) (8, 5) (9, 8) (10, 1)
5
(x, y) = (0, 0) (2, 1) (4, 3)
Now, we form the following 33 systems of linear congruence equations in x and the corresponding 33
systems of linear congruence equations in y and solve them where the solutions are shown in the third
and sixth columns:
11 5 55 11 5 55
x= x= x= y= y= y=
0 0,2,4 0,22,44 0 0,1,3 0,11,33
1 0,2,4 45,12,34 10 0,1,3 10,21,43
2 0,2,4 35,2,24 3 0,1,3 25,36,3
3 0,2,4 25,47,14 6 0,1,3 50,6,28
4 0,2,4 15,37,4 2 0,1,3 35,46,13
5 0,2,4 5,27,49 7 0,1,3 40,51,18
6 0,2,4 50,17,39 4 0,1,3 15,26,48
7 0,2,4 40,7,29 9 0,1,3 20,31,53
8 0,2,4 30,52,19 5 0,1,3 5,16,38
9 0,2,4 20,42,9 8 0,1,3 30,41,8
10 0,2,4 10,32,54 1 0,1,3 45,1,23
55
So, these are the solutions of the given system, i.e. (x, y) = (0, 0), (22, 11), (44, 33) . . . , (32, 1), (54, 23).
9.3.2 Multiple Moduli 119

9.3.2 Multiple Moduli


1. Solve the following systems of linear congruence equations (where x, y, z ∈ Z):
3 5
(a) 2x + y = 0 x − 2y = 3.
5 7
(b) x − 4y = 2 5x + y = 1.
9 11
(c) 6x − 3y = 1 5x + 2y = 3.
2 3
(d) x + y − z = 0 2x + y + z = 1.
Solution:
(a) The solutions of these equations are (see Problem 3 of § 8.3):
3
(x, y) = (0, 0) (1, 1) (2, 2)
5
(x, y) = (0, 1) (1, 4) (2, 2) (3, 0) (4, 3)
Now, we form the following 15 systems of linear congruence equations in x and the corresponding 15
systems of linear congruence equations in y and solve them (using for instance the Chinese remainder
theorem) where the solutions are shown in the third and sixth rows:
3
x= 0 0 0 0 0 1 1 1 1 1 2 2 2 2 2
5
x= 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4
15
x= 0 6 12 3 9 10 1 7 13 4 5 11 2 8 14
3
y= 0 0 0 0 0 1 1 1 1 1 2 2 2 2 2
5
y= 1 4 2 0 3 1 4 2 0 3 1 4 2 0 3
15
y= 6 9 12 0 3 1 4 7 10 13 11 14 2 5 8
15
So, these are the solutions of the given system, i.e. (x, y) = (0, 6), (6, 9), . . . , (14, 8).
(b) The solutions of these equations are (see Problem 3 of § 8.3):
5
(x, y) = (0, 2) (1, 1) (2, 0) (3, 4) (4, 3)
7
(x, y) = (0, 1) (1, 3) (2, 5) (3, 0) (4, 2) (5, 4) (6, 6)
On forming 35 systems of linear congruence equations in x and the corresponding 35 systems of linear
congruence equations in y (as we did in part a) and solving them we get the following 35 solutions:
35
(x, y) = (0, 22) (1, 31) (2, 5) (3, 14) (4, 23) (5, 32) (6, 6) (7, 15) (8, 24)
(9, 33) (10, 7) (11, 16) (12, 25) (13, 34) (14, 8) (15, 17) (16, 26) (17, 0)
(18, 9) (19, 18) (20, 27) (21, 1) (22, 10) (23, 19) (24, 28) (25, 2) (26, 11)
(27, 20) (28, 29) (29, 3) (30, 12) (31, 21) (32, 30) (33, 4) (34, 13)
(c) The first equation has no solution[78] and hence this system has no solution.
(d) The solutions of these equations are (see Problem 3 of § 8.3):
2
(x, y, z) = (0, 0, 0) (0, 1, 1) (1, 0, 1) (1, 1, 0)
3
(x, y, z) = (0, 0, 1) (0, 1, 0) (0, 2, 2) (1, 0, 2) (1, 1, 1) (1, 2, 0) (2, 0, 0) (2, 1, 2) (2, 2, 1)
On forming 36 systems of linear congruence equations in x (and the corresponding 36 systems in y and
36 systems in z as we did in parts a and b) and solving them we get the following 36 solutions:

[78] If 9 9
we multiply the congruence by 3 we get 18x − 9y = 3, i.e. 0 = 3 which is nonsensical.
9.3.2 Multiple Moduli 120

6
(x, y) = (0, 0, 4) (0, 1, 3) (0, 2, 2) (0, 3, 1) (0, 4, 0) (0, 5, 5) (1, 0, 5) (1, 1, 4) (1, 2, 3)
(1, 3, 2) (1, 4, 1) (1, 5, 0) (2, 0, 0) (2, 1, 5) (2, 2, 4) (2, 3, 3) (2, 4, 2) (2, 5, 1)
(3, 0, 1) (3, 1, 0) (3, 2, 5) (3, 3, 4) (3, 4, 3) (3, 5, 2) (4, 0, 2) (4, 1, 1) (4, 2, 0)
(4, 3, 5) (4, 4, 4) (4, 5, 3) (5, 0, 3) (5, 1, 2) (5, 2, 1) (5, 3, 0) (5, 4, 5) (5, 5, 4)
2. Solve the following systems of non-linear polynomial congruence equations (where x, y, z ∈ Z):
2 5
(a) x3 + y = 0 3x2 + 4y 4 = 1.
3 7
(b) x2 + y 3 = 1 4x2 − 5y = 3.
3 5
(c) x3 − 2y 2 + 2z 2 = 1 x2 + 2y + 3z = 1.
Solution:
(a) The solutions of these equations are (see Problem 4 of § 8.3):
2
(x, y) = (0, 0) (1, 1)
5
(x, y) = (2, 1) (2, 2) (2, 3) (2, 4) (3, 1) (3, 2) (3, 3) (3, 4)
On forming 16 systems of linear congruence equations in x and the corresponding 16 systems of linear
congruence equations in y (as we did in Problem 1) and solving them we get the following 16 solutions:
10
(x, y) = (2, 2) (2, 4) (2, 6) (2, 8) (3, 1) (3, 3) (3, 7) (3, 9)
(7, 1) (7, 3) (7, 7) (7, 9) (8, 2) (8, 4) (8, 6) (8, 8)
(b) The solutions of these equations are (see Problem 4 of § 8.3 as well as Problem 1 of 4.2.1 of V1):
3
(x, y) = (0, 1) (1, 0) (2, 0)
7
(x, y) = (0, 5) (1, 3) (2, 4) (3, 1) (4, 1) (5, 4) (6, 3)
On forming 21 systems of linear congruence equations in x and the corresponding 21 systems of linear
congruence equations in y (as we did in Problem 1) and solving them we get the following 21 solutions:
21
(x, y) = (0, 19) (1, 3) (2, 18) (3, 1) (4, 15) (5, 18) (6, 10)
(7, 12) (8, 3) (9, 4) (10, 15) (11, 15) (12, 4) (13, 3)
(14, 12) (15, 10) (16, 18) (17, 15) (18, 1) (19, 18) (20, 3)
(c) The solutions of these equations are (see Problem 4 of § 8.3 as well as Problem 1 of 4.2.1 of V1):
3
(x, y, z) = (0, 1, 0) (0, 2, 0) (1, 0, 0) (1, 1, 1) (1, 1, 2) (1, 2, 1) (1, 2, 2) (2, 0, 1) (2, 0, 2)
5
(x, y, z) = (0, 0, 2) (0, 1, 3) (0, 2, 4) (0, 3, 0) (0, 4, 1) (1, 0, 0) (1, 1, 1) (1, 2, 2) (1, 3, 3)
(1, 4, 4) (2, 0, 4) (2, 1, 0) (2, 2, 1) (2, 3, 2) (2, 4, 3) (3, 0, 4) (3, 1, 0) (3, 2, 1)
(3, 3, 2) (3, 4, 3) (4, 0, 0) (4, 1, 1) (4, 2, 2) (4, 3, 3) (4, 4, 4)
On forming 225 systems of linear congruence equations in x (and the corresponding 225 systems in y
and 225 systems in z as we did in the previous Problems) and solving them we get the following 225
solutions (in modulo 15):
9.3.2 Multiple Moduli 121

(x y, z)
0 1,3 2,9 4,6 5,12 7,9 8,0 10,12 11,3 13,0 14,6
1 0,0 1,1 1,11 2,2 2,7 3,3 4,4 4,14 5,5 5,10 6,6 7,2 7,7
8,8 8,13 9,9 10,5 10,10 11,1 11,11 12,12 13,8 13,13 14,4 14,14
2 0,4 0,14 3,2 3,7 6,5 6,10 9,8 9,13 12,1 12,11
3 1,0 2,6 4,3 5,9 7,6 8,12 10,9 11,0 13,12 14,3
4 0,0 1,1 1,11 2,2 2,7 3,3 4,4 4,14 5,5 5,10 6,6 7,2 7,7
8,8 8,13 9,9 10,5 10,10 11,1 11,11 12,12 13,8 13,13 14,4 14,14
5 0,2 0,7 3,5 3,10 6,8 6,13 9,1 9,11 12,4 12,14
6 1,6 2,12 4,9 5,0 7,12 8,3 10,0 11,6 13,3 14,9
7 0,9 1,5 1,10 2,1 2,11 3,12 4,8 4,13 5,4 5,14 6,0 7,1 7,11
8,2 8,7 9,3 10,4 10,14 11,5 11,10 12,6 13,2 13,7 14,8 14,13
8 0,4 0,14 3,2 3,7 6,5 6,10 9,8 9,13 12,1 12,11
9 1,6 2,12 4,9 5,0 7,12 8,3 10,0 11,6 13,3 14,9
10 0,12 1,8 1,13 2,4 2,14 3,0 4,1 4,11 5,2 5,7 6,3 7,4 7,14
8,5 8,10 9,6 10,2 10,7 11,8 11,13 12,9 13,5 13,10 14,1 14,11
11 0,5 0,10 3,8 3,13 6,1 6,11 9,4 9,14 12,2 12,7
12 1,0 2,6 4,3 5,9 7,6 8,12 10,9 11,0 13,12 14,3
13 0,9 1,5 1,10 2,1 2,11 3,12 4,8 4,13 5,4 5,14 6,0 7,1 7,11
8,2 8,7 9,3 10,4 10,14 11,5 11,10 12,6 13,2 13,7 14,8 14,13
14 0,5 0,10 3,8 3,13 6,1 6,11 9,4 9,14 12,2 12,7
3. Solve the following systems of exponential congruence equations (where x, y, z ∈ N0 ):
5 7
(a) 3x + 4y = 2 3x + 5y = 1.
5 11
(b) 3x + 4y = 2 5x + 7y = 10.
7 11
(c) 2x + 3y + 5z = 4 3x + 4y + 7z = 5.
Solution:
(a) The solutions of these equations are (see Problem 5 of § 8.3):
4 2
(x =, y =) (0, 0) (1, 1)
6 6
(x =, y =) (1, 1) (2, 3) (3, 4) (4, 2) (5, 5)
Now, we form the following 10 systems of linear congruence equations in x and the corresponding 10
systems of linear congruence equations in y and solve them (using for instance the Chinese remainder
theorem) where the solutions (if exist) are shown in the third and sixth rows (noting that blank means
there is no solution):
4
x= 0 0 0 0 0 1 1 1 1 1
6
x= 1 2 3 4 5 1 2 3 4 5
12
x= 8 4 1 9 5
2
y= 0 0 0 0 0 1 1 1 1 1
6
y= 1 3 4 2 5 1 3 4 2 5
6
y= 4 2 1 3 5
So, the solutions are (noting that only some combinations produce solutions for both x and y):
12 6
(x =, y =) (1, 1) (4, 2) (5, 5)
9.3.2 Multiple Moduli 122

(b) The solutions of these equations are (see Problem 5 of § 8.3):


4 2
(x =, y =) (0, 0) (1, 1)
5 10
(x =, y =) (0, 8) (1, 2) (2, 1) (3, 7) (4, 0)
Now, we form the following 10 systems of linear congruence equations in x and the corresponding 10
systems of linear congruence equations in y and solve them where the solutions (if exist) are shown in
the third and sixth rows (noting that blank means there is no solution):
4
x= 0 0 0 0 0 1 1 1 1 1
5
x= 0 1 2 3 4 0 1 2 3 4
20
x= 0 16 12 8 4 5 1 17 13 9
2
y= 0 0 0 0 0 1 1 1 1 1
10
y= 8 2 1 7 0 8 2 1 7 0
10
y= 8 2 0 1 7
So, the solutions are (noting that only some combinations produce solutions for both x and y):
20 10
(x =, y =) (0, 8) (4, 0) (13, 7) (16, 2) (17, 1)
(c) The solutions of these equations are given in Problem 5 of § 8.3. We can form 368 combinations and
search for solutions (as we did in the previous parts). However, because of limitation of space we will
form and inspect only 12 of these combinations (noting that blank means there is no solution), that is:
3
x= 0 0 0 0 1 1 1 1 2 2 2 2
5
x= 0 0 4 1 1 0 2 3 3 4 1 3
15
x= 0 0 9 6 1 10 7 13 8 14 11 8
6
y= 0 0 4 5 1 3 4 5 0 3 4 5
5
y= 0 2 4 4 1 2 0 1 4 2 0 2
30
y= 0 12 4 29 1 27 10 11 24 27 10 17
6
z= 4 4 3 1 3 5 1 2 3 0 5 4
10
z= 4 5 8 5 8 5 7 1 9 1 0 7
30
z= 4 25 5 7 9
So, the solutions among these 12 combinations are:
15 30 30
(x =, y =, z =) (0, 0, 4) (6, 29, 25) (10, 27, 5) (7, 10, 7) (8, 24, 9)
4. Solve the following system of mixed polynomial-exponential congruence equations (where x, y ∈ N0 ):
7 11
x3 + y = 0 3x + 4y = 2.
Solution: The solutions of these equations are (see § 8.3):
7
(x, y) = (0, 0) (1, 6) (2, 6) (3, 1) (4, 6) (5, 1) (6, 1)
5
(x, y) = (0, 0) (2, 1) (4, 3)
Now, we form the following 21 systems of linear congruence equations in x and the corresponding 21
systems of linear congruence equations in y and solve them where the solutions are shown in the third
and sixth rows:
9.3.2 Multiple Moduli 123

7
x= 0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6
5
x= 0 2 4 0 2 4 0 2 4 0 2 4 0 2 4 0 2 4 0 2 4
35
x= 0 7 14 15 22 29 30 2 9 10 17 24 25 32 4 5 12 19 20 27 34
7
y= 0 0 0 6 6 6 6 6 6 1 1 1 6 6 6 1 1 1 1 1 1
5
y= 0 1 3 0 1 3 0 1 3 0 1 3 0 1 3 0 1 3 0 1 3
35
y= 0 21 28 20 6 13 20 6 13 15 1 8 20 6 13 15 1 8 15 1 8
35
So, these are the solutions of the given system, i.e. (x, y) = (0, 0), (7, 21), . . . , (34, 8). Also see part (b)
of Problem 3 of § 18.3.
5. Comment on the contents and results of the present subsection.
Solution: We can claim that our investigation in the present subsection is essentially a generalization
(or extension) to the Chinese remainder theorem from univariate to multivariate systems of congruence
equations. Now, if we look back to Problem 3 of § 9.2.2 we can say: so far we essentially made three
main generalizations (or extensions) to the Chinese remainder theorem:
• The extension of lifting the restriction of linearity.[79]
• The extension of lifting the restriction of coprimality of moduli.
• The extension of lifting the restriction of univariability.
So in brief, we can now solve (with the help of the humble Chinese remainder theorem and similar
methods) non-linear systems or/and with non-coprime moduli (subject to the conditions given earlier)
or/and with multiple variables.

[79] In
fact, this extension is not limited to what we did in Problem 1 of § 9.2.2 (and its alike), but it should include what
we did in the present subsection with regard to solving non-linear systems of various types.
Chapter 10
Common Functions
1. Find all n ∈ N such that σ(n) = 960 and τ (n) = 4.
Solution: Let the second and third divisors of n be a and b (respectively). Hence, n = ab and we have
959 − a
1 + a + b + ab = 960 → b=
1+a

Now, if we note that 1 < a < 960 ≃ 30.98 and a and b must be primes (noting that 1+p+p2 +p3 = 960
has no solution) then on trying the primes a = 2, 3, 5, . . . , 29 accepting only the corresponding primes
of b we obtain only 4 legitimate values of b (i.e. b = 239, 79, 47, 31 corresponding to a = 3, 11, 19, 29).
The corresponding values of n are: 717, 869, 893, 899. So, these 4 values represent all n ∈ N such that
σ(n) = 960 and τ (n) = 4.
2. Solve the following “Diophantine” equations (where x, y, z ∈ N):
(a) φ(2x 13y 19z ) = 216. (b) φ(2x 3y 5z 7w ) = 4032.
Solution:
(a) We have (see Eq. 44 in V1):
   
1 1 1 108
216 = φ(2x 13y 19z ) = 2x 13y 19z 1 − 1− 1− = 2x 13y 19z
2 13 19 247

Hence:
108
2x 13y 19z 247 = 216 → 2x 13y 19z = 247 1 1
108 × 216 = 494 = 2 × 13 × 19
1

So, the solution is (x, y, z) = (1, 1, 1), i.e. φ(494) = 216.


(b) We have (see Eq. 44 in V1):
    
x y z w x y z w 1 1 1 1 8
4032 = φ(2 3 5 7 ) = 2 3 5 7 1− 1− 1− 1− = 2x 3y 5z 7w
2 3 5 7 35

Hence:
8
2x 3y 5z 7w 35 = 4032 → 2x 3y 5z 7w = 35 3 2 1
8 × 4032 = 17640 = 2 × 3 × 5 × 7
2

So, the solution is (x, y, z, w) = (3, 2, 1, 2), i.e. φ(17640) = 4032.


3. Find a formula for φ (nm ) in terms of n, m and φ(n) where m, n ∈ N.
Solution: From Eq. 44 in V1 (with n replaced by nm ) we have:
k   " k  #
Y 1 Y 1
m m m−1
φ (n ) = n 1− =n n 1− = nm−1 φ(n)
i=1
p i i=1
p i

4. Show that φ(m) φ(n) = φ(g) φ(l) where m, n ∈ N, g = gcd(m, n) and l = lcm(m, n).
Solution: This can be obtained by comparing Eq. 46 in V1 to Eq. 47 in V1.
5. Find the number of integers between 1 and 1000 (inclusive) which are divisible neither by 2 nor by 5?
Solution: We note that 1000 = 103 = (2 × 5)3 = 23 × 53 . So, if a number between 1 and 1000 is not
divisible by 2 and 5 then it must be coprime to 1000. This means that we want to find the number of
integers between 1 and 1000 which are coprime to 1000. In fact, this is the same as φ(1000) since by
definition φ(n) is the number of positive integers which are less than or equal to n and are relatively
prime to n. Thus, the number of integers between 1 and 1000 which are divisible neither by 2 nor by 5
is φ(1000) = 400.

124
10 COMMON FUNCTIONS 125

Note: a different approach (for solving this problem and its alike) is to argue as follows: we have
500 integers (between 1 and 1000) which are divisible by 2, and 200 integers which are divisible by 5
and hence we have 500 + 200 = 700 integers which are divisible by 2 or/and 5. However, we have 100
integers (i.e. the multiples of 10) which are divisible by both 2 and 5 and hence they are counted twice.
So, (by the rules of cardinality of sets) we have 700 − 100 = 600 integers which are divisible by 2 or 5.
Therefore, we must have 1000 − 600 = 400 integers which are divisible neither by 2 nor by 5 (noting
that “integers divisible neither by 2 nor by 5” is the complement
 of “integers divisible
 by 2 or 5”).
6. A natural number n is called abundant if σ(n) > 2n or equivalently s(n) > n . Show the following:
(a) n is abundant when n = 2k−1 (2k − 1) where (2k − 1) is composite and k ∈ N.
(b) There are infinitely many abundant numbers.
(c) There are infinitely many even abundant numbers.
(d) Natural multiples of abundant numbers are also abundant.
(e) Natural multiples (> 1) of perfect numbers are abundant.
Solution:
(a) 2k−1 is a natural power of 2 (noting that 2k − 1 is composite) and (2k − 1) is odd and hence they
are coprime (since they have no common factor). Hence:
 
σ(n) = σ 2k−1 (2k − 1) = σ(2k−1 ) σ(2k − 1) = (2k − 1) σ(2k − 1) (37)

where we used the multiplicativity of the divisor function in step 2 and used Eq. 34 of V1 in step 3.
Now, since (2k − 1) is composite then it must have at least three positive divisors, i.e. 1 and itself as
well as another positive divisor. Accordingly, σ(2k − 1) > 2k and hence from Eq. 37 we get:
 
σ(n) = (2k − 1) σ(2k − 1) > (2k − 1) 2k = 2 2k−1 (2k − 1) = 2n

(b) This is implied by part (c).


(c) The proof of part (a) should be sufficient noting that we have infinitely many numbers n = 2k−1 (2k −
1) where (2k − 1) is composite, e.g. when k is even greater than 2 (i.e. k = 2κ where κ > 1) since
2k − 1 = (2κ − 1)(2κ + 1). However, let us prove it in a different way. So, let n = 2k p where N ∋ k > 1
and p is an odd prime. It is obvious that 2k and p are coprime and hence:

σ(n) = σ(2k ) σ(p) = (2k+1 − 1)(p + 1) = 2k+1 (p + 1) − (p + 1) = 2k+1 p + 2k+1 − (p + 1)


2(2k p) + 2k+1 − (p + 1) = 2n + 2k+1 − (p + 1)
=
 
Now, for any p we have some k such that 2k+1 − (p + 1) > 0 and hence σ(n)  > 2n. This means
k k+1
that we have infinitely many even numbers n = 2 p such that 2 − (p + 1) > 0 and hence we have
infinitely many even abundant numbers. This proof also shows that the smallest even (and actually the
smallest unconditionally) abundant number is 12 (which is obvious by inspecting the divisor function
of the small natural numbers).
(d) Let n be an abundant number and kn is its natural multiple (i.e. k ∈ N). Hence, we have:
X
σ(kn) ≥ kd
d|n

This is because[80] the set S representing the divisors of kn are the divisors of k and the divisors of n
as well as the (product) combinations of these divisors, while the set s representing kd (where d is a
divisor
Pof n) is just a subset (whether proper or improper) of S, and hence σ(kn) cannot be smaller
than d|n kd. Accordingly:
   
X X
σ(kn) ≥  kd = k d = k σ(n) > k 2n = 2(kn)
d|n d|n

[80] Although this argument is not rigorous, it should be convincing.


10 COMMON FUNCTIONS 126

i.e. kn (which is the natural multiple of n) is abundant (like n itself).


(e) Let n be a perfect number and kn is its natural multiple > 1 (i.e. N ∋ k > 1). Hence, we have:
   
X X
σ(kn) >  kd = k d = k σ(n) = k 2n = 2(kn)
d|n d|n

where the justification of > is similar to what is given in part (d) noting that in this case k > 1.
7. Show that n is prime iff φ(n) = n − 1.
Solution: If φ(n) = n − 1 then all positive integers < n are coprime to n and hence n must be prime
(because this means that the only divisor of n among the positive integers which are less than n is 1).
If n is prime then all positive integers < n are coprime to n (since none of these integers, except 1, can
divide n) and hence φ(n) = n − 1 (as required by the definition of φ).
8. Show that n is composite iff φ(n) < (n − 1).
Solution: If we note that for all n > 1 we have φ(n) ≤ (n − 1) (see point 7 in the preamble of § 2.6.4
of V1), then the proposition of the present Problem is essentially the contrapositive of the proposition
of Problem 7.
9. Impose a lower and upper bound on φ(n) where n ∈ N.
Solution: The lower bound is obviously 1 while the upper bound is n − 1 (see Problems 7 and 8), i.e.
1 ≤ φ(n) ≤ (n − 1).
10. Find all n ∈ N such that (noting that 1 = d1 < d2 < . . . < dτ = n):
(a) n has τ = 9 (positive) divisors with d5 − d3 = 22 and d8 − d5 = 312.
(b) n has τ = 24 (positive) divisors with d2 + d3 + d4 + d5 = 15 and d20 + d21 + d22 + d23 = 1080.
(c) n has τ = 3 (positive) divisors.
(d) n has τ = 5 (positive) divisors and s(n) = n.
(e) n has τ = 10 (positive) divisors and σ(n) < 200.
Solution:
(a) n must be a perfect square and hence n = d25 (see Problem 18 of § 1.9 of V1 and Problem 3 of §
2.6.3 of V1). Now, we have two possibilities:
• If n is even then d2 must be 2 and hence d3 must be either 3 or 4 (noting that 4 must be a divisor since
n is an even perfect square and hence it must have a factor of 22 ). However, d3 = 3 is not a possibility
because in this case d5 = 25 and d8 = 337 and hence n = d25 = 625 which is not divisible by 337. So,
we must have d3 = 4 and hence d5 = 26 and d8 = 338 which is consistent with n = d25 = 262 = 676
(noting that the divisors of 676 are 1, 2, 4, 13, 26, 52, 169, 338, 676). This means that n = 676 is a
solution (and indeed the only possible solution if n is even because d3 is fixed).
• If n is odd then d2 must be an odd prime. This is because 2 (and its multiples) is not a possibility for
d2 since n is odd; moreover d22 must also be a divisor since n is a perfect square. Now, if we note that
d25 = d2 d8 then we must conclude that d2 divides d5 and hence d2 must also divide d8 . So, we have:

d8 − d5 = 312 → d2 (δ8 − δ5 ) = 312 (d8 = d2 δ8 and d5 = d2 δ5 )

This means that d2 divides 312. Now, the only odd prime divisors of 312 are 3 and 13. So:
If d2 = 3 then d22 = 9 must also be a divisor of n. Now, since d22 = 9 is a divisor then d3 can only be 5
or 7 or 9. However, none of these possibilities produce consistent results.[81]
If d2 = 13 then d22 = 169 must also be a divisor of n since n is a perfect square. Now, since d22 = 169 is
a divisor then d3 can only be one of the primes between 17 and 167 (inclusive) or 169. However, none
of these possibilities produce consistent results.[82]
So, we conclude that the only solution to this problem is n = 676.
[81] d 2
3 = 5, 7, 9 lead (noting that d5 − d3 = 22 and n = d5 ) to n = 729, 841, 961. Now, the number of divisors of 729, 841, 961
is 7, 3, 3 and hence they are not acceptable.
[82] If we follow a similar procedure to the one outlined in the previous footnote then we will find that all these possibilities

of n (except n = 1521, 4225 corresponding to d3 = 17, 43 and d5 = 39, 65) are not divisible by 169. Regarding 1521, its
d2 is 3. Regarding 4225, its d2 is 5.
10 COMMON FUNCTIONS 127

(b) From the relation d2 + d3 + d4 + d5 = 15 (noting that 1 < d2 < d3 < d4 < d5 ) we conclude that
d2 = 2, d3 = 3 and d4 = 4 (because otherwise d2 + d3 + d4 + d5 > 15), and hence d5 must be 6. We
must also have:
n = d2 d23 = d3 d22 = d4 d21 = d5 d20 i.e. n = 2d23 = 3d22 = 4d21 = 6d20
Now, if we substitute from these relations into the relation d20 + d21 + d22 + d23 = 1080 we get:
n n n n
+ + + = 1080 → n = 864
6 4 3 2
So, n = 864 is the required (and the only) solution to this problem.
(c) This applies to all squares of primes (e.g. 4, 9, 25) since their divisors are only 1, p and p2 (where
p ∈ P; see part e of Problem 13 of § 2).
(d) τ = 5 means n is a perfect square (see Problem 18 of § 1.9 of V1 and Problem 3 of § 2.6.3 of
V1), while s(n) = n means n is a perfect number (see § 2.8 of V1). These conditions are incompatible
because no perfect number is a perfect square (see Problem 7 of § 2.8 of V1). Hence, there is no such
n.
(e) σ(n) < 200 means n < 200. On inspecting the natural numbers which are less than 200 (using
for instance tables of divisors) we find that only 48 and 80 satisfy the given conditions (noting that
although 112, 162 and 176 satisfy τ = 10 they do not satisfy σ < 200).
11. Justify why φ(n) 6= 391, 454 for any n ∈ N.
Solution: φ(n) 6= 391 because the totient function is even for all integers greater than 2.
Regarding φ(n) 6= 454, we have three (comprehensive) cases:
• n is prime and φ(n) = 454. This is impossible because 455 is not prime (see Problem 7).
• n is a natural power (> 1) of prime and φ(n) = 454. This is also impossible because there is no p ∈ P
and a ∈ N that satisfy 454 = pa − pa−1 (see Eq. 42 in V1).
• n is composite (but not a natural power of prime) and φ(n) = 454. This is also impossible because
the prime factorization of 454 is 2 × 227, and this means that 227 = (pa − pa−1 ) for some p ∈ P and
a ∈ N (see Eq. 43 in V1). However, there is no such p and a that satisfy this equation because 227 is
odd while (pa − pa−1 ) is even (noting that p = 2 and a = 1 is not a possibility).
So, in each one of the three comprehensive cases we have φ(n) 6= 454 and hence φ(n) 6= 454 for any
n ∈ N.
12. Find all n ∈ N such that φ(n) divides (n − 1).
Solution: We have three cases:
• n = 1 and hence φ(n) = 1 which divides n − 1 = 0.
• n is prime and hence φ(n) = n − 1 which divides n − 1.
• n is composite. This is an open problem known as Lehmer’s totient problem (and hence it deserves
the attention of young mathematicians). No composite n is known such that φ(n) divides (n − 1).
So in brief, φ(n) divides (n − 1) for n = 1 and for all n ∈ P; moreover it is believed (according to
Lehmer’s totient conjecture) that there is no composite n with this property.
13. Find all n ∈ N such that (noting that m ∈ N):
(a) φ(2n) = φ(n). (b) φ(2n) = 2φ(n). (c) φ(2m n) = 2m−1 φ(n). (d) φ(2m n) = 2m φ(n).
Solution:
(a) This applies to all odd n because if n is odd then 2 and n are coprime and hence:
φ(2n) = φ(2) φ(n) = 1 × φ(n) = φ(n)
(b) This applies to all even n because if n is even then n = 2k ν (where k ∈ N and ν is odd) and hence:
φ(2n) = φ(2k+1 ν) = φ(2k+1 ) φ(ν) = (2k+1 − 2k ) φ(ν) = 2 (2k − 2k−1 ) φ(ν)
= 2 φ(2k ) φ(ν) = 2 φ(2k ν) = 2 φ(n)
(c) This applies to all odd n because if n is odd then 2m and n are coprime and hence:
φ(2m n) = φ(2m )φ(n) = (2m − 2m−1 ) φ(n) = 2m−1 (2 − 1) φ(n) = 2m−1 φ(n)
10 COMMON FUNCTIONS 128

It is obvious that part (a) is an instance of this identity (corresponding to m = 1).


(d) This applies to all even n because if n is even then n = 2k ν (where k ∈ N and ν is odd) and hence:
φ(2m n) = φ(2m+k ν) = φ(2m+k ) φ(ν) = (2m+k − 2m+k−1 ) φ(ν) = 2m (2k − 2k−1 ) φ(ν)
= 2m φ(2k ) φ(ν) = 2m φ(2k ν) = 2m φ(n)
It is obvious that part (b) is an instance of this identity (corresponding to m = 1).
14. Calculate µ(45362721998 ), µ(4662!), µ(c 13), and µ(6280786).
Solution: 453627 21998 c
, 4662!, and 13 are obviously not square free and hence their Mobius function is 0.
Regarding µ(6280786) we have: 6280786 = 2 × 17 × 31 × 59 × 101 and hence µ(6280786) = (−1)5 = −1.
15. Define the “summatory function” with some examples.
Solution: The summatory function F (n) of an arithmetic function f (d) is defined as:
X
F (n) = f (d)
d≤n

[83]
where d is a positive divisor of n. For example, the divisor function σ(n) is the summatory function
of f (d) = d because (see Eq. 33 in V1):
X X
σ(n) = f (d) = d
d≤n d|n

Similarly, the tau function τ (n) is the summatory function of f (d) = 1 because (see Eq. 37 in V1):
X X
τ (n) = f (d) = 1
d≤n d|n

16. Show that if f is a multiplicative function, then its summatory function F is also multiplicative.
Solution: Let n1 , n2 ∈ N be coprime and hence (according to the definition of summatory function
which was given in Problem 15) we have:
X
F (n1 n2 ) = f (d) (38)
d|(n1 n2 )

Now, since n1 and n2 are coprime then each divisor (i.e. d) of their product can be written as d = d1 d2
where d1 and d2 are coprime. Accordingly, Eq. 38 can be written as:
X X X
F (n1 n2 ) = f (d) = f (d1 d2 ) = f (d1 ) f (d2 )
d|(n1 n2 ) d1 |n1 , d2 |n2 d1 |n1 , d2 |n2
  
X X
=  f (d1 )  f (d2 ) = F (n1 ) F (n2 )
d1 |n1 d2 |n2

Note: the result of this Problem may be used to prove that σ(n) and τ (n) are multiplicative because:
• σ(n) is the summatory function of f (d) = d (i.e. the identity function) and hence:
f (mn) = mn = f (m) f (n)
i.e. f is a completely multiplicative function[84] (and hence it is multiplicative).
• τ (n) is the summatory function of f (d) = 1 (i.e. the unity function) and hence:
f (mn) = 1 = 1 × 1 = f (m) f (n)
i.e. f is a completely multiplicative function (and hence it is multiplicative).
[83] This definition (which should be “sufficient and necessary” to us for the time being) is rather limited. Therefore, the
readers should be careful about the terminology used in the literature in this regard where the domain of f (and hence
the “summatory function” F ) could vary. These issues should be elaborated and clarified further in the future.
[84] A “completely multiplicative function” f means: f (mn) = f (m)f (n) for all m, n ∈ N (i.e. regardless of m, n being

coprime or not).
10 COMMON FUNCTIONS 129

17. Show that the summatory function of the totient function is n, i.e.
X
φ(d) = n
d|n

Solution: This was shown in Problem 1 of § 2.6.4 of V1.


18. Show that the summatory function of the Mobius function is 0, i.e.
X
µ(d) = 0 (n > 1)
d|n

Solution: This was shown in Problem 3 of § 2.6.5 of V1.


Chapter 11
Interesting Theorems
Despite the importance of the subject of this chapter (i.e. “interesting theorems”), we decided to make
it short and brief. The main reason is that most of these “interesting theorems” can be found and met
in many places and within many contexts in this book (as well as in the general literature of number
theory) since they represent some of the most common principles and foundations of elementary number
theory. In fact, the applications of these “interesting theorems” are very broad and abundant and this
makes dedicating a chapter (or section or part) of any book to them is a matter of formality and organized
structure.

11.1 Wilson’s Theorem


1. Use Wilson’s theorem to find r:
2731 1763
(a) 2727! = r. (b) 37! = r.
Solution:[85]
(a) We note that 2731 is prime. We have:
2731 2731 2731
2727! = r → 2730! = (2728)(2729)(2730) r → (2731 − 1)! = 20324063760 r →
2731 2731 2731 2731
−1 = 2725 r → r = (−1)2725∗ → r = −455 = 2276
(b) We note that 1763 = 41 × 43. Now, we have:
41 41 41 41
37! = r → 40! = (38)(39)(40) r → −1 = 59280 r → r = 7
43 43 43 43
37! = r → 42! = (38)(39)(40)(41)(42) r → −1 = 102080160 r → r = 19
41 43
So, we have the following system of linear congruence equations: r = 7 and r = 19. On solving this
1763
system (e.g. by the Chinese remainder theorem) we get r = 1524.
2. Show that (where k ∈ N):
(
 2 p −1 (when p = 4k + 1)
1 × 3 × · · · × (p − 2) =
+1 (when p = 4k − 1)

Solution: By Wilson’s theorem we have:


p
−1 = (p − 1)! = 1 × 2 × 3 × · · · × (p − 3) × (p − 2) × (p − 1)
p  
= 1 × − (p − 2) × 3 × · · · × (−3) × (p − 2) × (−1)
  
= (−1)(p−1)/2 1 × (p − 2) × 3 × · · · × (3) × (p − 2) × (1)
 2
= (−1)(p−1)/2 1 × 3 × · · · × (p − 2)
 2 p
Now, if p = 4k + 1 then (p − 1)/2 = 2k and hence we have (−1)2k 1 × 3 × · · · × (p − 2) = −1, i.e.
 2 p
1 × 3 × · · · × (p − 2) = −1. On the other hand, if p = 4k − 1 then (p − 1)/2 = 2k − 1 and hence we
 2 p  2 p
have (−1)2k−1 1 × 3 × · · · × (p − 2) = −1, i.e. 1 × 3 × · · · × (p − 2) = +1.

[85] Thecode CongLargeFactorial.cpp (see Problem 3 of § 18.1) can be used to verify the results of this Problem. We should
also note that r in these Problems represents the least non-negative residue of the given congruences.

130
11.2 Euler’s Theorem 131

3. Show that (where k ∈ N):


  2 (
p−1 p −1 (when p = 4k + 1)
! =
2 +1 (when p = 4k − 1)

Solution: In Problem 3 of § 2.9.1 of V1 we proved (by using Wilson’s theorem) that (q!)2 + (−1)q is
divisible by p ∈ P where p = 2q + 1, i.e.
p p p
(q!)2 + (−1)q = 0 → (q!)2 = −(−1)q → (q!)2 = (−1)q+1
p−1
Now, if p = 4k + 1 then q ≡ 2 is even (i.e. q = 2k) and hence:
  2
2 p−1 p
(q!) ≡ ! = (−1)q+1 = (−1)2k+1 = −1
2
p−1
while if p = 4k − 1 then q ≡ 2 is odd (i.e. q = 2k − 1) and hence:
  2
2 p−1 p
(q!) ≡ ! = (−1)q+1 = (−1)2k−1+1 = (−1)2k = +1
2

11.2 Euler’s Theorem


1. Show that for all n ∈ N we have n|φ(2n − 1).
Solution: According to Euler’s theorem we have:
n  
n
−1) 2 −1 n
2φ(2 = 1 → (2n − 1) 2φ(2 −1) − 1

Hence, from Problem 6 of § 6.7 of V1 we get n|φ(2n − 1).


2. Use Euler’s theorem to find r:
1019 5237
(a) 333061 = r. (b) 9715705 = r.
Solution:[86]
(a) We have:
1019 3 1019 1019 1019
333061 = r → 331018 337 = r → 13 337 = r → r = 967
(b) We have:
5237 5237 3 5237
9715705 = r 9715708 = 973 r
→ → 975236 = 973 r →
5237 5237 ∗ 5237
13 = 973 r → r = 973 → r = 354
3. Prove the following (where x ∈ Z and p, q ∈ P with p 6= q):
pq 2 p2
(a) x(p−1)(q−1) = 1 (x and pq are coprime). (b) xp −p = 1 (x and p2 are coprime).
Solution:
(a, b) These congruences are just instances of Euler’s theorem noting that φ(pq) = (p − 1)(q − 1) and
φ(p2 ) = p2 − p (see § 2.6.4 and § 2.9.2 of V1).

11.3 Fermat’s Little Theorem


p
1. Let x ∈ Z and p be an odd prime. Show that the congruence equation x2 + 1 = 0 has a solution iff
p = 4k + 1.
p p
Solution: We note first that x2 + 1 = 0 is equivalent to x2 = −1.
Regarding the if part, it is obvious (from Problem 3 of § 11.1) that this congruence has a solution
[86] The code CongLargeExponential.cpp (see Problem 4 of § 18.1) can be used to verify the results of this Problem.
11.4 Lagrange’s Polynomial Roots Theorem 132

 
i.e. x = p−1
2 ! when p = 4k + 1.
p
Regarding the only if part, let assume that x2 + 1 = 0 has a solution with p 6= 4k + 1 (i.e. p = 4k − 1).
p
This implies that x and p are coprime (because otherwise we will have 0 + 1 = 0). So, by Fermat’s little
theorem we have:
p p p 2k−1 p p
xp−1 = 1 → x4k−1−1 = 1 → x4k−2 = 1 → x2 =1 → (−1)2k−1 = 1
p
i.e. −1 = 1 which is nonsensical noting that p is an odd prime. So, this contradiction implies (by con-
p
traposition) that x2 + 1 = 0 has no solution when p 6= 4k + 1.
30
2. Show that the congruence x45 = x is true identically (i.e. it is satisfied by all x ∈ Z).
2 3 5
Solution: We note that 30 = 2 × 3 × 5. So, we need to show that x45 = x, x45 = x and x45 = x are
true identically.
2 2
Regarding x45 = x, this congruence is equivalent to x45 − x = 0 which is true identically because the
LHS is always even.
3
Regarding x45 = x, we use Fermat’s little theorem (repeatedly), that is:
15 3 15 5 3 2 3
x45 = x3 = x = x3 = x5 = x3 x−1 = x2 x−1 = x
Similarly:
9 5 2 5
x45 = x5 = x9 = x5 x−1 = x2 x−1 = x
2 3 5 30
So, x45 = x, x45 = x and x45 = x are true identically and hence x45 = x is true identically.
3. Use Fermat’s little theorem to find r:
401 2703
(a) 172804 = r. (b) 132455 = r.
Solution:
(a) We have:
401 7 401 401
r = 172804 = 17401 17−3 = 177 × 17−3 = 174 = 113
(b) We note that 2703 = 3 × 17 × 53. Now, we have:
3 3
r = 132455 = 12455 = 1
17 144 7 17 144 9 17 17
r = 132455 = 1317 13 = 13 × 137 = 13151 = 1317 13−2 = 139 × 13−2 = 137 = 4
53 47 −36 53 47 53
r = 132455 = 1353 13 = 13 × 13−36 = 1311 = 16
3 17 53
So, we have the following system of linear congruence equations: r = 1, r = 4 and r = 16. On solving
2703
this system (e.g. by the Chinese remainder theorem) we get r = 2401.

11.4 Lagrange’s Polynomial Roots Theorem


13
1. Show that the polynomial congruence equation x49 − 3x26 + 2 = 0 (where x ∈ Z) cannot have more
than two roots.
Solution: By Fermat’s little theorem we have:
4 2 13 13 13
x49 − 3x26 + 2 = x13 x−3 − 3 x13 + 2 = x4 x−3 − 3x2 + 2 = x − 3x2 + 2 = 10x2 + x + 2 = 0
13
So, what we actually have is a quadratic congruence equation (i.e. 10x2 + x + 2 = 0) and hence by
Lagrange’s polynomial roots theorem it has at most two roots.
17
2. Despite the fact that 17 is prime, the quadratic congruence equation 102x2 +68x+136 = 0 is identically
true, i.e. it has 17 (modular) solutions. Can you explain this “contradiction” to Lagrange’s polynomial
roots theorem which (seemingly) requires that this quadratic congruence equation should have at most
two roots.
Solution: If we inspect the coefficients (i.e. 102, 68, 136) we find that all of them are divisible by 17
and hence what we actually have is not an n degree polynomial (i.e. quadratic) congruence but a “zero
11.5 Other Theorems 133

17
polynomial” congruence (i.e. 0 = 0) which is always true regardless of the value of x.

11.5 Other Theorems


1. Show that Fermat’s last theorem is true for all N ∋ n > 2 if it is true for n = 4 and it is true for all
P ∋ n > 2 (where n is the exponent in the statement of Fermat’s last theorem; see § 2.9.5 of V1).
Solution: From the result of Problem 16 of § 4, every exponent N ∋ n > 2 can be written as n = 4k
or as n = pk (where p is an odd prime and k ∈ N). Accordingly, an + bn = cn (where a, b, c ∈ N) can be
4 4 4 p p p
written as ak + bk = ck or as ak + bk = ck . Now, ak , bk , ck ∈ N (since a, b, c, k ∈ N)
and hence if the theorem is true for n = 4 and it is true for all P ∋ n > 2 then it must be true for all
N ∋ n > 2.
2. Which of the following integers can be expressed as a sum of two (perfect) squares:
(a) 57. (b) 481. (c) 1762. (d) 11858.
Solution: We use the well-known two square theorem which states (see § 2.9.5 of V1): a natural num-
ber n can be expressed as a sum of two squares iff every prime of the form 4k + 3 occurs an even
number of times in the prime factorization of n.
(a) We have 57 = 31 × 191 . As we see, both 3 and 19 (which are of the form 4k + 3) occur an odd
number of times in the prime factorization of 57 and hence 57 cannot be expressed as a sum of two
squares.
(b) We have 481 = 13 × 37. As we see, both 13 and 37 are of the form 4k + 1 which means that “every
prime of the form 4k + 3 (if exists) occurs an even number of times”.[87] So, 481 can be expressed as a
sum of two squares, i.e. 481 = 92 + 202 = 152 + 162 .
(c) We have 1762 = 2 × 881. As in part (b), we have no prime of the form 4k + 3 in the factorization
of 1762 and hence 1762 can be expressed as a sum of two squares, i.e. 1762 = 92 + 412 .
(d) We have 11858 = 2 × 72 × 112 . As we see, both 7 and 11 (which are of the form 4k + 3) occur an
even number of times in the prime factorization of 11858 and hence 11858 can be expressed as a sum
of two squares, i.e. 11858 = 772 + 772 .
3. Show that no integer of the form n = 4k + 3 (where k ∈ Z) can be expressed as a sum of two (perfect)
squares.
Solution: We simply prove this theorem by showing that no sum of two perfect squares of integers can
be of the form 4k + 3. So, if n = 4k + 3 then
 it must be odd and hence  if it is the sum of two
 squares
then it must be the sum of an odd square say (2a + 1)2 where a ∈ Z plus an even square say (2b)2
where b ∈ Z . Therefore:

4 4 4
(2a + 1)2 + (2b)2 = 4a2 + 4a + 1 + 4b2 = 1 6= 3 = 4k + 3 = n

As we see, the sum of two squares is incongruent (mod 4) to n = 4k +3 and hence n cannot be expressed
as a sum of two squares.
4. Show that no integer of the form n = 8k + 7 (where k ∈ Z) can be expressed as a sum of three (perfect)
squares.
Solution: We simply prove this theorem by showing that no sum of three perfect squares of integers
can be of the form 8k + 7. Now, n is odd and hence it cannot be the sum of three even integers. Also,
n cannot be the sum of two odd integers plus an even integer. So, we have only two possibilities:

• All the three squares are odd say (2a + 1)2 , (2b + 1)2 and (2c + 1)2 where a, b, c ∈ Z and hence:

(2a + 1)2 + (2b + 1)2 + (2c + 1)2 = 4(a2 + a) + 4(b2 + b) + 4(c2 + c) + 3 = 8A + 8B + 8C + 3


8 8 8
= 3 6= 7 = 8k + 7 = n
[87] Infact, this “interpretation” of the two square theorem dictates an improvement to the phrasing of this theorem (to
avoid misunderstanding), that is: “a natural number n can be expressed as a sum of two perfect squares iff the prime
factorization of n contains no odd power of any prime factor of the form 4k + 3”. This means that n either contains no
prime of the form 4k + 3 or it contains only even (natural) powers of primes of the form 4k + 3.
11.5 Other Theorems 134

where step 2 is because (a2 + a), (b2 + b) and (c2 + c) are all even. 
• Two of the squares are even and the third is odd say (2a)2 , (2b)2 and (2c + 1)2 where a, b, c ∈ Z and
hence:
(2a)2 + (2b)2 + (2c + 1)2 = 4a2 + 4b2 + 4c2 + 4c + 1 = 4(a2 + b2 ) + 8C + 1
Now:
If a and b are of the same parity then (a2 + b2 ) is even (say a2 + b2 = 2D) and hence we have:

8 8 8
4(a2 + b2 ) + 8C + 1 = 4(2D) + 8C + 1 = 8D + 8C + 1 = 1 6= 7 = 8k + 7 = n

Similarly, if a and b are of opposite parity then (a2 + b2 ) is odd (say a2 + b2 = 2D + 1) and hence we
have:
8 8 8
4(a2 + b2 ) + 8C + 1 = 4(2D + 1) + 8C + 1 = 8D + 8C + 5 = 5 6= 7 = 8k + 7 = n
So, in all cases the sum of three squares is incongruent (mod 8) to n = 8k + 7 and hence n cannot be
expressed as a sum of three squares.
Chapter 12
Floors and Ceilings
j 2 k 2
1. Solve the following equation (where x ∈ Z): x +2x−1
7 = x +2x−1
7 .
Solution: The floor of a real number is equal to the number iff the number is an integer. So, the given
equation is a statement that (x2 + 2x − 1)/7 is an integer, and hence it is equivalent to the congruence
7
equation x2 + 2x − 1 = 0. Thus, the solutions of the given equation are: x = 2 + 7k and x = 3 + 7k
(where k ∈ Z).
2. Solve the following equations (where x ∈ R):
 
(a) ⌈7 ⌊x⌋ + 12x⌉ = 39. (b) 25 ⌊x⌋ − 18 ⌈x⌉ = 91. (c) x2 + 12x − 4 = 22.
Solution:
(a) Let ⌊x⌋ = X and hence we have ⌈7X + 12x⌉ = 39. This means:
38−7X
38 < 7X + 12x ≤ 39 → 38 − 7X < 12x ≤ 39 − 7X → 12 < x ≤ 39−7X
12
Also, ⌊x⌋ = X means X ≤ x < (X + 1). So, we need to solve the following system of inequalities:
38−7X 39−7X
12 <x≤ 12 and X ≤ x < (X + 1)
This system implies:
38−7X 26
12 < (X + 1) → (38 − 7X) < (12X + 12) → 26 < 19X → X> 19
39−7X 39
X≤ 12 → 12X ≤ (39 − 7X) → 19X ≤ 39 → X≤ 19
On combining these results we get 26 39
19 < X ≤ 19 , i.e. X = 2 (noting that X is an integer). Now, on
38−7X
substituting this into the equation 12 < x ≤ 39−7X 12
24
we get 12 25
< x ≤ 12 25
(i.e. 2 < x ≤ 12 ).
(b) We have two cases to consider:
• x is an integer and hence ⌊x⌋ = ⌈x⌉ = x, that is:
25 ⌊x⌋ − 18 ⌈x⌉ = 91 → 25x − 18x = 91 → 7x = 91 → x = 13
• x is not an integer. Now, if ⌊x⌋ = xf then ⌈x⌉ = xf + 1 and hence:
25 ⌊x⌋ − 18 ⌈x⌉ = 91 → 25xf − 18(xf + 1) = 91 → 7xf = 109 → xf = 109
7 ≃ 15.57
which is nonsensical because xf is integer.
So, the only solution
 to 25 ⌊x⌋ − 18 ⌈x⌉ = 91 is x = 13.
(c) x2 + 12x − 4 = 22 means 21 < x2 + 12x − 4 ≤ 22. So, we have two inequalities to consider:
• 21 < x2 + 12x − 4 and hence:
25 < x2 + 12x → 61 < x2 + 12x + 36 → 61 < (x + 6)2
√ √ √ √
So, either − 61 > (x + 6) or 61 < (x + 6), i.e. x < −6 − 61 or x > −6 + 61.
• x2 + 12x − 4 ≤ 22 and hence:
x2 + 12x ≤ 26 → x2 + 12x + 36 ≤ 62 → (x + 6)2 ≤ 62
√ √ √ √
So, − 62 ≤ (x + 6) ≤ 62, i.e. −6 − 62 ≤ x ≤ −6 + 62.
So, the solution is the intersection of the inequalities:
√ √ √ √
x < −6 − 61 x > −6 + 61 −6 − 62 ≤ x ≤ −6 + 62
which is: √ √ √ √
−6 − 62 ≤ x < −6 − 61 and −6 + 61 < x ≤ −6 + 62
l 3 2
m
3. Solve the following equation x +2x x−35x+1 = 0 (where Z ∋ x 6= 0).

135
12 FLOORS AND CEILINGS 136

Solution: We have:
 3     
x + 2x2 − 35x + 1 1 1
= x2 + 2x − 35 + = x2 + 2x − 35 + =0
x x x

Now, we have three cases


  to consider:
• x < −1 and hence x1 = 0. So, we have x2 + 2x − 35 = 0 whose only solution (noting that x < −1)
is x = −7.  
• x = −1 and hence x1 = −1. So, we have x2 + 2x − 36 = 0 which has no solution.
• x ≥ 1 and hence x1 = 1. So, we have x2 + 2x − 34 = 0 which has no solution.
So, the only solution
   to the given equation is x = −7.
4. Show that x2 + x2 = x for all x ∈ Z.    x x x x
x x x
Solution: If x is even then x we have 2 = 2 = 2 and hence 2 +  2 =2 + 2 = x.
If x is odd then we have 2 = x2 − 21 and x2 = x2 + 21 and hence x2 + x2 = x2 − 21 + x2 + 21 = x.
 2  
5. Show that the expression x+1 2 + 3 x2 + 2 is always even (where x ∈ Z).
Solution: This is because:
• If x is even (say x = 2k where k ∈ Z) then we have:
 2 lx m  2   2
x+1 2k + 1 2k 1
+3 +2 = +3 +2 = k+ + 3 ⌈k + 2⌉ = k 2 + 3k + 6
2 2 2 2 2

which is even.
• If x is odd (say x = 2k + 1) then we have:
 2 lx m  2    
x+1 2k + 2 2k + 1 2 1
+3 +2 = +3 + 2 = ⌊k + 1⌋ + 3 k + + 2
2 2 2 2 2
= (k + 1)2 + 3(k + 3) = k 2 + 2k + 1 + 3k + 9 = k 2 + 5k + 10

which is even.
So, the given expression is even in both cases and  hence it is always even.
6. Solve the following equation (where x ∈ N0 ): x2 + 4 x3 = 329.
Solution: We have six cases to consider (where k ∈ N0 ):
• x = 6k and hence we have 3k + 4(2k) = 329 which has no solution.
• x = 6k + 1 and hence we have 3k + 4(2k + 1) = 329 which has no solution.
• x = 6k + 2 and hence we have 3k + 1 + 4(2k + 1) = 329 which has no solution.
• x = 6k + 3 and hence we have 3k + 1 + 4(2k + 1) = 329 which has no solution.
• x = 6k + 4 and hence we have 3k + 2 + 4(2k + 2) = 329 whose solution is k = 29 and hence x = 178.
• x = 6k + 5 and hence we have 3k + 2 + 4(2k + 2) = 329 whose solution is k = 29 and hence x = 179.
So, the only solutions to the given equation are: x = 178 and x = 179.
7. Solve the following series equations (where x ∈ N):
Px   Px  
(a) k=1 25 k = 87. (b) k=1 25 k = 109.
Solution: P
25    
(a) We have k=1 25 k = 87. Now, for all k > 25 we have 25 k = 0, and hence the sum remains 87 for
all x > 25. So,Pthe solution of the given equation is x = 25, 26, 27,
.25. ..
25  
(b) We have k=1 25 k = 109. Now, for all k > 25 we have k = 1, and hence the sum keeps
increasing. So, the solution of the given equation j 2k is x = 25.
8. Solve the following inequality (where x ∈ Z): 3x 37 < 5x.
j 2k 2
j 2k
Solution: If 3x 37 < 5x then we must have 3x 2
37 < 5x, i.e. 3x −185x < 0. This is because if
3x
37 < 5x
j 2k
3x 3x2
then 5x is greater than 37 by at least 1 (noting that the two sides are integers) while 37 cannot
j 2k
be greater than 3x 37 by 1 (i.e. if it is greater then it is greater by less than 1). The solution of this
12 FLOORS AND CEILINGS 137

j 2k
inequality (i.e. 3x2 − 185x < 0) is 1 ≤ x ≤ 61. So, the solutions of the inequality 3x 37 < 5x are:
x = 1, 2, . . . , 61. It is worth noting that this Problem can be easily solved computationally (e.g. by a
computer code or a spreadsheet).
9. Let us define f (x, y) as follows (where x, y ∈ N):
(  xy  
1 12 =1
f (x, y) =  xy  
0 12 6= 1

Find the following sum:


∞ X
X ∞
f (x, y)
x=1 y=1

Solution: If x ≥ 24 or y ≥ 24 then we have (where r ∈ N0 and m ∈ N):


xy (24 + r)m 24m + rm rm
= = = 2m +
12 12 12 12
Hence: j xy k j rm k  j rm k
= 2m + = 2m + >1
12 12 12
P23 P23
So, we need only to consider the sum x=1 y=1 f (x, y).[88] Accordingly, we have only 47 pairs of
(x, y) such that f (x, y) = 1, i.e.
(1,12) (1,13) (1,14) (1,15) (1,16) (1,17) (1,18) (1,19) (1,20) (1,21) (1,22) (1,23)
(2,6) (2,7) (2,8) (2,9) (2,10) (2,11) (3,4) (3,5) (3,6) (3,7) (4,3) (4,4)
(4,5) (5,3) (5,4) (6,2) (6,3) (7,2) (7,3) (8,2) (9,2) (10,2) (11,2)
(12,1) (13,1) (14,1) (15,1) (16,1) (17,1) (18,1) (19,1) (20,1) (21,1) (22,1) (23,1)
Hence, the given sum is 47.
10. Solve the following equations (where m ∈ N0 ):
  m    4m 
(a) n = m 2 + 3 . (b) n = 2m3 + 5 .
Solution:
(a) Let m = 6k + r (where k, r ∈ N0 and 0 ≤ r ≤ 5). Accordingly:
    jrk jrk jrk jrk
6k + r 6k + r
n= + = 3k + + 2k + = 5k + +
2 3 2 3 2 3
Now:
r = 0 → n = 5k r = 1 → n = 5k r = 2 → n = 5k + 1
r = 3 → n = 5k + 2 r = 4 → n = 5k + 3 r = 5 → n = 5k + 3
So, the solutions (m, n) are:
(6k, 5k) (6k + 1, 5k) (6k + 2, 5k + 1) (6k + 3, 5k + 2) (6k + 4, 5k + 3) (6k + 5, 5k + 3)
(b) Let m = 15k + r (where k, r ∈ N0 and 0 ≤ r ≤ 14). Accordingly:
           
30k + 2r 60k + 4r 2r 4r 2r 4r
n= + = 10k + + 12k + = 22k + +
3 5 3 5 3 5
Now:
r = 0 → n = 22k r = 1 → n = 22k r = 2 → n = 22k + 2 r = 3 → n = 22k + 4
r = 4 → n = 22k + 5 r = 5 → n = 22k + 7 r = 6 → n = 22k + 8 r = 7 → n = 22k + 9
r = 8 → n = 22k + 11 r = 9 → n = 22k + 13 r = 10 → n = 22k + 14 r = 11 → n = 22k + 15
r = 12 → n = 22k + 17 r = 13 → n = 22k + 18 r = 14 → n = 22k + 20
[88] In fact, because of symmetry we need to consider only half of this.
12 FLOORS AND CEILINGS 138

So, the solutions (m, n) are:


(15k, 22k) (15k + 1, 22k) (15k + 2, 22k + 2) (15k + 3, 22k + 4)
(15k + 4, 22k + 5) (15k + 5, 22k + 7) (15k + 6, 22k + 8) (15k + 7, 22k + 9)
(15k + 8, 22k + 11) (15k + 9, 22k + 13) (15k + 10, 22k + 14) (15k + 11, 22k + 15)
(15k + 12, 22k + 17) (15k + 13, 22k + 18) (15k + 14, 22k + 20)
Pm j 100 k k
11. Solve the following series equation: n = k=1 7 101 .
Solution: We have: j
k log(6/7)  k
100 k
• 7 100
101 ≃ 6 → k = log(100/101) ≃ 15.49 → 7 101 = 6 (1 ≤ k ≤ 15).
 j  k
100 k log(5/7) k
• 7 101 ≃5 → k = log(100/101) ≃ 33.82 → 7 100
101 = 5 (16 ≤ k ≤ 33).
 j  k
100 k log(4/7) k
• 7 101 ≃4 → k = log(100/101) ≃ 56.24 → 7 100
101 = 4 (34 ≤ k ≤ 56).
 j k k
100 k log(3/7)
• 7 101 ≃3 → k = log(100/101) ≃ 85.15 → 7 100
101 = 3 (57 ≤ k ≤ 85).
 j  k
100 k log(2/7) k
• 7 101 ≃2 → k = log(100/101) ≃ 125.90 → 7 100
101 = 2 (86 ≤ k ≤ 125).
 j  k
k log(1/7) k
• 7 100
101 ≃1 → k = log(100/101) ≃ 195.56 → 7 100
101 = 1 (126 ≤ k ≤ 195).
 j  k
k k
• 7 100
101 <1 → 7 100
101 = 0 (196 ≤ k).
Accordingly:
• For m = 1, 2, . . . , 15 we have n = 6m.
• For m = 16, 17, . . . , 33 we have n = 5(m − 15) + 90 = 5m + 15.
• For m = 34, 35, . . . , 56 we have n = 4(m − 33) + 180 = 4m + 48.
• For m = 57, 58, . . . , 85 we have n = 3(m − 56) + 272 = 3m + 104.
• For m = 86, 87, . . . , 125 we have n = 2(m − 85) + 359 = 2m + 189.
• For m = 126, 127, . . . , 195 we have n = (m − 125) + 439 = m + 314.
• For m ≥ 196 we have n = 509.   y
12. Solve the following equation (where x, y ∈ N0 ): x+1 2 + 3 = x.
0
Solution: If x is even then x = 2a and if x is odd then x =  + 1 (where a ∈ N ). Similarly, y = 3b
 y 2a
0 x+1
or y = 3b + 1 or y = 3b + 2 (where b ∈ N ). So, if 2 + 3 = x then we have 6 possibilities:
 2a+1   3b   2a+2   3b 
2 + 3 = 2a 2 + 3 = 2a + 1
 2a+1   3b+1   2a+2   3b+1 
2 + 3 = 2a 2 + 3 = 2a + 1
 2a+1   3b+2   2a+2   3b+2 
2 + 3 = 2a 2 + 3 = 2a + 1
Now, from the first three possibilities (left column) we get a + b = 2a (i.e. b = a), and similarly from
the second three possibilities (right column) we get: a + 1 + b = 2a + 1 (i.e. also b = a). Hence, the
solutions are:
(x, y) = (2a, 3a) (x, y) = (2a, 3a + 1) (x, y) = (2a, 3a + 2)
(x, y) = (2a + 1, 3a) (x, y) = (2a + 1, 3a + 1) (x, y) = (2a + 1, 3a + 2)
13. Investigate (with some examples) the solutions of the following equation (where x, y ∈ R):
j k l m
xy+2 xy+2
y−1 = y−1
j k l m
xy+2 xy+2 xy+2
Solution: y−1 = y−1 iff y−1 is an integer. This means that we are actually dealing with the
following equation: xy+2
y−1 = z where x, y ∈ R and z ∈ Z. So, any (x, y) pair that makes the LHS of the
last equation an integer is a solution to the given equation. The following are some examples of these
solutions: (x, y) = (1, 2), (−1, 2), (3, 0), (0.5, 2), (1, −0.5),
  (7.2,
 1.25).
14. Solve the following equation (where x ∈ N0 ): y = x3 + x3 .
Solution: We have three cases to consider (where k ∈ N0 ):
12 FLOORS AND CEILINGS 139

• x = 3k and hence we have: y = k + k = 2k.


• x = 3k + 1 and hence we have: y = k + k + 1 = 2k + 1.
• x = 3k + 2 and hence we have: y = k + k + 1 = 2k + 1.
So, the solutions are: (x, y) = (3k,2k), (3k + 1, 2k + 1) and (3k + 2, 2k + 1).

15. Solve the following equation: x − y = 0 where x, y ∈ R.
Solution:
√  y (and hence x) must be a non-negative real number. Now, if we write the equation as
x= y then it is obvious that x is a non-negative integer, i.e. x = 0, 1, 2, . . .. So, if k ∈ N0 and s ∈ R
then the solutions of the given equation are: (x, y) = (k, s)where k 2 ≤ s < (k + 1)2 .
 xy
0
16. Solve the following inequality (where x, y ∈ N ): 2x < 5 < 3y.
Solution: For x = 0, the inequality is untrue. For x > 0 we have:
j xy k j xy k
2x < and < 3y
5 5
The solutions (x, y) of these simultaneous inequalities are:
(1, ≥ 15) (2, ≥ 13) (3, ≥ 12) (4, ≥ 12) (5, ≥ 11) (6, ≥ 11) (7, ≥ 11)
(8, ≥ 11) (9, ≥ 11) (10, ≥ 11) (11, ≥ 11) (12, ≥ 11) (13, ≥ 11) (14, ≥ 11)
Chapter 13
GCD and LCM
1. Let m = 8s + 1 and n = 35t + 1 (where s, t ∈ N). State a sufficient condition for gcd(m, n) to be greater
than 1.
Solution: A sufficient condition is that s and t are odd. This is because either m = 9 (i.e. when s = 1)
or it has a factor of 9 (i.e. when O ∋ s > 1 according to Eq. 11 in V1). Similarly, either n = 36 (i.e.
when t = 1) or it has a factor of 36 (i.e. when O ∋ t > 1 according to Eq. 11 in V1). So, m and n have
always a common divisor greater than 1 if s and t are odd.
2. Show that gcd(k m − 1, k n − 1) = k gcd(m,n) − 1 (where m, n, k ∈ N and k > 1).
Solution: Let g = gcd(m, n) and G = gcd(k m − 1, k n − 1). Now:
• Since g = gcd(m, n) then g|m and g|n and hence (by the result of Problem 6 of § 6.7 of V1) we have
(k g − 1)|(k m − 1) and (k g − 1)|(k n − 1) which means (k g − 1)|G (since G is the greatest common divisor
of k m − 1 and k n − 1 and hence G must be divisible by any of their common divisors; see Problem 10
of § 2.4 of V1).
G
• Since G = gcd(k m − 1, k n − 1) then G|(k m − 1) and G|(k n − 1) and this is equivalent to (k m − 1) = 0
G G G
and (k n − 1) = 0, i.e. k m = 1 and k n = 1. Now (noting that g = sm + tn by Bezout theorem):
s t G
k g = k sm+tn = (k m ) (k n ) = 1s 1t = 1

i.e. G|(k g − 1).


g g
So in brief, we proved in thesegtwo points that (k − 1)|G gand G|(k − 1) and hence by rule 9 of § 1.9 of
V1 noting that G ∈ N and (k − 1) ∈ N we have G = (k − 1), i.e. gcd(k m − 1, k n − 1) = k gcd(m,n) − 1
(as required).
3. Find the greatest common divisor (gcd) of the following polynomials (where n ∈ Z):
(a) P1 (n) = n4 − 10n3 + 22n2 − 10n + 21 P2 (n) = n3 + 5n2 − 73n − 77.
(b) P1 (n) = n2 − 3n − 10 P2 (n) = 2n3 − n + 6 P3 (n) = n2 − 22n + 85.
Solution:
(a) If we factorize these polynomials we get:

P1 (n) = (n − 7)(n2 + 1)(n − 3) P2 (n) = (n − 7)(n + 1)(n + 11)

So, the gcd of these polynomials is (n − 7).


(b) P2 (n) does not factorize and hence it cannot have a common factor with P1 (n) and P3 (n). Therefore,
the gcd of these polynomials is 1.
4. Are the following propositions correct:
k
(a) If gcd(m, n) = 1 and m = n then gcd(n, k) = 1.
k
(b) If gcd(m, k) = 1 and m = n then gcd(n, k) = 1.
Solution:
(a) This is correct and can be proved by various ways. In the following we prove it by using contradiction
(which is the easiest way).
k
So, let us assume that g ≡ gcd(n, k) > 1 and hence n = gν and k = gκ and thus (from m = n) we
have m = sk + n = g(sκ + ν) which means that g|m and hence g is a common factor of m and n which
contradicts the condition that gcd(m, n) = 1. So, we must have gcd(n, k) = 1.
(b) This is correct and can be proved by various ways. In the following we prove it by using contradiction
(which is the easiest way).

140
13 GCD AND LCM 141

k
So, let us assume that g ≡ gcd(n, k) > 1 and hence n = gν and k = gκ and thus (from m = n) we
have m = sk + n = g(sκ + ν) which means that g|m and hence g is a common factor of m and k which
contradicts the condition that gcd(m, k) = 1. So, we must have gcd(n, k) = 1.
5. Find gcd(n, n + 2) for all n ∈ N.
Solution: For even n (say n = 2m where m ∈ N) we have:

gcd(n, n + 2) = gcd(2m, 2m + 2) = 2 gcd(m, m + 1) = 2

where the last step is because m and m + 1 are coprime.


For odd n we have (see the rules of gcd in the preamble of § 2.4 of V1):

gcd(n, n + 2) = gcd(2m + 1, 2m + 3) = gcd(2m + 1, [2m + 3] − [2m + 1]) = gcd(2m + 1, 2) = 1

where the last step is because 2m + 1 is odd and hence it is coprime to 2.


So in brief, two natural numbers which differ by 2 are either coprime (i.e. when they are odd) or their
greatest common divisor is 2 (i.e. when they are even).
6. Let a, b, c, d ∈ Z. Show that if ab + cd = 1 then a is coprime to both c and d (and similarly b is coprime
to both c and d).
Solution: If a is not coprime to one of them (say a is not coprime to c) then they must have a common
factor g > 1 and hence if a = gα and c = gγ (α, γ ∈ Z) then we have:
ab + cd = 1 → g(αb + γd) = 1
  
Now, (αb + γd) is an integer which is either 0 and hence g(αb + γd) = 0 6= 1 or not 0 and hence
|g(αb + γd)| > 1 . So, these contradictory results (which are based on the assumption that a and c are
not coprime) should imply that a and c must be coprime. By the same argument, a and d must also
be coprime (and this similarly applies to b with regard to c and d).
7. Show that the following fractions are irreducible for all m ∈ N:
3m − 1 9m + 1
5m − 2 6m + 1
Solution: For a fraction to be irreducible, the gcd of its numerator and denominator must be 1. Now,
from Bezout theorem we have:

gcd(3m−1, 5m−2) = 5(3m−1)−3(5m−2) = 1 gcd(9m+1, 6m+1) = −2(9m+1)+3(6m+1) = 1

Thus, these fractions are irreducible.


8. Find the gcd and lcm of the following numbers:
(a) m = 3290 + 1 and n = 370 + 1. (b) m = 5330 + 1 and n = 125130 + 1.
Solution:
(a) If x = 310 then m = x29 + 1 and n = x7 + 1. The gcd of x29 + 1 and x7 + 1 is x + 1. Hence,
gcd(m, n) = 310 + 1 = 59050.
Regarding the lcm, we have mn = gcd(m, n) × lcm(m, n) and hence:

mn (3290 + 1)(370 + 1)
lcm(m, n) = = = 9827 . . . 4650
gcd(m, n) 310 + 1
which is a 167-digit integer.
(b) If x = 510 then m = x33 + 1 and n = x39 + 1. The gcd of x33 + 1 and x39 + 1 is x3 + 1. Hence,
gcd(m, n) = 530 + 1 = 931322574615478515626.
Regarding the lcm, we have:
mn (5330 + 1)(125130 + 1)
lcm(m, n) = = = 1946 . . . 5626
gcd(m, n) 530 + 1
which is a 483-digit integer.
13 GCD AND LCM 142

9. Show that if m, n, k are integers (which are not all zero) then there are s, t, u ∈ Z such that gcd(m, n, k) =
sm + tn + uk.
Solution: We note first that in the following we use the rules of gcd which we stated in § 2.4 of V1
without detailed reference to these rules because of their obviousness.
If (exactly) two of m, n, k are 0 (say n = k = 0) then we have gcd(m, 0, 0) = gcd(m, 0) = (±1)m+t0+u0
(where plus for m > 0 and minus for m < 0).
If (exactly) one of m, n, k is 0 (say k = 0) then we have gcd(m, n, 0) = gcd(m, n) = sm + tn + u0.
If none of m, n, k is 0 then we have:
 
gcd(m, n, k) = gcd m, gcd(n, k) = sm + α gcd(n, k) = sm + α(βn + γk) = sm + tn + uk

where t = αβ and u = αγ.


Note: the above (induction-like) argument can be easily extended to the gcd of any number of integers
(which are not all zero).
10. Express gcd(275, 1430, 374) as a linear combination of 275, 1430, 374.
Solution: The procedure (or “algorithm”) for doing this can be easily inferred from the argument of
Problem 9, that is:
   
gcd(275, 1430, 374) = gcd 275, gcd(1430, 374) = gcd 275, 22 = (1)275 + (−12)22
 
= (1)275 + (−12) gcd(1430, 374) = (1)275 + (−12) (−6)1430 + (23)374)
= (1)275 + (72)1430 + (−276)374

11. Express gcd(60, 105, 70, 385) as a linear combination of 60, 105, 70, 385.
Solution: The procedure (or “algorithm”) for doing this can be easily inferred from the argument of
Problem 9, that is:
   
gcd(60, 105, 70, 385) = gcd gcd(60, 105), gcd(70, 385) = gcd 15, 35 = (−2)15 + (1)35
= (−2) gcd(60, 105) + (1) gcd(70, 385)
   
= (−2) (2)60 + (−1)105 + (1) (−5)70 + (1)385
= (−4)60 + (2)105 + (−5)70 + (1)385
k
12. Show that if m = n then gcd(m, k) = gcd(n, k).
k
Solution: m = n means m = n + bk (where b ∈ Z) and hence gcd(m, k) = gcd(n + bk, k). Now, if k is
a factor of n then we have:

gcd(m, k) = gcd(n + bk, k) = k gcd(ν + b, 1) = k = gcd(n, k) (n = kν)

On the other hand, if k is not a factor of n then let g = gcd(n, k) and hence we have:

gcd(m, k) = gcd(n + bk, k) = g gcd(n′ + bk ′ , k ′ ) = g = gcd(n, k) (n = gn′ , k = gk ′ )

where the third step is justified by the fact that n′ and k ′ are coprime and hence gcd(n′ + bk ′ , k ′ ) = 1.
So, in both cases we have gcd(m, k) = gcd(n, k).
13. Let m, n be coprime integers. Find the following:
(a) gcd(2m + n, 3m + 5n). (b) gcd(7m + 3n, 3m + 4n).
Solution:
(a) Let S = 5(2m + n) − (3m + 5n) = 7m and D = 2(3m + 5n) − 3(2m + n)= 7n. Now, if d is any
common factor of (2m + n) and (3m + 5n) then d should divide both S and D i.e. d|(7m)  and d|(7n)
and hence d should divide their gcd i.e. d| gcd(7m, 7n); see Problem 10 of § 2.4 of V1 . Now:

gcd(7m, 7n) = 7 gcd(m, n) = 7

where the second step is because m and n are coprime. Accordingly, d|7 which means that d is either
±1 or ±7 and hence gcd(2m + n, 3m + 5n) = 1 or gcd(2m + n, 3m + 5n) = 7.
13 GCD AND LCM 143

(b) Let S = 4(7m + 3n) − 3(3m + 4n) = 19m and D = 7(3m + 4n) − 3(7m + 3n) = 19n. Now, if d is
any common
 factor of (7m + 3n) and (3m + 4n) then d should divide both S and D i.e. d|(19m) and
d|(19n) and hence d should divide their gcd, i.e. d| gcd(19m, 19n). Now:

gcd(19m, 19n) = 19 gcd(m, n) = 19

Accordingly, d|19 which means that d is either ±1 or ±19 and hence gcd(7m + 3n, 3m + 4n) = 1 or
gcd(7m + 3n, 3m + 4n) = 19.
14. Propose an “efficient algorithm” for computing the gcd of a large number of (distinct) positive integers
greater than 1.[89]
Solution: This “algorithm” is outlined in the following points:
• Take the smallest of these numbers (noting that the gcd cannot exceed in magnitude its operands).
• If anyone of the remaining numbers is prime then the gcd is 1 (because the smallest cannot be divisible
by the prime which is divisible only by itself and 1).
• If the smallest is prime (and none of the remaining numbers is prime) then order the remaining
numbers increasingly and start dividing the remaining numbers by the smallest. If anyone of the
remaining numbers is not divisible by the smallest then the gcd is 1; otherwise the gcd is the smallest.
• If the smallest is composite (and none of the remaining numbers is prime) then:
Order the remaining numbers increasingly and calculate the gcd of the smallest with the second smallest
(say gcd1 ).
Calculate the gcd of the third smallest with the gcd1 and hence find their gcd (say gcd2 ). 
Continue this process i.e. calculating the gcd of the (n + 2)th smallest with the gcdn to obtain gcdn+1
until you get a gcd that is equal to 1 (and hence the gcd of the given numbers is 1) or you reach the
last remaining numbers (and hence the gcd of the given numbers is the last obtained gcd).
15. Find the gcd of the following integers using the “algorithm” of Problem 14:
(a) 2135, 1152, 5531, 789, 7105, 3329, 1287, 105, 69917, 7709, 11679, 33219, 4727, 2752.
(b) 1261, 679, 8536, 5917, 97, 2910, 388, 1843, 2619, 9797, 5238.
Solution:
(a) The smallest of these numbers is 105 which is composite. On testing the remaining numbers one by
one (say in their increasing order to simplify the process) we find that 3329 is prime. Hence, the gcd of
these numbers is 1.
(b) The smallest of these numbers is 97 which is prime. On inspecting the remaining numbers one by
one we find that they are all divisible by 97. Hence, the gcd of these numbers is 97.
16. Find the lcm of the following integers:
7907, 178, 2315, 443, 6682, 2971, 55349, 16728, 1291, 5681, 22100, 3607, 5641, 19996
Solution: The following numbers are prime: 7907, 443, 2971, 1291, 3607, 5641. The prime-factorizations
of the remaining numbers are:
178 = 2 × 89 2315 = 5 × 463 6682 = 2 × 13 × 257 55349 = 7 × 7907
16728 = 23 × 3 × 17 × 41 5681 = 13 × 19 × 23 22100 = 22 × 52 × 13 × 17 19996 = 22 × 4999
So, the lcm of these numbers is:

7907 × 443 × 2971 × 1291 × 3607 × 5641 × 23 × 3 × 52 × 7 × 13 × 17 × 19 × 23 × 41 × 89 × 257 × 463 × 4999 =

240680395597658170044361592180236529515800
17. Find the gcd of all the elements of the following sets (where x ∈ Z):
(a) {x7 − x}. (b) {x11 − x}.
[89] If
one of the numbers is 0 then we simply ignore it (noting that the gcd of the rest is the same as the gcd of the numbers
including 0). If one of the numbers is 1 then the gcd of the numbers is 1. If the numbers include negatives then we
take their absolute value (noting that the gcd is not affected by sign). We note that “efficient algorithm” is because
the traditional methods for calculating the gcd of a large number of integers are not efficient especially when the given
numbers are large in magnitude.
13 GCD AND LCM 144

Solution:
(a) According to Problem 3 of § 8.2, any prime number that divides (x7 − x) for all x ∈ Z must be
less than or equal to 7. So, the gcd of {x7 − x} can contain only the following primes: p = 2, 3, 5, 7.
p
On testing these primes on the congruence x7 = x we find that only p = 2, 3, 7 satisfy this congruence
identically (i.e. for all x ∈ Z). So, the prime factors of the gcd of the elements of {x7 − x} are only
2, 3, 7. Moreover, p2 (and hence any higher natural power of p) of these primes does not divide x7 − x
identically because:
22 32 72
27 − 2 = 2 37 − 3 = 6 77 − 7 = 42
So, the gcd of the elements of the set {x7 − x} for all x ∈ Z is 2 × 3 × 7 = 42.
(b) As in part (a), any prime number that divides (x11 − x) for all x ∈ Z must be less than or equal to
11. So, the gcd of {x11 − x} can contain only the following primes: p = 2, 3, 5, 7, 11. On testing these
p
primes on the congruence x11 = x we find that only p = 2, 3, 11 satisfy this congruence identically (i.e.
for all x ∈ Z). So, the prime factors of the gcd of the elements of {x11 − x} are only 2, 3, 11. Moreover,
p2 (and hence any higher natural power of p) of these primes does not divide x11 −x identically because:
22 32 112
211 − 2 = 2 311 − 3 = 6 1111 − 11 = 110
So, the gcd of the elements of the set {x11 − x} for all x ∈ Z is 2 × 3 × 11 = 66.
18. Find the gcd of 17! + 17 and 18! + 17.
Solution: No prime < 17 can divide 17! + 17 because such a prime divides 17! but not 17. So, no prime
< 17 can be a factor in the gcd of 17! + 17 and 18! + 17.
Also, no prime > 17 can divide both 17! + 17 and 18! + 17 because if such a prime can divide both then
it should divide their difference, that is:
(18! + 17) − (17! + 17) = 18! − 17! = 17!(18 − 1) = 17! × 17
As we see, any prime > 17 can divide neither 17! nor 17 and hence it cannot divide their product. This
implies that no prime > 17 can divide both 17! + 17 and 18! + 17. So, no prime > 17 can be a factor
in the gcd of 17! + 17 and 18! + 17.
Thus, the only possible prime that can divide both 17! + 17 and 18! + 17 (and hence it can be a factor
in their gcd) is 17. So, the gcd of 17! + 17 and 18! + 17 must be a natural power of 17. Now if we try
172 and 173 we find that only 172 divides both 17! + 17 and 18! + 17. Hence, we conclude that the gcd
of 17! + 17 and 18! + 17 is 172 = 289.
Chapter 14
Last Digits
1. Find the last 6 digits of the following (where n ∈ N):
(a) 3412378234699945612 × 7562988712348990246. (b) 999999n .
(c) 1001n . (d) 19230 .
Solution:
(a) The last 6 digits of this product are determined by the product of the last ∼ 6 digits of the
multiplicands (noting that the higher rank digits of the multiplicands contribute only to the higher
rank digits of the product). Accordingly:

45612 × 90246 = 4116300552


945612 × 990246 = 936388500552
9945612 × 8990246 = 89413498500552

As we see, the last 6 digits of the product do not change in the last two equalities (where we take the
last 6 and 7 digits only) and hence the last 6 digits of the given product are 500552.
106 106
(b) The last 6 digits x are given by x = 999999n which is equivalent to x = (−1)n . Now, for n odd
106 106 106 106
we have x = (−1)n = −1 = 999999 while for n even we have x = (−1)n = 1 = 000001. So, the last
6 digits of 999999n are 999999 for odd n and 000001 for even n.
(c) We have:

1001n = (1000 + 1)n


= 1 + C1n 10001 + C2n 10002 + · · ·
106
= 1 + n1000

where line 2 is justified by the binomial theorem (see Eq. 13 in V1), and line 3 is because all the
(C2n 10002 + · · · ) terms have a factor of 106 . Now, if n = · · · d2 d1 d0 (where the d’s stand for digits and
where · · · d2 d1 could be totally or partially 0) then the last 6 digits x of 1001n are:

x = 1 + d2 d1 d0 000 = d2 d1 d0 001

For example, for n = 6, 84, 892, 4574 we have x = 006001, 084001, 892001, 574001.
(d) 195 = 2476099 and hence:

19230 = (195 )46 = (2476000 + 99)46


= C046 24760000 × 9946 + C146 24760001 × 9945 + · · ·
= 9946 + 46 × 2476000 × 9945 + · · ·
6
10
= 9946 + 46 × 2476000 × 9945
= (99 + 46 × 2476000) 9945
= 113896099 × 9945
= 113896099 (100 − 1)45
 
= 113896099 C045 1000 (−1)45 + C145 1001 (−1)44 + C245 1002 (−1)43 + · · ·
= 113896099 [−1 + 4500 − 9900000 + · · · ]

145
14 LAST DIGITS 146

106
= 113896099 × (−9895501)
106
= 449401

So, the last 6 digits of 19230 are 449401.


2. Find the last 3 digits of the following:
2001 6345
(a) 20032002 . (b) 30137 .
φ(k) k
Solution: We note first that if m = n then sm = sn (where k and s are coprime; see rule 12 of § 2.7
of V1).
400
(a) φ(1000) = 400 and 2002 = 2 and hence:
φ(1000) 400 400 400
20022001 = n → 20022001 = n → 22001 = n → 2 × (225 )80 = n →
80 400 400 400 25 16 400 16 400
2 × 32 = n → 2×2 = n → 2 × (2 ) = n → 2 × 32 = n →
80 400 75 400 25 3 400 3 400
2×2 = n → 26 × 2 = n → 26 × (2 ) = n → 26 × 32 = n →
400 φ(1000)
n = 352 → 20022001 = 352
φ(k) k 2001 1000
Now, if we use the fact that if m = n then sm = sn then we get 20032002 = 2003352 and hence
1000
(noting that 2003 = 3):
2001 1000 1000 1000
32002 = 3352 = (325 )14 × 32 = 44314 × 32 = (4434 )3 × 4432 × 32 = 13 × 4432 × 32 = 1766241
2001
So, the last 3 digits of 20032002 are 241.
(b) Let a = 6345 . Noting that φ(400) = 160 we have:
160 160 160 160
6345 = a → (634 )11 × 63 = a → 111 × 63 = a → 63 = a →
φ(400) 400 45
63 = a → 3763 = 37a = 3763
45
Now, let b = 3763 . Noting that φ(1000) = 400 we have:
400 45 400 400 400
3763 = 3763 → 3763 = b → (376 )10 × 373 = b → 910 × 373 = b →
400 φ(1000) 1000 6345
253 = b → 253 = b → 301253 = 301b = 30137
Hence:
6345 1000 1000
30137 = 301253 = (30110 )25 × 3013 = 125 × 3013 = 27270901
6345
So, the last 3 digits of 30137 are 901.
Note: in the following we re-solve part (b) using a simpler (but less general) method:
It is easy to verify that:
10
1000
301n =1,2,3,4,5,6,7,8,9,10 = 301, 601, 901, 201, 501, 801, 101, 401, 701, 001
45 10 6345 1000 1000
Also, it is relatively easy to verify that 3763 = 3.[90] Hence, 30137 = 3013 = 901, i.e. the last
6345
3 digits of 30137 are 901 (as before).
3. Find all n ∈ N such that:
(a) 197n ends in 677. (b) 831n ends in 7841. (c) 936n ends in 68754.

[90] For 4 4
example, 6345 − 3 = (−1)45 − 3 = −4 = 0 and hence 6345 − 3 = 4k (k ∈ N). Therefore:
45 10 45 45 k 10 10
3763 = (−3)63 = (−3)63 (−3)3 = (−3)4k (−3)3 = (−3)4 (−3)3 = 1k (−3)3 = −27 = 3
−3

14 LAST DIGITS 147

Solution:
1000
(a) On inspecting the low values of n we find that the lowest n such that 197n = 677 is n = 73, while
1000
the lowest n such that 197n = 1 is n = 100.[91] Hence:
k 1000 1000
19773+100k = 19773 × 197100k = 19773 × 197100 = 19773 × 1k = 19773 = 677

i.e. 197n ends in 677 for all n = 73 + 100k where k ∈ N0 .


10000
(b) On inspecting the low values of n we find that the lowest n such that 831n = 7841 is n = 8,
10000
while the lowest n such that 831n = 1 is n = 250.[92] Hence:
k 10000 10000
8318+250k = 8318 × 831250k = 8318 × 831250 = 8318 × 1k = 8318 = 7841

i.e. 831n ends in 7841 for all n = 8 + 250k where k ∈ N0 .


(c) 936n cannot end in 68754 because all natural powers of integers ending in 6 end in 6 (see rule 17 of
§ 1.8 of V1).
4. Show that the last digit of nm is the same as the last digit of dm 0
0 (where n ∈ N , m ∈ N and d0 is the
last digit of n).
Solution: Let n = dk . . . d2 d1 d0 (where dk , . . . , d2 , d1 , d0 are digits). We have (see Eq. 14 in V1):
m m 10
nm = (dk . . . d2 d1 d0 ) = dk × 10k + . . . + d2 × 102 + d1 × 101 + d0 = dm
0

i.e. the last digit of nm is the same as the last digit of dm 0 .


5. Show that the last digit of n5 is the same as the last digit of n (where n ∈ N0 ).
Solution: Let n = dk . . . d2 d1 d0 (where dk , . . . , d2 , d1 , d0 are digits). We have:
05 = 0 15 = 1 25 = 32 35 = 243 45 = 1024
55 = 3125 65 = 7776 75 = 16807 85 = 32768 95 = 59049
10
i.e. for n = 0, 1, . . . , 9 we have n5 ≡ d50 = d0 . Regarding n > 9 we have (see Eq. 14 in V1):[93]
5 5 10 10
n5 = (dk . . . d2 d1 d0 ) = dk × 10k + . . . + d2 × 102 + d1 × 101 + d0 = d50 = d0

i.e. the last digit of n5 is the same as the last digit of n for all n ∈ N0 .
6. Show that no perfect square ends in 2, 3, 7, 8.
Solution: This is a consequence of the result of Problem 4 noting that the squares of 0, 1, 2, 3, 4, 5,
6, 7, 8, 9 are: 0, 1, 4, 9, 16, 25, 36, 49, 64, 81.
7. Find the last digit of the quadratic expression 5n2 − 3n + 17 for all n ∈ Z.
Solution: Let f (n) ≡ 5n2 − 3n + 17. Now, we have:
 
5 10
f n = 1, 2, 3, 4, 5 = 9, 1, 3, 5, 7

i.e. the last digit of the given expression for n = 1 + 5k, 2 + 5k, 3 + 5k, 4 + 5k, 5 + 5k (where k ∈ Z) is
9, 1, 3, 5, 7 (respectively).
8. Find the last two digits of the factorial expression 7n! + 237 for all n ∈ N0 .
Solution: By inspection, the last two digits of the expression for n = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 is 44, 44,
51, 79, 05, 77, 77, 17, 77, 97.
Regarding n ≥ 10, the number of trailing zeros in n! (and hence in 7n!) is not less than two (see Eq.
84 in V1) and hence the last two digits of the sum 7n! + 237 is the same as the last two digits of 237
(i.e. 37). So, the last two digits of the given expression is 37 for all n ≥ 10.
[91] This inspection can be done by writing a simple code using modular arithmetic where exponentiation is done by repet-
itive multiplication in which only the last few digits of the product are taken in each stage. The reader can use the
LastDigit1.cpp code (which is in the “Codes” directory) for this inspection.
[92] Again, the reader can use the LastDigit1.cpp code for this inspection.
[93] In fact, we can use the result of Problem 4 directly. However, we prefer this for clarity and demonstration.
14 LAST DIGITS 148

9. Find the last digit of the exponential expression 699999993n + 1 for all n ∈ N.
Solution: We have:
699999993n + 1 = (11111111n × 9n × 7n ) + 1
Now:
11111111n always terminates in 1 and hence it has no cycle (i.e. its period is 1).
9n has a cycle of 2, i.e. it terminates in 9 for odd n and in 1 for even n.
7n has a cycle of 4, i.e. it terminates in 7, 9, 3, 1 corresponding to n = 1 + 4k, 2 + 4k, 3 + 4k, 4 + 4k
(where k ∈ N0 ).
So, 699999993n + 1 has a cycle of 4, i.e. it terminates in 4, 0, 8, 2 corresponding to n = 1 + 4k, 2 + 4k, 3 +
4k, 4 + 4k.
 2  
10. Find the last digit of the expression x+1 2 + 3 x2 + 2 for all x ∈ Z.
Solution: In Problem 5 of § 12 it was shown that this expression is always even and hence the last
digit can only be 0, 2, 4, 6, 8. Moreover, this expression is equal to:
k 2 + 3k + 6 when x is even and k 2 + 5k + 10 when x is odd
10
Now, if we try k 2 + 3k + 6 = 0, 2, 4, 6, 8 we find that this congruence has solutions only for 0, 4, 6. Sim-
10
ilarly, if we try k 2 + 5k + 10 = 0, 2, 4, 6, 8 we find that this congruence has solutions only for 0, 4, 6. So,
the last digit of this expression can only be 0, 4, 6. Further inspection should reveal that the last digit
10
of this expression is 0, 0, 6, 6, 4, 4, 4, 4, 6, 6 corresponding to x = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10.
Chapter 15
Divisibility
1. Find all natural numbers of the form abab which are divisible by 9 (where a, b are digits).
Solution: We have abab = 101 × ab. Now, 101 is not divisible by 9 and hence if abab is divisible by 9
then ab must be divisible by 9, i.e. a + b must be divisible by 9. So, we have only the following eleven
possibilities: ab = 09, 18, 27, 36, 45, 54, 63, 72, 81, 90, 99.
2. Show that for any n ∈ Z, 7|(n − 1) iff 343|(n3 − 3n2 − 46n + 48).
Solution: We note first that n3 − 3n2 − 46n + 48 = (n − 8)(n − 1)(n + 6) and 343 = 73 . Moreover,
7 7
n − 8 = n − 1 = n + 6. Now:
7 7
• If 7|(n − 1) then 7|(n − 8) and 7|(n + 6) (noting that n − 8 = n − 1 = n + 6) and hence 73 divides
their product which is (n3 − 3n2 − 46n + 48), i.e. 343|(n3 − 3n2 − 46n + 48).
• If 343|(n3 − 3n2 − 46n + 48) then 7 must divide each one of its three factors and hence 7 must divide
(n − 1), i.e. 7|(n − 1).[94]
3. Show that for any n ∈ Z, 5|(n3 − 3n2 + 2n) iff 56 | (n2 − 7n + 12) and vice versa.
Solution: We have:
5
• n3 − 3n2 + 2n = n(n − 1)(n − 2) and hence it is obvious that the solutions of n3 − 3n2 + 2n = 0 are
5
n = 0, 1, 2.
5
• n2 − 7n + 12 = (n − 3)(n − 4) and hence it is obvious that the solutions of n2 − 7n + 12 = 0 are
5
n = 3, 4.
5 5
So, the residue classes (mod 5) are partitioned (as solutions) between n3 −3n2 +2n = 0 and n2 −7n+12 =
0 and hence what solves one of these congruences does not solve the other congruence and vice versa,
i.e. 5|(n3 − 3n2 + 2n) iff 56 | (n2 − 7n + 12) and vice versa.
4. Show that for any N ∋ n > 2 there are x, y, z ∈ N (where x 6= y 6= z and n2 < x, y, z < n3 ) such that
z|(x2 − y 2 ).
Solution: For example, x = n2 + 2, y = n2 + 1 and z = 2n2 + 3 meet these conditions because:
2 2
x2 − y 2 = n2 + 2 − n2 + 1 = 2n2 + 3 = z

and hence z|(x2 − y 2 ).


5. Find all x, y ∈ Z such that:
(a) (x2 + y 2 )/(x + y) is an integer multiple of 31. (b) (x2 + y 2 )/(x + y) is a divisor of 35.
(c) (x2 + y 2 )/(x − y) is a divisor of 21.
Solution:
(a) x = y = 0 is not a possibility (assuming 0/0 is not defined) and hence in the following we assume
at least one of x, y 6= 0. Moreover, x + y 6= 0 (to avoid singularity) and hence y 6= −x. Now, since
(x2 + y 2 )/(x + y) is an integer multiple of 31 we must have (where k ∈ Z):

x2 + y 2 x2 + y 2
= 31k → = k(x + y)
x+y 31
31 31
i.e. 31|(x2 + y 2 ). This implies that x2 + y 2 = 0 whose only solution is (x, y) = (0, 0). Accordingly, the
solutions of this Problem are: (x, y) = (31s, 31t) where s, t ∈ Z and s + t 6= 0.
[94] To be more clear we may say: if 343|(n3 − 3n2 − 46n + 48) then 7 must divide one of the three factors of the polynomial
7 7
(noting that 343 = 73 ) and hence 7 must divide all the three factors of the polynomial (noting that n − 8 = n − 1 = n + 6),
i.e. 7|(n − 1).

149
15 DIVISIBILITY 150

(b) Again, x + y 6= 0. Let a symbolize a divisor of 35, i.e. a = ±1, ±5, ±7, ±35. Hence, we must have
x2 +y 2
x+y = a, that is:

x2 − ax + y 2 − ay = 0 → 4x2 − 4ax + 4y 2 − 4ay = 0 →

4x2 − 4ax + a2 + 4y 2 − 4ay + a2 = 2a2 → (2x − a)2 + (2y − a)2 = 2a2 →

X 2 + Y 2 = 2a2
Now, we have four cases to consider:
• a = ±1 and hence X 2 + Y 2 = 2. Now, the only possibility for 2 to be the sum of two squares is
(X, Y ) = (±1, ±1) and hence the solutions (x, y) are (noting that x = y = 0 is not a possibility):
(0, 1) (1, 0) (1, 1) (−1, −1) (−1, 0) (0, −1)
2 2
• a = ±5 and hence X + Y = 50. Now, the only possibilities for 50 to be the sum of two squares are
(X, Y ) = (±1, ±7), (±5, ±5), (±7, ±1) and hence the solutions (x, y) are (noting that x = y = 0 is not
a possibility):
(2, −1) (2, 6) (3, −1) (3, 6) (−3, −6) (−3, 1) (−2, −6) (−2, 1)

(0, 5) (5, 0) (5, 5) (−5, −5) (−5, 0) (0, −5)

(−1, 2) (6, 2) (−1, 3) (6, 3) (−6, −3) (1, −3) (−6, −2) (1, −2)
2 2
• a = ±7 and hence X + Y = 98. Now, the only possibility for 98 to be the sum of two squares is
(X, Y ) = (±7, ±7) and hence the solutions (x, y) are (noting that x = y = 0 is not a possibility):
(0, 7) (7, 0) (7, 7) (−7, −7) (−7, 0) (0, −7)
• a = ±35 and hence X 2 + Y 2 = 2450. Now, the only possibilities for 2450 to be the sum of two squares
are (X, Y ) = (±7, ±49), (±35, ±35), (±49, ±7) and hence the solutions (x, y) are (noting that x = y = 0
is not a possibility):
(14, −7) (14, 42) (21, −7) (21, 42) (−21, −42) (−21, 7) (−14, −42) (−14, 7)

(0, 35) (35, 0) (35, 35) (−35, −35) (−35, 0) (0, −35)

(−7, 14) (42, 14) (−7, 21) (42, 21) (−42, −21) (7, −21) (−42, −14) (7, −14)
So in brief, we have 56 solutions.
(c) As before, we assume x − y 6= 0. Now, the divisors of 21 are a = ±1, ±3, ±7, ±21 and hence if we
follow a similar approach to that of part (b) then we get:
• a = −21 leads to the solutions: (x, y) = (−21, 0), (−21, 21), (0, 21).
• a = −7 leads to the solutions: (x, y) = (−7, 0), (−7, 7), (0, 7).
• a = −3 leads to the solutions: (x, y) = (−3, 0), (−3, 3), (0, 3).
• a = −1 leads to the solutions: (x, y) = (−1, 0), (−1, 1), (0, 1).
• a = 1 leads to the solutions: (x, y) = (0, −1), (1, −1), (1, 0).
• a = 3 leads to the solutions: (x, y) = (0, −3), (3, −3), (3, 0).
• a = 7 leads to the solutions: (x, y) = (0, −7), (7, −7), (7, 0).
• a = 21 leads to the solutions: (x, y) = (0, −21), (21, −21), (21, 0).
So, these 24 pairs are all the solutions of this problem.
6. Find all x, y, z ∈ Z such that:
(a) xy|(x2 + y 2 ). (b) xyz|(x2 + y 2 ).
Solution:
(a) It is obvious that xy 6= 0. If xy|(x2 + y 2 ) then we have:

x2 + y 2 x y
=k → + =k (k ∈ Z)
xy y x
15 DIVISIBILITY 151

In Problem 4 of § 4.1.10 of V1 we proved that if x, y, k ∈ Z (xy 6= 0) then xy + xy = k has no solution


except when y = ±x (and hence k = ±2). So, xy|(x2 +y 2 ) when (x, y) = (s, −s) and when (x, y) = (s, s)
where Z ∋ s 6= 0.  2 2 2
+y 2
(b) We note that xyz|(x2 +y 2 ) implies z x xy
+y
. Now, from the answer of part (a) we have x xy = ±2
and hence z = ±1, ±2. Therefore, the solutions are (where Z ∋ s 6= 0):
(x, y, z) = (s, −s, ±1) (x, y, z) = (s, −s, ±2) (x, y, z) = (s, s, ±1) (x, y, z) = (s, s, ±2)
7. Show that 66|(n21 − n) for all n ∈ Z.
Solution: n21 − n is always even and hence 2|(n21 − n). Also, by Fermat’s little theorem we have:
7 3 2 3 3
n21 − n = n3 − n = n7 − n = n n3 − n = n n2 − n = n3 − n = n − n = 0

i.e. 3|(n21 − n). Finally, by Fermat’s little theorem we have:


2 11
n21 − n = n−1 n11 − n = n−1 n2 − n = n − n = 0

i.e. 11|(n21 − n).


So, (n21 − n) is divisible by 2, 3 and 11 for all n ∈ Z and hence it is divisible by their product (noting
that they are pairwise coprime) for all n ∈ Z, i.e. 66|(n21 − n) for all n ∈ Z.
8. Find all x, y, z ∈ N such that:
   
(a) xyz (x + 1)(y + 1)(z + 1) . (b) (x − 1)(y − 1)(z − 1) xyz.
   
(c) (x − 1)(y − 1)(z − 1) (xyz − 1). (d) (x + 1)(y + 1)(z + 1) (xyz − 1).
Solution:
(a) Let:

(x + 1)(y + 1)(z + 1) xyz + xy + xz + yz + x + y + z + 1 1 1 1 1 1 1 1


A≡ = = 1+ + + + + + +
xyz xyz z y x yz xz xy xyz
It should be obvious that the maximum value of A is 8, i.e. when x = y = z = 1 and hence all the
8 terms are equal to 1 (because otherwise some of the terms will be less than 1). So, we need only to
consider A = 1, 2, . . . , 8. However, let first assume that x ≤ y ≤ z.
• A = 1: this is impossible because the numerator of A is greater than its denominator for any
x, y, z ∈ N (or alternatively the sum of the last seven terms of A cannot be zero).
• A = 2: x must be 2 or 3 because if x = 1 then A > 2 while if x ≥ 4 then A < 2.
If x = 2 then we must have 4 ≤ y ≤ 6 because otherwise A > 2 or A < 2. Now, if x = 2 and y = 4 then
we have only one possibility for z (i.e. z = 15), and if x = 2 and y = 5 then we have only one possibility
for z (i.e. z = 9), while if x = 2 and y = 6 then we have only one possibility for z (i.e. z = 7).
If x = 3 then we must have 3 ≤ y ≤ 4 because otherwise A < 2. Now, if x = 3 and y = 3 then we have
only one possibility for z (i.e. z = 8), while if x = 3 and y = 4 then we have only one possibility for z
(i.e. z = 5).
So, only (x, y, z) = (2, 4, 15), (2, 5, 9), (2, 6, 7), (3, 3, 8), (3, 4, 5) make A = 2.
• A = 3: x must be 1 or 2 because otherwise A < 3.
If x = 1 then we must have 3 ≤ y ≤ 4 because otherwise A > 3 or A < 3. Now, if x = 1 and y = 3
then we have only one possibility for z (i.e. z = 8), while if x = 1 and y = 4 then we have only one
possibility for z (i.e. z = 5).
If x = 2 then we must have y = 2 because otherwise A < 3. Hence, we have only one possibility for z
(i.e. z = 3).
So, only (x, y, z) = (1, 3, 8), (1, 4, 5), (2, 2, 3) make A = 3.
• A = 4: x must be 1 because otherwise A < 4. Accordingly, y must be 2 because if y = 1 then A > 4
while if y ≥ 3 then A < 4. Now, if x = 1 and y = 2 then we have only one possibility for z, i.e. z = 3.
So, only (x, y, z) = (1, 2, 3) makes A = 4.
• A = 5: x must be 1 because otherwise A < 5. Similarly, y must be 1 because otherwise A < 5. Now,
15 DIVISIBILITY 152

if x = y = 1 then we have only one possibility for z, i.e. z = 4. So, only (x, y, z) = (1, 1, 4) makes
A = 5.
• A = 6: x must be 1 because otherwise A < 6. Similarly, y must be 1 because otherwise A < 6. Now,
if x = y = 1 then we have only one possibility for z, i.e. z = 2. So, only (x, y, z) = (1, 1, 2) makes
A = 6.
• A = 7: as before, we must have x = y = 1 because otherwise A < 7. Now, if x = y = 1 then we
must have:
(1 + 1)(1 + 1)(z + 1) 4(z + 1)
A= = =7 → 3z = 4
1×1×z z
which has no integer solution. So, we have no solution for A = 7.
• A = 8: as before, we must have x = y = 1 because otherwise A < 8. Now, if x = y = 1 then we have
only one possibility for z, i.e. z = 1. So, only (x, y, z) = (1, 1, 1) makes A = 8.
So far we were assuming x ≤ y ≤ z. Now, if we lift this condition (noting the symmetry in x, y, z) by
permuting x, y, z (and hence permuting the above 12 solutions) then we get in total 55 solutions to the
given divisibility statement.
(b) To avoid singularity we must have x 6= 1, y 6= 1 and z 6= 1. So, in the following we assume x, y, z > 1.
Now, if X = x − 1, Y = y − 1 and Z = z − 1 then we have:
 
XY Z| (X + 1)(Y + 1)(Z + 1) (X, Y, Z ∈ N)

So, this problem is the same as the problem of part (a) with X, Y, Z replacing x, y, z. Accordingly, we
must have the same solutions for X, Y, Z as the solutions for x, y, z in part (a). The final solutions
(x, y, z) will be obtained by the transformation: (x, y, z) = (X + 1, Y + 1, Z + 1). So in brief, the
main 12 solutions are: (x, y, z) = (2, 2, 2), (2, 2, 3), (2, 2, 5), (2, 3, 4), (2, 4, 9), (2, 5, 6), (3, 3, 4), (3, 5, 16),
(3, 6, 10), (3, 7, 8), (4, 4, 9), (4, 5, 6), while the final 55 solutions are obtained by permuting these 12
solutions.
(c) To avoid singularity we must have x, y, z > 1. So, let:
xyz − 1
A≡
(x − 1)(y − 1)(z − 1)

The maximum value of A is 7, i.e. when x = y = z = 2. Following a similar analysis to the analysis
of part (a) we find that the only solutions are: (x, y, z) = (2, 2, 2), (2, 2, 4), (2, 4, 8), (3, 5, 15) and their
permutations. So in total, we have 16 solutions.
(d) Let:
xyz − 1 xyz − 1
A ≡ =
(x + 1)(y + 1)(z + 1) xyz + xy + xz + yz + x + y + z + 1
xyz − 1
=
(xyz − 1) + (xy + xz + yz + x + y + z + 2)

It is obvious that 0 ≤ A < 1. So, the only integer value of A is 0 which occurs when x = y = z = 1.
Therefore, the only solution is: (x, y, z) = (1, 1, 1).
9. Show that 12|(2n+2 + 5n+3 − 9) for all n ∈ N0 .
12 12
Solution: 12|(2n+2 + 5n+3 − 9) is equivalent to 2n+2 + 5n+3 = 9. Now, for even n we have 2n+2 = 4
12 12 12 12
and 5n+3 = 5, while for odd n we have 2n+2 = 8 and 5n+3 = 1. Hence, the congruence 2n+2 + 5n+3 = 9
n+2 n+3 0
is always true, i.e. 12|(2 +5 − 9) for all n ∈ N .
10. Show that if m3 |n2 then m|n (where m, n ∈ N).
Solution: If the (non-standard) prime factorization of m and n are m = pa1 1 pa2 2 . . . pakk and n =
pb11 pb22 . . . pbkk then we have:
2bk
n2 p12b1 p2b
2 . . . pk
2

= 2b1 −3a1 2b2 −3a2


3ak = p1 p2 . . . p2b
k
k −3ak

m3 p13a1 p3a
2
2
. . . p k
15 DIVISIBILITY 153

Now, since m3 |n2 then we must have pi2bi −3ai ≥ 1 for all i = 1, 2, . . . , k. Hence:
p2b
i
i −3ai
≥1 → p2b
i
i
≥ pi3ai → 2bi ≥ 3ai →
b b b
p11 p22 ...pkk
bi ≥ a i → n
m = a1 a2
p1 p2 ...pkk
a → n
m = pb11 −a1 pb22 −a2 . . . pbkk −ak
where pbi i −ai ≥ 1 for all i = 1, 2, . . . , k (because bi ≥ ai ). This means that n/m is an integer and hence
m|n.
We may also argue (more simply) that if m3 |n2 then (where k ∈ N):
n2

n 2 n

m3 = k → m = km → m = km
Now, if a square root of an integer (i.e. km) is rational (i.e n/m) then the integer (i.e. km) is a perfect
square. This means that n/m Pn is an integer and hence m|n.
11. Find all n ∈ N such that x=1 (2x5 − 6x4 − x2 + 9) is divisible by 33.
Solution: We have (see the identities of § 1.10 in V1):
n n
! n
! n
! n
!
X X X X X
5 4 2 5 4 2
(2x − 6x − x + 9) = 2 x −6 x − x +9 1
x=1 x=1 x=1 x=1 x=1
   
n (n + 1)2 (2n2 + 2n − 1)
2
n(n + 1)(2n + 1)(3n2 + 3n − 1)
= 2 −6 −
12 30
 
n(n + 1)(2n + 1)
+ 9n
6
10n6 − 6n5 − 65n4 − 70n3 − 20n2 + 271n
=
30
So, if the given series is divisible by 33 then (10n6 − 6n5 − 65n4 − 70n3 − 20n2 + 271n) must be divisible
99
by 99 (noting that 33 and 10 are coprime), i.e. 10n6 − 6n5 − 65n4 − 70n3 − 20n2 + 271n = 0. The
99
solution to this congruence equation is n = 0, 44, 88 (see § 3.2.1 of V1 as well as § 8.2 of the present
volume). So, the given series is divisible by 33 iff n = 44 + 99m or n = 88 + 99m or n = 99(1 + m)
where m ∈ N0 .
12. Find the remainder when:
(a) 2978354896302 is divided by 101. (b) 36718924 is divided by 663.
(c) 563897823 is divided by 5931.
Solution:
101
(a) If r represents the remainder then we have 2978354896302 = r and hence:
101 101 548963 2  φ(101) 548963 2 101 548963 2
r = 2978354896302 = 8954896302 = 89100 89 = 89 89 = 1 89
101
= 892 = 43

where we used Euler’s theorem in the fifth step (noting that 29783 and 101 are coprime).
(b) We have 663 = 3 × 13 × 17. Let r be the remainder when 36718924 is divided by 663 and hence
663
36718924 = r. Now:
3 4462 3 4462
36718924 = 28924 = 22 =1 =1
8924 13 8924

4 2231 13 2231
3671 = 5 = 5 =1 =1
17
36718924 = (−1)8924 = 1
663 3 13 17
Now, since 36718924 = r then we must have r = 1, r = 1 and r = 1. On solving this system of
663
congruence equations[95] (using for instance the Chinese remainder theorem) we get: r = 1, i.e. the
[95] More simply, we can use rule 14 of § 2.7 of V1.
15 DIVISIBILITY 154

remainder when 36718924 is divided by 663 is 1.


We may also solve this part by using Euler’s theorem (in part). We note first that 3671 and 663 are
coprime and φ(663) = 384. Hence:
23  23
663 663
36718924 = 3568924 = 356384 × 35692 = 356φ(663) × 35692 = 123 × 35692 = 35692
23 663 23
= 3564 = 1 =1
(c) We have 5931 = 9 × 659. Let r be the remainder when 563897823 is divided by 5931 and hence
5931
563897823 = r. Now:
9 2607 2 9 2607 2 9
563897823 = 47823 = 43 4 =1 4 = 16 = 7
659 1117 659 101 
563897823 = 3747823 = 3747 3744 = 501117 3744 = 5011 506 3744
659  14 3  659  
= 43101 506 3744 = 437 43 506 3744 = 2414 433 506 3744
   659   
= 2411 243 433 506 3744 = 50 243 433 506 3744
   659 659
= 243 433 507 3744 = (644)(427)(645)546 = 74
5931 9 659
Now, since 563897823 = r then we must have r = 7 and r = 74. On solving this system of congruence
5931
equations we get: r = 4687, i.e. the remainder when 563897823 is divided by 5931 is 4687.
13. Comment on Problem 12.
Solution: Problem 12 shows that there are several (and possibly many) methods for solving this type
of problems. These methods vary in applicability and convenience depending mostly on the nature of
the given problem. Hence, we should always inspect different potential methods of solution before we
make our choice. In fact, sometimes more basic approaches are the best choice. For example, part (b)
of Problem 12 can be solved more easily by the following basic approach (as can be seen in the last
steps in the second method):
2231 663 2231
36718924 = 36714 = 1 =1
However, our purpose in Problem 12 is to demonstrate these methods (which can be the best or the
must in some other problems). In fact, we have met and will meet other methods and techniques for
solving this type of problems
Pm (see for instance Problem 20).
14. Show that 13 divides k=0 7k iff m = 12n − 1 (where n ∈ N).
Solution: Regarding the if part, by Fermat’s little theorem (as well as the power rule for congruence)
13
we have: 712n − 1 = 0. On factorizing this we get:
12n−1
! 12n−1
!
X 13
X
k k
(7 − 1) 7 =0 i.e. 13 divides 6 7
k=0 k=0

Now, 13 does not divide 6 and hence it must divide


Pmthe given series (with m = 12n − 1).
Regarding the only if part, if 0 ≤ m ≤ 10 then k=0 7k is not divisible by 13 (as we can easily check
by simple calculations). On the other hand, if m > 11 and m 6= 12n − 1 then m = (12n − 1) + s where
1 ≤ s ≤ 11, that is:
m
X 12n−1
X 12n+s−1
X 12n+s−1
X s−1
X s−1
X s−1
X
13 13
7k = 7k + 7k = 7k = 7k+12n = 712n 7k = 7k
k=0 k=0 k=12n k=12n k=0 k=0 k=0

13
where the second step is because of the result of the “if part” while theP last step is because 712n = 1
s−1
(by Fermat’s little theorem and the power rule for congruences). Now, k=0 7k is not divisible by 13
(as we concluded earlier in the case of 0 ≤ m ≤ 10), and hence the given series is not divisible by 13
for any m 6= 12n − 1, i.e. if 13 divides the given series then m = 12n − 1.
15 DIVISIBILITY 155

15. Find all x, y, z ∈ Z such that x2 y 2 z 2 |(x2 + y 2 + z 2 ).


Solution: xyz 6= 0. Now, we have:
x2 + y 2 + z 2 1 1 1
= 2 2 + 2 2 + 2 2 ≡A
x2 y 2 z 2 y z x z x y
It is obvious that A cannot be greater than 3 (i.e. when y 2 z 2 = x2 z 2 = x2 y 2 = 1) and hence we have
only 3 possibilities (see Problem 7 of § 4.1.10 of V1):
• A = 3 and hence y 2 z 2 = x2 z 2 = x2 y 2 = 1, i.e. (x, y, z) = (±1, ±1, ±1) considering all the 8
possibilities for the combination of signs.
• A = 2 and hence (y 2 z 2 , x2 z 2 , x2 y 2 ) = (1, 2, 2), (2, 1, 2), (2, 2, 1). None of these leads to an integer
solution to x, y, z.
• A = 1 and hence (y 2 z 2 , x2 z 2 , x2 y 2 ) = (2,3,6), (2,6,3), (3,2,6), (3,6,2), (6,2,3), (6,3,2), (2,4,4), (4,2,4),
(4,4,2), (3,3,3). None of these leads to an integer solution to x, y, z.
So in brief, we have only 8 solutions, i.e. (x, y, z) = (±1, ±1, ±1).
16. Find all n ∈ Z such that:
(a) 101|(n101 + 1). (b) 71|(n360 − 7).
Solution: We use Fermat’s little theorem.
101
(a) 101|(n101 + 1) is equivalent to n101 + 1 = 0. Hence:
101 101 101
n101 + 1 = 0 → n+1 = 0 → n = −1
So, 101 divides n101 + 1 for all n = 101k − 1 where k ∈ Z.
71
(b) 71|(n360 − 7) is equivalent to n360 − 7 = 0. Hence:
71 5 71 71 71
n360 − 7 = 0 → n71 n5 = 7 → n5 n5 = 7 → n10 = 7
The last congruence has no solution and hence there is no n ∈ Z such that 71 divides n360 − 7.
17. Let p be a given prime number and let Un symbolize the n-digit repunit number (where N ∋ n > 1).[96]
Show that if Un is the smallest repunit number that is divisible by p then n|(p − 1).
n
Solution: The n-digit repunit number can be written as Un = 10 9−1 . Now, if Un is divisible by p then
we have:
10n −1 p p p
9 =0 → 10n − 1 = 0 → 10n = 1
So, if Un is the smallest repunit number that is divisible by p then Op 10 = n because otherwise we
p
will have m < n such that 10m = 1 and this means that Un is not the smallest repunit number that is
divisible by p since Um (which is divisible by p) is smaller than Un . Now, from Problem 3 of § 1.3 we
get Op 10|φ(p), i.e. n|(p − 1).
18. Let Un symbolize the n-digit repunit number and p be a prime ≤ 47. Identify all p that cannot be a
divisor to any repunit number (i.e. p6 | Un for any n).
Solution: . For instance:
3|U3 7|U6 11|U2 13|U6 17|U16 19|U18 23|U22
29|U28 31|U15 37|U6 41|U5 43|U21 47|U46
So, among 2 ≤ p ≤ 47 only 2 and 5 cannot be a divisor of repunit numbers. This is because 2 is even
while repunit numbers are odd. Also, the residue of a repunit number modulo 5 is always 1.
19. Find the remainder when:
(a) 600! is divided by 601. (b) 730! is divided by 731. (c) 445! is divided by 6454.
Solution:
601 601 601
(a) By Wilson’s theorem (noting that 601 is prime) we have: (601−1)!+1 = 0, i.e. 600! = −1 = 600.
Hence, the remainder when 600! is divided by 601 is 600.
(b) We have 731 = 17 × 43 and hence 730! is divisible by 731, i.e. the remainder is 0.
(c) The prime factorization of 6454 is 6454 = 2 × 7 × 461 and hence 445! is not divisible by 6454 because
6454
it is not divisible by 461. Now, let r symbolize the remainder and hence 445! = r, i.e. 445! = r+6454k
[96] “Repunit number” stands for “repeated unit number” such as 11, 111, 1111. For instance, U2 = 11 and U5 = 11111.
15 DIVISIBILITY 156

(for some k ∈ N). Since 445! and 6454 are divisible by 14 then r should also be divisible by 14, i.e.
r = 14ρ (for some ρ ∈ N). Thus:
6454 445! 461 461 460!461 460!
445! = 14ρ → 14 = ρ → 445! = 14ρ → 445! 445! = 445! r →
461 460! 461 460! 461 461
460! = 445! r → −1 = 445!
r → 396r = −1 → r = 383
where:
steps 1 and 2 are from rules 9 and 6 of § 2.7 of V1,
step 5 is from Wilson’s theorem (noting that 461 is prime),
460! 461
step 6 is because 445! = 446 × 447 × · · · × 460 = 396, and
461 461
step 7 is because r = −1 × 396∗ = −78 = 383.
14 461
So, we have r = 0 (because r = 14ρ) and r = 383. On solving this system of congruence equations
6454
(using for instance the Chinese remainder theorem) we get: r = 2688, i.e. the remainder when 445!
is divided by 6454 is 2688.
20. Find the remainder when:
(a) 729 1618 is divided by 23. (b) 792606470587122315 is divided by 18.
Solution: In this Problem we use a method based on the index of integer (see § 1.5). In the following
r symbolizes the remainder.  
(a) A primitive root of 23 is 5 and we have noting that φ(23) = 22 :
23 φ(23) 
r = 729 1618 → I23,5 (r) = I23,5 729 1618 →
22 22
I23,5 (r) = 29 I23,5 (7) + 18 I23,5 (16) → I23,5 (r) = 29 × 19 + 18 × 8 →
22 22
I23,5 (r) = 695 → I23,5 (r) = 13
22  φ(23)  23 23
So, I23,5 (r) = 13 i.e. I23,5 (r) 13 which means r = 513 = 21. Hence, the remainder is 21.
=
 18 
(b) A primitive root of 18 is 5 and we have noting that φ(18) = 6 and 7926064705871 = 17 :
18 18 φ(18) 
r = 792606470587122315 → r = 1722315 I18,5 (r) = I18,5 1722315 →
6 6 6
I18,5 (r) = 22315 I18,5 (17) → I18,5 (r) = 22315 × 3 = 3
6  φ(18)  18 18
So, I18,5 (r) = 3 i.e. I18,5 (r) = 3 which means r = 53 = 17. Hence, the remainder is 17.
21. Find all m ∈ Z such that m|(6n2 − 14n − 10) and m|(2n3 − 8n + 6) for all n ∈ Z.
Solution: On factorizing the two expressions we get: 6n2 −14n−10 = 2(3n2 −7n−5) and 2n3 −8n+6 =
2(n − 1)(n2 + n − 3). So, the common factor of these expressions is 2. Hence, m|(6n2 − 14n − 10) and
m|(2n3 − 8n + 6) for all n ∈ Z if m = ±1 and m = ±2.
22. Find all m ∈ Z such that m|(4n2 + 4n + 7) and m|(n2 + 5) for some n ∈ Z.
Solution: We have:  
• m|(4n2 + 4n + 7) and m|(n2 + 5) and hence m (4n2 + 4n + 7) − 4(n2 + 5) , i.e. m|(4n − 13).
• m|(4n − 13) and hence m|(4n − 13)2 , i.e. m|(16n2 − 104n + 169). 
• m|(16n2 − 104n + 169) and m|(4n2 + 4n + 7) and hence m (16n2 − 104n + 169) − 4(4n2 + 4n + 7) ,
i.e. m|(141 − 120n).  
• m|(4n − 13) and m|(141 − 120n) and hence m 30(4n − 13) + (141 − 120n) , i.e. m|(−249).
The divisors of 249 are ±1, ±3, ±83, ±249 and hence m = ±1, ±3, ±83, ±249.
It is worth noting that:
• ±1 divides (4n2 + 4n + 7) and (n2 + 5) for all n ∈ Z. This is because ±1 divides any integer.
3 3
• ±3 divides (4n2 + 4n + 7) and (n2 + 5) for all n = 1. This is because the solution of 4n2 + 4n + 7 = 0
3 3 3
is n = 1 while the solution of n2 + 5 = 0 is n = 1, 2 and hence the solution of this system of congruence
3
equations is n = 1 (see § 9.2.1).
83 83
• ±83 divides (4n2 + 4n + 7) and (n2 + 5) for all n = 24. This is because the solution of 4n2 + 4n + 7 = 0
15 DIVISIBILITY 157

83 83 83
is n = 24, 58 while the solution of n2 + 5 = 0 is n = 24, 59 and hence the solution of this system of
83
congruence equations is n = 24.
249 249
• ±249 divides (4n2 +4n+7) and (n2 +5) for all n = 190. This is because the solution of 4n2 +4n+7 = 0
249 249 249
is n = 58, 190 while the solution of n2 + 5 = 0 is n = 59, 107, 142, 190 and hence the solution of this
249
system of congruence equations is n = 190.
23. Find all n ∈ Z such that 9|(n − 7), 17|(n + 1) and 29|(n + 11).
Solution: These divisibility statements are equivalent to the following congruence equations:
9 17 29
n=7 n = −1 n = −11
On solving this system of congruence equations (e.g. by using the Chinese remainder theorem) we get:
n = 3382 + 4437k (where k ∈ Z).
24. Show that the divisibility of 3m + n by 11 is equivalent to the divisibility of 47m − 10n by 11 (where
m, n ∈ Z).
Solution: We have:
47m − 10n = 3m + n + 44m − 11n = 3m + n + 11(4m − n)
Now, 11(4m − n) is divisible by 11 and hence the divisibility of 3m + n by 11 is equivalent to the
divisibility of 47m − 10n by 11.
25. Let q and p be odd primes (q 6= p), n is a positive even integer and k ∈ N. Show that if p|(q n + 1) then
p = 4k + 1.
Solution: We have (where n = 2ν and ν ∈ N):
p p 2 p
p|(q n + 1) → qn + 1 = 0 → q 2ν + 1 = 0 → (q ν ) = −1
 
i.e. −1 is a quadratic residue of p and hence −1
p = 1. So, from Problem 9 of § 1.8 we conclude that
p = 4k + 1.  
26. Let m, n, k ∈ Z. Show that if m|k and n|k and g = gcd(m, n) then mng k.
Solution: Since m|k and n|k then g must be a factor of k (as well as a factor of m and n). So, let
m = gµ and n = gν while k = gκ. Accordingly, µ|κ and ν|κ where µ and ν are coprime (see point 9 in
κ
the preamble of § 2.4 of V1). Therefore, by rule 20 of § 1.9 of V1 we have (µν)|κ which means that µν
κ
is an integer (say µν = A where A ∈ Z). Now, if we multiply A by 1 in the form of g 2 /g 2 then we get:

g2 g2 κ g(gκ) gk k
A=1×A= × A = × = = =
g2 g2 µν (gµ)(gν) mn (mn)/g
 
which means mn g k.
Note: in Problem 6 of § 2.5 of V1 we proved the identity mn = gcd(m, n) × lcm(m, n) using a prime
factorization approach. This identity can also be obtained (possibly more easily and directly) as a
corollary of the formulation (or method or logic) of the present Problem because (noting that µ and ν
are coprime):
lcm(µ, ν) = µν → g 2 lcm(µ, ν) = gµgν → g lcm(gµ, gν) = gµgν →
g lcm(m, n) = mn → gcd(m, n) × lcm(m, n) = mn
27. Show that no odd prime of the form p = 4k − 1 can divide n2 + 1 (where k ∈ N and n ∈ Z).
p p p
Solution: If p divides n2 + 1 then n2 + 1 = 0, i.e. n2 = −1 and hence n4 = 1. Now, from Problem 1
of § 1.3 we conclude that Op n|4, i.e. Op n = 1 or Op n = 2 or Op n = 4. Now:
p p p
• If Op n = 1 then n1 = 1 and hence n2 = 1 which contradicts n2 = −1 (noting that p is an odd prime).
p p
• If Op n = 2 then n2 = 1 which (again) contradicts n2 = −1 (noting that p is an odd prime).
So, we must have Op n = 4. Now, from Problem 3 of § 1.3 (noting that p and n must be coprime since
p
n2 + 1 = 0) we must have 4|φ(p), i.e. 4|(p − 1) and hence p must be of the form 4k + 1, i.e. p cannot
be of the form 4k − 1 (see Problem 16 of § 2.2 of V1).
15 DIVISIBILITY 158

p2 −1
28. Show that 24 is an integer for all p ≥ 5 (where p ∈ P).
2
Solution: This is because for p ≥ 5 we have p 24 −1
≥ 1. Moreover:
• One of (p − 1) and (p + 1) must be divisible by 3 because (p − 1), p, (p + 1) are three consecutive
integers and p is not divisible by 3 because p ≥ 5. Now, p2 − 1 = (p − 1)(p + 1) and hence p2 − 1 must
be divisible by 3.
• (p − 1) and (p + 1) are consecutive even numbers and hence one of them must be divisible by 2 and the
other is divisible by 4 (i.e. one of them is a multiple of 2 and the other is a multiple of 4). Therefore,
their product (which is equal to p2 − 1) must be divisible by 8.
Thus, p2 − 1 is divisible by 3 and by 8 and hence it must be divisible by 24 (noting that 3 and 8 are
2
coprime), i.e. p 24−1
is an integer for all p ≥ 5.
29. Show the following:
(a) p divides the sum of its quadratic residues (where p is a prime ≥ 5).
(b) p divides the sum of the squares of its quadratic non-residues (where p is a prime ≥ 7).
Solution: 2
(a) According to Problem 2 of § 1.6, the (p − 1)/2 quadratic residues of p are: 12 , 22 , . . . , p−1
2 . Hence,
their sum is (see Eq. 16 in V1):
(p−1)/2     
X p−1 p−1
+1 2× p−1
+1 p3 − p p2 − 1
2 2 2 2
k = = =p
6 24 24
k=1

p2 −1
which is divisible by p ≥ 5 (noting that is an integer for p ≥ 5; see Problem 28).
24
2
It is worth noting that although this proof is specific to the integers 12 , 22 , . . . , p−1
2 the given propo-
sition should also apply to their residue classes (mod p) since the integers in any class differ from each
other by integer multiples of p and hence the sum of quadratic residues (represented by any integer in
their classes) should be the same as above plus an algebraic sum of integer multiples of p and hence the
sum remains divisible by p.
(b) Let S symbolize the sum of the squares of the quadratic non-residues of p and let r be a primitive
root of p (see point 5 in the preamble of § 1.4). Now, since the quadratic non-residues of p are the odd
powers of r (see Problem 7 of § 1.6) then we have:
(p−1)/2 (p−1)/2 (p−1)/2 (p+1)/2
X 2 X X X
S= r2k−1 = r4k−2 → r4 S = r4k+2 = r4k−2
k=1 k=1 k=1 k=2

Now, if we subtract S from r4 S we get:


   
(p+1)/2 (p−1)/2
X X p
r4 S −S =  r4k−2  −  r4k−2  = r2p −r2 = (rp −r)(rp +r) → r4 S −S = 0
k=2 k=1

p p
where the last step is because rp − r = 0 by Fermat’s little theorem. Accordingly, S(r4 − 1) = 0 which
p p p p
implies that S = 0 or (r4 − 1) = 0. However, for p ≥ 7 we have r4 − 1 6= 0 (i.e. r4 6= 1) because r is a
p p
primitive root of p and hence its order is (p − 1), i.e. r4 6= 1. So, we must have S = 0, i.e. p divides the
sum of the squares of its quadratic non-residues.
Finally, we should add a note similar to the note in the end of part (a), i.e. r and its powers represent
residue classes and hence the proof is general. We should also note that part (a) can also be proved
in a similar way to the proof of part (b), but we preferred (for the sake of diversity) to use a different
approach.
Chapter 16
Sequences and Series
1. Find all the integer terms of the following sequences (where n = 1, 2, 3, . . .):
3n3 −5n2 +11n+7 n4 +2n3 −5n−3 2n5 +3n3 +14n2 +21
(a) an = 2n2 +2n−3 . (b) an = n2 +n+12 . (c) an = 2n2 +3 .
2 Pn k2 +2k−3
(d) an = 13−7n
2n−17 . (e) an = k=1 5 .
Solution:
(a) We have:  
3n3 − 5n2 + 11n + 7 1 47n − 10
2
= 3n − 8 +
2n + 2n − 3 2 2n2 + 2n − 3
Now, |47n − 10| ≥ |2n2 + 2n − 3| only for n = 1, 2, . . . , 22. On inspecting these 22 terms we find only
a1 is an integer. Hence, only a1 of this sequence is an integer.
(b) We have:
n4 + 2n3 − 5n − 3 153 − 4n
2
= n2 + n − 13 + 2
n + n + 12 n + n + 12
Now, |153 − 4n| ≥ |n2 + n + 12| only for n = 1, 2, . . . , 9. On inspecting these 9 terms we find none of
these terms is an integer. Hence, this sequence has no integer term.
(c) We have:
2n5 + 3n3 + 14n2 + 21 (2n2 + 3)(n3 + 7)
= = n3 + 7
2n2 + 3 2n2 + 3
Hence, all the terms of this sequence are integers.
(d) We have:  
13 − 7n2 1 1971
= −14n − 119 −
2n − 17 4 2n − 17
Now, if an should be an integer then (as a necessary but not sufficient condition) 2n − 17 must divide
1971, i.e. 2n − 17 must be equal to the divisors of 1971 which are 1, 3, 9, 27, 73, 219, 657, 1971 and their
negatives. Considering all these divisors we find that only the following values of n ∈ N make 2n − 17
a divisor of 1971 and an an integer: n = 4, 7, 8, 9, 10, 13, 22, 45, 118, 337, 994. So, only the terms of the
sequence with these values of n are integers.
(e) We have (see Eqs. 15 and 16 of V1):
n
" n ! n
! n
!#
X k 2 + 2k − 3 1 X X X
2
= k + 2 k − 3
5 5
k=1 k=1 k=1 k=1
  
1 n(n + 1)(2n + 1) n(n + 1)
= +2 − 3n
5 6 2
 3 
1 2n + 9n2 − 11n 2n3 + 9n2 − 11n
= =
5 6 30
30 5
Now, the solutions of 2n3 + 9n2 − 11n = 0 are n = 0, 1, 2. Hence, the integer terms of this sequence are
an=0,1,2
5 (i.e. a1 , a2 , a5 , a6 , a7 , a10 , a11 , a12 , a15 , a16 , a17 , . . .).
P23
2. Find all s ∈ Z that make the series k=1 (s + k)3 a natural power of 23.
Solution: We have:
23 23 23
! 23
! 23
! 23
!
X X  X X X X
3 3 2 2 3 3 2 2 3
(s + k) = s + 3s k + 3sk + k = s + 3s k + 3sk + k
k=1 k=1 k=1 k=1 k=1 k=1

159
16 SEQUENCES AND SERIES 160

23
! 23
! 23
! 23
!
X X X X
= s3 1 + 3s2 k + 3s k2 + k3
k=1 k=1 k=1 k=1
     
3 2 23(23 + 1) 23(23 + 1)(2 × 23 + 1) 232 (23 + 1)2
= 23s + 3s + 3s +
2 6 4
= 23s3 + 828s2 + 12972s + 76176 = 23(s3 + 36s2 + 564s + 3312)
Now, the series is supposed to be a natural power of 23 and hence:
23(s3 + 36s2 + 564s + 3312) = 23m → s3 + 36s2 + 564s + 3312 = 23m−1 (m ∈ N)
3 2
Now, for m = 1 we have s + 36s + 564s + 3312 = 1 which has no (integer) solution.
For m > 1, (s3 + 36s2 + 564s + 3312) = (s + 12)(s2 + 24s + 276) = 23m−1 and hence we have 3 cases:
• s + 12 = ±1 and 23|(s2 + 24s + 276). However, these conditions are incompatible because s = −13
and s = −11 do no make (s2 + 24s + 276) divisible by 23.
• s2 + 24s + 276 = ±1 and 23|(s + 12). However, s2 + 24s + 276 = ±1 has no (integer) solution.
23 23
• 23|(s + 12) and 23|(s2 + 24s + 276). However, the solution of s + 12 = 0 is s = 11 while the solutions
23 23
of s2 + 24s + 276 = 0 are s = 0, 22 which are incompatible.
P23
So in brief, there is no s ∈ Z that makes the series k=1 (s + k)3 a natural power of 23.
3. Find all the integer terms of the following sequences (where n = 1, 2, 3, . . .):
√ √ √
(a) an = 64n6 + 16n3 + 1. (b) an = 4n2 − 24n + 41. (c) an+1 = an + 2an − 1 (a1 = 1).
Solution:
(a) We have:
p p p
64n6 + 16n3 + 1 = (23 n3 )2 + 2(23 n3 ) + 1 = (8n3 + 1)2 = 8n3 + 1
So, all the terms of this sequence are integers.
(b) We have:
p p p p
4n2 − 24n + 41 = 4n2 − 24n + 36 + 5 = (2n − 6)2 + 5 = N 2 + 5

Now, if 4n2 − 24n + 41 is to be an integer then N 2 + 5 must be a perfect square, i.e. N 2 + 5 = m2
(where m ∈ Z), i.e.
m2 − N 2 = 5 → (m − N )(m + N ) = (−1)(−5) = (−5)(−1) = (1)(5) = (5)(1)
On solving these 4 systems of equations we get (respectively): N = −2, 2, 2, −2 and hence n = 2, 4, 4, 2.
So, only a2 and a4 are integers.
(c) We note first that this sequence is strictly increasingp(so its terms are pairwise distinct) and all its
terms are positive. We have a1 = 1 and hence a2 = 1 + 2(1) − 1 = 2. So, the first two terms of this
sequence are integers. Now, we show that it is impossible for the other terms of this sequence to be
integers. For the (n + 1)st term (n ≥ 2) to be an integer we must have an ∈ N and 2an − 1 = m2 (where
m ∈ N), i.e.
m2 + 1 (2x + 1)2 + 1
an = = (x ∈ N0 ) (39)
2 2
where the second equality is justified because m must be odd (since an is supposedly an integer). Now,
the difference d between any two consecutive terms of the sequence according to Eq. 39 should be at
least:
2 2
(2x + 3) + 1 (2x + 1) + 1
d= − = 4x + 4
2 2
However, according to the sequence form (combined with the condition of oddity) the actual difference
between two consecutive terms of the sequence is:
r
√ (2x + 1)2 + 1 p
an+1 − an = 2an − 1 = 2 − 1 = (2x + 1)2 = 2x + 1
2
16 SEQUENCES AND SERIES 161

This difference is much smaller than d and hence these conditions are incompatible which means that
no term (other than a1 and a2 ) can be an integer. So, only a1 and a2 of this sequence are integers.
4. Find all n ∈ N such that:
Pn Pn
(a) k=1 (k 3 + 1) is divisible by 47. (b) k=1 (2k − 1)3 is divisible by 13.
Pn
(c) k=1 (11k − 1) is divisible by 6.
Solution:
(a) We have (see Eq. 17 of V1):
n n
! n
!
X X X n2 (n + 1)2 n4 + 2n3 + n2 + 4n
3 3
(k + 1) = k + 1 = +n=
4 4
k=1 k=1 k=1

So, if the given series is divisible by 47 then (n4 + 2n3 + n2 + 4n) must be divisible by 47 (noting that
47 47
4 and 47 are coprime), i.e. n4 + 2n3 + n2 + 4n = 0. The solution to this congruence equation is n = 0
(see § 8.2). So, the given series isP divisible by 47 iff n = 47m where m ∈ N.
n
(b) From Eq. 20 of V1 we have k=1 (2k − 1)3 = n2 (2n2 − 1). Now, if 13 divides this series then 13
must divide n2 (and hence divide n) or 13 must divide (2n2 − 1). However, 13 does not divide (2n2 − 1)
13
because 2n2 − 1 = 0 has no solution. Therefore, if 13 divides this series then 13 must divide n. So, this
series is divisible by 13 for all n = 13m where m ∈ N.
6
(c) By Euler’s theorem (with the power rule for congruence) we have 112m − 1 = 0 where m ∈ N. This
P2m 6 P2m−1
means that all even terms of the series are 0 (mod 6) and hence k=1 (11k − 1) = k=1 (11k − 1), i.e
the sum of the first 2m terms is the same (mod 6) as the sum of the first 2m − 1 terms. Accordingly:
2
X 1
X
6 6
(11k − 1) = (11k − 1) = 4
k=1 k=1
4
X 3
X
6 6
(11k − 1) = (11k − 1) = 2
k=1 k=1
6
X 5
X
6 6
(11k − 1) = (11k − 1) = 0
k=1 k=1

As the last entry is 0 (mod 6), this cycle repeats itself and hence the given series is divisible by 6 for
all n = 5 + 6s and n =P6(1 + s) where s ∈ N0 .[97]
m
5. Show that the series k=1 n4k is divisible by 4 where nk are odd natural numbers and m is a natural
multiple of 4 (i.e. m = 4, 8, 12, . . .).
Solution: We have (where s ∈ N0 ):
4
n4k = (2s + 1)4 = 16s4 + 32s3 + 24s2 + 8s + 1 = 1

Hence:
m
X m
X
4
n4k = 1 = m
k=1 k=1
Pm
Now, since m is a natural multiple of 4, it is divisible by 4 and hence the series k=1 n4k is divisible by
4.
[97] We note that:
7
X 6 6 6
(11k − 1) = 117 − 1 = 11 − 1 = 4
k=1
6
where step 1 is because 6k=1 (11k − 1) is 0 (mod 6), and step 2 is because 116 = 1 according to Euler’s theorem (with the
P
power rule for congruence). So, this should fully explain our claim that this cycle repeats itself (i.e. every 6 consecutive
integers).
16 SEQUENCES AND SERIES 162

6. Show that the following series cannot be an integer for any value of n ∈ N:
n
X k
(−1)k+1
k+1
k=1

Solution: This series cannot be an integer because for any n ∈ N its magnitude  is less than 1 and
n
greater than 0.[98] This is because if we start from the last term in the series i.e. (−1)n+1 n+1 then
it is obviouslyless than 1 and  greater than 0 in magnitude. Now, when we add to the last term its
previous term i.e. (−1)n n−1 n which is opposite in sign and smaller in magnitude, the magnitude of the
n
sum becomes less than the magnitude of (−1)n+1 n+1 but greater than 0. Now, if we add the next term
 n−1 n−2
 
i.e. (−1) the magnitude will restore some of its lost value which it lost when we added the

n−1
term (−1)n n−1n but it cannot compensate all the loss and restore its original value (let alone exceeding
it) and hence it remains less than 1 and greater than 0. This applies all over the series as we move
backwards by adding the previous terms successively until we reach the first term. So, the magnitude
of this series keeps oscillating (along its terms) but it remains always less than 1 and greater than 0
and hence the series cannot be an integer for any n ∈ N. The plot of Figure 5 should provide more
clarification and illustration to this argument.

0.8

0.6

0.4

0.2

0
0 5 10 15 20
-0.2

-0.4

Figure 5: The plot of Problem 6 of § 16. The vertical axis represents the sum as a function of n (which
is represented on the horizontal axis).

7. Give examples of natural numbers (greater than 1) which are coprime to all the terms of the following
infinite sequences (where n ∈ N):
(a) an = 3n + 5n + 7n . (b) bn = 17n − 11n + 13n − 1. (c) cn = n3 − 3n2 + 1.
Solution: The idea of this type of problems is simple, that is: we look for a prime number[99] which
p
cannot divide any term of the given sequence, e.g. a prime p such that 3n + 5n + 7n 6= 0 for any n ∈ N.
2
(a) The obvious example is p = 2 because all the terms of this sequence are odd and hence an 6= 0 for
p
any n ∈ N. Other examples are p = 7 and p = 17 because an 6= 0 for any one of these primes and for
any n ∈ N.[100]
p
(b) Two examples are p = 11 and p = 13 because bn 6= 0 for any one of these primes and for any

[98] We note that for small n (e.g. n = 1, 2, 3) the proposition is obviously true. Hence, the focus in the following argument
is on large n where the series consists of many terms.
[99] Choosing “prime number” is just to make the problem easier to solve and avoid unnecessary complications.

[100] For 7 6 17
p = 7 we have an = 1, 6, 5, 6, 1, 2 corresponding to n = 1, 2, 3, 4, 5, 6 while for p = 17 we have an =
16
15, 15, 2, 13, 13, 9, 16, 14, 2, 2, 15, 4, 4, 8, 1, 3 corresponding to n = 1, 2, . . . , 16.
16 SEQUENCES AND SERIES 163

n ∈ N.[101]
p
(c) Some examples are p = 2, 5, 7, 11, 13 because cn 6= 0 for any one of these primes and for any
n ∈ N.[102]
8. Give examples of natural numbers which are coprime to none of the terms of the following infinite
sequences (where n ∈ N):
(a) an = n3 + 5n + 6. (b) bn = n5 + 24n + 15. (c) cn = n9 − n. (d) dn = 7n − 4n .
Solution: The easiest way to solve this type of problems is to look for a small prime p that makes the
p
congruence of the sequence identically zero (mod p), e.g. an = 0 for all n ∈ N. Thus, any n which is a
natural multiple of p will then be coprime to none of the terms of the sequence.
3
(a) an = 0 for all n ∈ N and hence any multiple of 3 is coprime to none of the terms of this sequence.
5
(b) bn = 0 for all n ∈ N and hence any multiple of 5 is coprime to none of the terms of this sequence.
2 3 5
(c) cn = 0, cn = 0 and cn = 0 for all n ∈ N and hence any multiple of 2 or 3 or 5 is coprime to none of
the terms of this sequence.
3 3
(d) dn = 0 for all n ∈ N (noting that 7n − 4n = 1n − 1n = 0) and hence any multiple of 3 is coprime to
none of the terms of this sequence.
9. Derive lower and upper bounds on the following series in terms of n:
Pn k
Pn √
(a) k=1 k+1 . (b) k=1 k.
Solution:
(a) x/(x + 1) is an increasing function and hence:
ˆ k ˆ k+1
x k x
dx < < dx
k−1 x + 1 k + 1 k x + 1
h ik k h ik+1
x − ln(x + 1) < < x − ln(x + 1)
k−1 k+1 k

Now, if we sum from k = 1 to k = n we get:


n h
! ! !
X ik n
X k
n h
X ik+1
x − ln(x + 1) < < x − ln(x + 1)
k−1 k+1 k
k=1 k=1 k=1
!
h in Xn
k h in+1
x − ln(x + 1) < < x − ln(x + 1)
0 k+1 1
k=1
!
h i Xn
k h i
n − ln(n + 1) < < n − ln(n + 2) + ln(2)
k+1
k=1

(b) x is an increasing function and hence:
ˆ k √ √ ˆ k+1 √
k dx < k < k dx
k−1 k
 k  k+1
x3/2 √ x3/2
< k <
3/2 k−1 3/2 k

Now, if we sum from k = 1 to k = n we get:


n  3/2 k
! n √
! n  3/2 k+1
!
X x X X x
< k <
3/2 k−1 3/2 k
k=1 k=1 k=1

[101] For 11 10 13
p = 11 we have bn = 7, 6, 3, 2, 8, 2, 3, 6, 7, 1 corresponding to n = 1, 2, . . . , 10 while for p = 13 we have bn =
12
5, 11, 6, 5, 2, 1, 1, 6, 3, 11, 3, 12 corresponding to n = 1, 2, . . . , 12.
[102] The p
congruence equation n3 − 3n2 + 1 = 0 has no solution for p = 2, 5, 7, 11, 13 (see § 8.2).
16 SEQUENCES AND SERIES 164

 n n √
!  n+1
x3/2 X x3/2
< k <
3/2 0 3/2 1
k=1
 3/2  n √
!  
n X (n + 1)3/2 − 1
< k <
3/2 3/2
k=1

10. Find the integer part of the following series as a function of n:


Pn 
9 k
Pn 1 Pn Pn
(a) k=0 10 . (b) k=0 k! . (c) k=1 k12 . (d) k=0 m1k (N ∋ m > 1).
Solution:  −1
(a) This is a geometric series with a = 1 and r = 9/10 and hence it converges to 1 − (9/10) = 10
(see Eq. 22 in V1). So, all we need to do is to determine the values of n at which the series steps from
one integer level to the next between 1 and 9. Now, we have (see Eq. 22 in V1):
n 
X k
9 1 − (9/10)n+1  
= = 10 1 − (9/10)n+1
10 1 − (9/10)
k=0
 
On equating 10 1 − (9/10)n+1 to 1, 2, . . . , 9 and solving for n we find that the integer part is:[103]
1 (n = 0, 1) 2 (n = 2) 3 (n = 3) 4 (n = 4, 5) 5 (n = 6, 7)
6 (n = 8, 9, 10) 7 (n = 11, . . . , 14) 8 (n = 15, . . . , 20) 9 (n = 21, . . .) 10 (at ∞)
(b) This series converges to e (≃ 2.718) and hence its integer part can only be 1 or 2. Now, we have
P0 1
P1 1
k=0 k! = 1 and k=0 k! = 2 and hence the integer part of this series is 1 for n = 0 and 2 for
n = 1, 2, . . . (to ∞).
(c) This series converges to π 2 /6 (≃ 1.645) and hence its integer part is always 1 (i.e. for n = 1, 2, . . .).
m
(d) This series converges to m−1 and hence its integer part is always 1 (i.e. for n = 0, 1, 2, . . .).
11. Find the integer part of the following:
P104 n P104 P104 √ P106 n
(a) n=0 − 1001 1000 . (b) n=0 √n+1+ 1 √
n
. (c) n=1 20 n. (d) n=1 n+1 .
Solution:
(a) We have:

10 
X
4 n 5000
X  1001 2n 4999
X  1001 2n+1 5000
X  1001 2n 4999
X  1001 2n+1
1001
− = − + − = − ≡ A−B
n=0
1000 n=0
1000 n=0
1000 n=0
1000 n=0
1000

Now, A is a geometric series with a = 1 and r = (1001/1000)2 while B is a geometric series with
a = (1001/1000) and r = (1001/1000)2 . Hence (see Eq. 22 in V1):
 
1 − (1001/1000)10002 1001 1 − (1001/1000)10000
A= ≃ 10974281.17 B= ≃ 10963316.85
1 − (1001/1000)2 1000 1 − (1001/1000)2
So, A − B ≃ 10964.32 and hence the integer part of the given sum is 10964.
(b) We have:

10 4
104 √ √ 104
X 1 X n+1− n X √ √
√ √ = = ( n + 1 − n)
n=0
n+1+ n n=0
n + 1 − n n=0
√ √ √ √ √ √ √ √
= ( 1 − 0) + ( 2 − 1) + · · · + ( 10000 − 9999) + ( 10001 − 10000)
[103] For example: 10 1 − (9/10)n+1 = 5 leads to
 

log(1/2)
n+1= ≃ 6.58
log(9/10)
and hence the series steps up from the 4 integer level to the 5 integer level at n = 6.
16 SEQUENCES AND SERIES 165

√ √ √
= − 0 + 10001 = 10001 ≃ 100.005

Hence,
√ the integer part of the given sum is 100.
(c) 20 x is an increasing function and hence:
ˆ n √ √
ˆ n+1 √
20 20 20
x dx < n < x dx
n−1 n
 n  n+1
x21/20 √
20
x21/20
< n <
21/20 n−1 21/20 n

Now, if we sum from n = 1 to n = 104 we get:


 4   4   4 
10  21/20 n
X 10
X X10  21/20 n+1
x √ x
  <  20
n <  
n=1
21/20 n−1 n=1 n=1
21/20 n
 4 
 21/20 10000 10
X  10001
x 

20  x21/20
< n <
21/20 0 n=1
21/20 1
 4 
10
X √
15094.22 <  20
n < 15094.85
n=1

Hence, the integer part of the given sum is 15094.


(d) From part (a) of Problem 9 we have:
 6 
h i 10
X n h i
106 − ln(106 + 1) <   < 106 − ln(106 + 2) + ln(2)
n=1
n+1
 6 
10
X n
999986.18 <   < 999986.88
n=1
n + 1

Hence, the integer part of the given sum is 999986.


12. Find the solutions of the following congruence series equations (where x ∈ N and 3 < p ∈ P):
Pp−3 p Pp−3 p Pp−3 p
(a) k=0 xk = 0. (b) k=0 xk = −1. (c) k=0 xk = 1.
Solution:
p p
(a) If x = 0 then there is no solution (because 1 6= 0).
p p
If x = 1 then there is no solution (because p − 2 6= 0).
p
If x 6= 0, 1 then we have:
Pp−3 k p Pp−2 p xp−1 −1 p
k=0 x = 0 → k=0 xk = xp−2 → x−1 = xp−2 →
p p
xp−1 − 1 = xp−2 (x − 1) → xp−2 (x − 1) = 0
where in step 1 we added xp−2 to both sides, in step 2 we used the geometric series formula, in step
3 we multiplied both side by x − 1, and in step 4 we used Fermat’s little theorem. So, from the last
p p p
congruence equation we must have: x = 0 or x = 1 which are not acceptable (because x 6= 0, 1).
Hence, there is no solution to the given congruence series equation.
p p
(b) If x = 0 then there is no solution (because 1 6= −1).
p p
If x = 1 then there is no solution (because p − 2 6= −1).
16 SEQUENCES AND SERIES 166

p
If x 6= 0, 1 then we have:
Pp−3 k p Pp−2 p xp−1 −1 p
k=0 x = −1 → k=0 xk = xp−2 − 1 → x−1 = xp−2 − 1 →
p p p
xp−1 − 1 = (x − 1)(xp−2 − 1) → xp−1 − xp−2 − x + 1 = 0 → xp−2 + x = 2
where the steps are justified as in part (a). However, the only solution[104] to the last congruence equa-
p p
tion is x = 1 which is not acceptable (because x 6= 0, 1).
Hence, there is no solution to the given congruence series equation.
p p
(c) If x = 0 then we have a solution (because 1 = 1).
p p
If x = 1 then there is no solution (because p − 2 6= 1).
p
If x 6= 0, 1 then we have:
Pp−3 k p Pp−2 p xp−1 −1 p
k=0 x = 1 → k=0 xk = xp−2 + 1 → x−1 = xp−2 + 1 →
p p p
xp−1 − 1 = (x − 1)(xp−2 + 1) → xp−1 − 1 = xp−1 + x − xp−2 − 1 → xp−2 − x = 0 →
p
x(xp−3 − 1) = 0
p p
So, we must have x = 0 (which is not acceptable because x 6= 0, 1 although this solution was obtained
p p p p
already) or x = 1 (which is not acceptable because x 6= 0, 1) or x = −1, i.e. x = p − 1 (which is
acceptable).
p p
Hence, there are two solutions to the given congruence series
Pk equation: x = 0 and x = p − 1.
2 2
13. Find all m, n, k ∈ N such that (2m − 1) + (2n − 1) = s=1 (2s − 1).
Solution: According to the formula of arithmetic series we have:
k
X k (1 + 2k − 1)
(2s − 1) = = k2
s=1
2

Now, if we remember that no perfect square can be the sum of two odd squares (see Problem 17 of §
4) then we can conclude that there are no m, n, k ∈ N that satisfy the given series equation.

[104] This is because:


p p p p p
xp−2 + x = 2 → xp−1 + x2 = 2x → 1 + x2 = 2x → x2 − 2x + 1 = 0 → (x − 1)2 = 0
Chapter 17
Cryptography
1. In this introductory Problem of this chapter we briefly investigate one of the most common applications
of number theory in real life which is in cryptography. The most famous and widely used method of
cryptography is allegedly the RSA public key system and this is what we will investigate here. This
method is based on modular arithmetic with the use of very large prime numbers which makes cracking
the code (during the time in which the secrecy of the message is important) practically impossible
(or supposedly so) due to the difficulty of factoring very large numbers. The basic idea of public key
cryptography (and notably RSA) is rather simple although the technical details are rather messy. In
brief, although the encoding method (i.e. the information and processes required to do the encryption)
in this encryption method is public (and hence encoding can be done by anyone and notably the sender),
the decoding method is secret because it depends on a piece of information available only to the receiver
of the message (i.e. the one who is intended to be informed by the content of the message).
So, let us first define our symbols and explain the main concepts used in the RSA encryption system:
• p and q are very large prime numbers.
• n is the product of p and q, i.e. n = pq.[105]
• φ is the totient of n which is the product of (p − 1) and (q − 1), i.e. φ = (p − 1)(q − 1).
• r is the encryption exponent which is a natural number that is coprime to φ and 1 < r < φ.
φ
• ρ is the decryption exponent which is the modular multiplicative inverse of r (modulo φ), i.e. rρ = 1.
• m is the message text (represented numerically by integers) where m is coprime to p and q.
• c is the cipher text (represented numerically by integers).
• k is the public key (i.e. known to everyone or supposedly so)[106] which is used to encrypt the message
text m. The public key is the pair (n, r), i.e. k = (n, r).
• κ is the private key (i.e. known only to the receiver of the message) which is used to decrypt the
cipher text c. The private key is the pair (n, ρ), i.e. κ = (n, ρ).
• f is the encoding function which takes m and encrypt it (i.e. convert it to c) with the help of k.
Accordingly, we have c = f (m, k) where:
n
f (m, k) = mr (40)

• f −1 is the decoding function which takes c and decrypt it (i.e. convert it to m) with the help of κ.
Accordingly, we have m = f −1 (c, κ) where:
n
f −1 (c, κ) = cρ (41)

• S is the sender of the message who uses the publicly available information (i.e. k and f ) to encode
m and convert it to c.
• R is the receiver of the message who uses the private information (i.e. p and q and hence κ) to decode
c and hence retrieve m.
So, the idea is that any one (i.e. S) can use the publicly available information (i.e. k and f ) to
encode his message and send it to the receiver (i.e. R). However, the receiver is the only one who can
(practically) decode the encrypted message (because he is the only one in possession of the private key).
The security of this method of encryption originates from the fact that those who use this method to
[105] It is worth noting that the level of security of encryption increases with increasing the size of p and q (since this makes
the factorization of n harder).
[106] In reality, the secrecy of the public key should increase the security of encryption and hence it adds another layer of

security to the process of encryption.

167
17 CRYPTOGRAPHY 168

communicate (i.e. the sender and receiver of encrypted messages) do not need to share any common
secret since the required secret (i.e. the private key) is held by only one (i.e. the receiver).
Now, we need to substantiate our claim that the decoding function f −1 actually decodes the encrypted
message (i.e. c) and hence it retrieves the original message (i.e. m). This is shown in the following
(which essentially shows why the RSA encryption system should work):
n  ρ n  ρ
f −1 (c, κ) = cρ = f (m, k) = mr = mrρ (42)
φ
where we refer to Eqs. 40 and 41 (and the surrounding text) for justification. Now, from rρ = 1 we
have:
rρ = 1 + aφ = 1 + a(p − 1)(q − 1)
p q
where a ∈ Z. Moreover, mp−1 = 1 and mq−1 = 1 (from Fermat’s little theorem). Hence:
p
mp−1 = 1
 a(q−1) p
mp−1 = 1a(q−1)
a(q−1) p
m × mp−1 = m × 1a(q−1)
p
m1+a(p−1)(q−1) = m
p
mrρ = m
q pq
This similarly applies to q and hence we have: mrρ = m. Therefore, we have:[107] mrρ = m (i.e.
n
mrρ = m) and hence we can add another step to Eq. 42, that is:
n  ρ n  ρ n
f −1 (c, κ) = cρ = f (m, k) = mr = mrρ = m

This equation shows that by using f −1 we retrieved the original message text m from the cipher text
c through this modular arithmetic manipulation (with the help of the publicly and privately available
information). So, the secrecy of the encrypted message originates from the fact that the decryption of
the coded message depends on the access to the private key which is known only to the receiver R. For
any eavesdropper to decode the encrypted message he needs to know the private key κ which depends
on knowing p and q (noting that κ depends on ρ which depends on p − 1 and q − 1 since ρ depends on
φ which is the product of p − 1 and q − 1). However, knowing p and q by the eavesdropper requires
factorization of n which is practically non-viable in the available time frame because p and q (and hence
n) are very large.
Note: if we reverse the above argument we can make the public key encryption system a digital
signature system. In brief, let a private key owner encode a message m using his private key (with the
decoding function f −1 ) and he makes his message public. Now, anyone in the public can decrypt the
encoded message using the public key (with the encoding function f ) through the following process:
 
f f −1 (m, κ), k

So, whoever receives the encrypted message will know that the message comes from the owner of the
private key (i.e. it is a signed message). The justification is as follows:
n  r n  r n
f (c, k) = cr = f −1 (m, κ) = mρ = mrρ = m

The rest should be similar to the above.


2. Give a simple numeric example for an RSA encryption system that can be used to communicate en-
crypted messages.
Solution: Let have the following:
• p = 37 and q = 89 (where we use small primes for simplicity).
[107] This can be justified, for instance, by rule 14 of § 2.7 of V1 or by the Chinese remainder theorem.
17 CRYPTOGRAPHY 169

• n = pq = 3293.
• φ = (p − 1)(q − 1) = 36 × 88 = 3168.
• r = 17 (noting that 17 is coprime to 3168 and 1 < 17 < 3168).
• ρ = 17∗ (mod 3168) = 2609.
• k = (3293, 17).
• κ = (3293, 2609).
• f (m, k) is the mapping: m → c ≡ m17 (mod 3293).
• f −1 (c, κ) is the mapping: c → m ≡ c2609 (mod 3293).
So, if S encrypts the message m = 13 by using f (m, k) then he gets: c = 1317 (mod 3293) = 2607.
Accordingly, when R receives c then by using f −1 (c, κ) he gets: m = 26072609 (mod 3293) = 13 which
is the original message.
3. Create and use an RSA encryption system to encode and decode the following message using ASCII
code for conversion between text and numbers: “I WILL COME TO YOUR HOUSE TONIGHT.”.
Solution: The numeric ASCII code for the message is (where each two digits represent a single char-
acter; please refer to the ASCII code table which is available on the Internet):

73328773767632677977693284793289798582327279858369328479787371728446 (43)

We create the following RSA encryption system:


• p = 97 and q = 101.
• n = pq = 9797.
• φ = (p − 1)(q − 1) = 96 × 100 = 9600.
• r = 23 (noting that 23 is coprime to 9600 and 1 < 23 < 9600).
• ρ = 23∗ (mod 9600) = 2087.
• k = (9797, 23).
• κ = (9797, 2087).
• f (m, k) is the mapping: m → c ≡ m23 (mod 9797).
• f −1 (c, κ) is the mapping: c → m ≡ c2087 (mod 9797).
Now, let the sender S encode the numeric message of Eq. 43 as 4-digit blocks of integers (i.e. each 4-
digit block represents two characters) where in the following list c(m) represents m23 (mod 9797), that is:
c(7332) = 7940 c(8773) = 0185 c(7676) = 3434 c(3267) = 4437 c(7977) = 0351
c(6932) = 6271 c(8479) = 5155 c(3289) = 2080 c(7985) = 2741 c(8232) = 7333
c(7279) = 6087 c(8583) = 0452 c(6932) = 6271 c(8479) = 5155 c(7873) = 4650
c(7172) = 2829 c(8446) = 7743
Accordingly, S will obtain and send the following numeric message:

79400185343444370351627151552080274173336087045262715155465028297743

The receiver R then decodes this numeric message as 4-digit blocks of integers where in the following
list m(c) represents c2087 (mod 9797), that is:
m(7940) = 7332 m(0185) = 8773 m(3434) = 7676 m(4437) = 3267 m(0351) = 7977
m(6271) = 6932 m(5155) = 8479 m(2080) = 3289 m(2741) = 7985 m(7333) = 8232
m(6087) = 7279 m(0452) = 8583 m(6271) = 6932 m(5155) = 8479 m(4650) = 7873
m(2829) = 7172 m(7743) = 8446
So, R retrieves the original message in numeric format (i.e. what is in Eq. 43). He then uses ASCII
code table to convert this numeric message to a text message and hence he obtains the original message
text (i.e. I WILL COME TO YOUR HOUSE TONIGHT.).
4. Give a simple example of a digital signature system.
Solution: Let us use the encryption system of Problem 3 where R (after receiving the message “I WILL
17 CRYPTOGRAPHY 170

COME . . .”) wants to send a signed confirmation message so that anyone receives the confirmation mes-
sage (notably S) will know for sure that the confirmation message comes from R not from an intruder
or an impersonator. The confirmation message is: “I AM WAITING”. Accordingly:
• The numeric ASCII code for the confirmation
 message is 733265773287657384737871.
• On applying the mapping f −1 (m, κ) i.e. m → c ≡ m2087 (mod 9797) where in the following list
2087
c(m) represents m (mod 9797) to the ASCII confirmation message (in blocks of 4 digits) R gets:
c(7332) = 6319 c(6577) = 6929 c(3287) = 1411
c(6573) = 2194 c(8473) = 7036 c(7871) = 7509
Hence, R will send the following encrypted message: 631969291411219470367509.

• When S receives this encrypted message he applies the mapping
 f (c, k) i.e. c → m ≡ c23 (mod 9797)
where in the following list m(c) represents c23 (mod 9797) to the encrypted message (in blocks of 4
digits) and hence S gets:
m(6319) = 7332 m(6929) = 6577 m(1411) = 3287
m(2194) = 6573 m(7036) = 8473 m(7509) = 7871
i.e. 733265773287657384737871 which is the original confirmation message in ASCII code (i.e. “I AM
WAITING” in text). So, S knows for sure that this message comes from R, i.e. the confirmation
message is a signed message (where the encryption represents the signature since R is the only one who
holds the private key and hence R is the only one who can encrypt the message in this way).
Chapter 18
Number Theory and Computing
Computing is an essential tool in modern number theory. Many problems in number theory cannot be
solved without employing computational tools and methods. In fact, in many cases computing is needed
(or at least it is useful to use) even to tackle those number theory problems which are essentially of
analytical type and hence they can be solved in a purely analytical way. Accordingly, developing basic
computational knowledge and skills is a requirement for any modern number theorist.
Some number theorists may argue that we can use ready-made software packages and libraries to do
our computational business and hence we do not need to learn computing or develop computational skills.
However, this is not always true because there are always problems that cannot be tackled and solved by
ready-made software packages and libraries (assuming they are available and user friendly and etc.).[108]
Moreover, even if this is true, doing computing in number theory problems gives an insight that can be
gained neither by analytical treatment and methodology nor by using ready-made software packages and
libraries. So, practicing computing (in some shape and form) is beneficial (if not a necessity) in number
theory even to enforce the analytical knowledge and skills (let alone its obvious benefit or necessity in
certain aspects such as doing tests and checks). We should also emphasize on the special importance or
necessity of computing in research.
It is useful to take note of the following remarks about this chapter and its content:
• The purpose of this chapter is to develop some very basic skills in dealing with number theory problems
computationally. Most of the problems in this chapter that we tackle computationally are simple and
hence they do not need more than simple algorithmic ideas and simple codes. We intend to build in the
future volumes of this book on the simple ideas and techniques that we present in this chapter (and hence
extending them in depth and breadth).
• This chapter is deliberately made very short because the idea of it is to give a small sample of number
theory problems that can be tackled and solved computationally (alongside the computational codes
and solutions of these problems). In fact, many other problems in this book can be tackled and solved
computationally in a manner similar to the manner of the problems of this chapter. We encourage the
reader (who is keen to learn how to use computing in number theory) to search for similar problems (in
this book as well as outside this book) and tackle them computationally by simple algorithmic ideas and
codes (similar or different to the ideas and codes that we present in this chapter).
• All the codes that we refer to in this chapter (and in this book) are in C++ and they are available on
the Internet.[109]
• We intentionally kept the codes very basic to avoid distraction and additional computational cost (noting
that the purpose of these codes is just to outline the way of implementing the basic ideas of the algorithms
behind them).
• Artificial Intelligence (which we discussed briefly in the first volume of this book) is a specially important

[108] This is particularly true in the following cases:


• In bulk processing where we want to process a large number of data sets such as solving 1000 Diophantine equations
or solving 200 linear congruence equations by the Chinese remainder theorem.
• In dealing with eccentric and exotic problems like dealing with large numbers or large exponentials or high-order
polynomials of many variables.
As part of my regular work and activities (e.g. in research and writing) I regularly use various types of ready-made
computational tools for solving computational problems or checking their solutions. However, I always find problems
that cannot be solved by these tools and hence I need to use my computational knowledge and skills (especially in
coding) to solve or check certain problems which ready-made computational tools fail to solve. Moreover, I always
find problems which ready-made computational tools “solve” in a wrong way and hence again I need my computational
knowledge and skills to solve them correctly.
[109] They are available from my webpage on ResearchGate.

171
18.1 Simple Tools 172

computational tool that can have an impact in the future not only on the number theory problems of
computational nature but even on the analytical investigation of some number theory problems. In fact,
we expect this tool to dominate the research in certain areas of number theory in the near future. Hence,
it is important for the next generation of mathematicians to develop their knowledge and skills in this
regard. However, due to its rather complicated nature and the requirement of considerable space we do
not discuss artificial intelligence in this volume although we hope to do some investigation about it in the
future volumes.

18.1 Simple Tools


1. Write a simple code for calculating the index of integer (see § 1.5).
Solution: See IndexOfInt.cpp code.
2. Write a simple code for generating a sequence of random numbers.
Solution: See Random.cpp code. Also see Problem 12 of § 8.1.
3. Write a simple code for calculating the residue of a (large) factorial in a given modulo.
Solution: See CongLargeFactorial.cpp code.
4. Write a simple code for calculating the residue of a (large) exponential in a given modulo.
Solution: See CongLargeExponential.cpp code.

18.2 The Chinese Remainder Theorem


1. Write a simple code that reads integer entries of a system of linear congruence equations (i.e. residues
corresponding to moduli) from a file and finds (by a computational algorithm based on the rationale of
the Chinese remainder theorem) its solution.
Solution: See the CRTS folder which contains the code as well as examples of input data (and one
example of output). The idea of the algorithm is very simple, that is: to find the solution of the given
system we loop over 0 ≤ x < M p (where M p is the product of the moduli) to find the x value that
satisfies all the given congruence equations (where we use modular arithmetic to identify this value).
2. Write a simple code for mass processing of (many) systems of linear congruence equations.
Solution: See the CRTM folder which contains the code as well as an example of input file (and the
corresponding output file). This code simply loop over the given systems where it solves them one by
one by using the algorithm of Problem 1.

18.3 Congruence Equations and Systems


m
1. Find all the moduli m that satisfy the following congruence equation: 2x3 + 5x2 + 13x + 9 = 0 (where
1 < m < 100).
Solution: The solutions are: m = 3, 7, 9, 13, 17, 21, 27, 29, 31, 39, 43, 47, 49, 51, 53, 61, 63, 71, 79,
81, 83, 87, 91, 93, 97 (see the FindModPoly folder which contains the code as well as the output file).
p
2. Find all P ∋ p < 1000 such that the congruence equation x7 + y 19 = 153 has no solution.
Solution: See the FindModPolyPrimes folder which contains the code as well as the input and output
files. It is worth noting that this Problem was solved theoretically in Problem 1 of § 8.3, and hence the
computational solution in the present Problem verifies that solution.
3. Solve the following systems of mixed polynomial-exponential congruence equations (where x, y ∈ N0 ):
115 123
(a) 2x3 + 5y 2 + 8y + 1 = 0 5x + 7y = 12.
7 11
(b) x3 + y = 0 3x + 4y = 2.
Solution:
(a) Simple initial investigation should reveal that the period of the first equation (mod 115) is 115 (for
both x and y), while the x-period of 5x (mod 123) is 20 and the y-period of 7y (mod 123) is 40.[110] So,

[110] The Eq1Cycle.cpp and Eq2Cycle.cpp codes in the Codes\CongSys1\Cycle folder should help in identifying these periods.
18.3 Congruence Equations and Systems 173

115 20 460 115 40


the period of the x = and x = combination is x = while the period of the y = and y = combination
920
is y = .
Now, we can propose two simple computational approaches to solve this system:
• In this approach we find the solutions of the individual equations first (where these solutions are
found computationally by the Eq1Sol.cpp and Eq2Sol.cpp codes which are in the Codes\CongSys1\
CongSys1CRT\Sol folder). We then use the Chinese remainder theorem (or rather a computational
algorithm based on its rationale) to find the solutions of the system. In brief, for every combination of
a pair of solutions of the individual equations we loop over 0 ≤ x < 460 and over 0 ≤ y < 920 to find
the (x, y) pair whose x component is congruent (mod 115) to the x component of the first equation and
is congruent (mod 20) to the x component of the second equation and whose y component is congruent
(mod 115) to the y component of the first equation and is congruent (mod 40) to the y component of
the second equation. This (x, y) pair should be the solution of the system corresponding to that com-
bination of the pair of solutions of the individual equations. So, by looping over all the combinations of
these pairs of solutions of the individual equations[111] we will find all the solutions of the system. This
approach is implemented in CongSys1CRT.cpp code (which is in the Codes\CongSys1\CongSys1CRT
folder).
• Instead of solving these congruence equations individually and using the Chinese remainder theorem
(or an algorithm based on its rationale) to find the solutions of the system (as we did in the previous
point), we simply treat these equations as a system from the beginning and hence we just loop over
x and y to find the (x, y) pairs that satisfy the individual equations simultaneously (and hence these
pairs represent the intersection of their individual solutions in a modular sense). So, we need to loop
115 20
over 0 ≤ x < 460 (i.e. over the entire period of the x = and x = combination) and over 0 ≤ y < 920
115 40
(i.e. over the entire period of the y = and y = combination). This approach is implemented in the
CongSys1Loop.cpp code (which is in the Codes\CongSys1\CongSys1Loop folder).
Both these approaches produce the same (23) solutions which can be found in the corresponding out-
put files (see the CongSys1CRTOut.txt and CongSys1LoopOut.txt files in the aforementioned folders).
As indicated already, the codes (and all the input and output files) of both approaches are in the
Codes\CongSys1 folder.
(b) This system was solved theoretically (or analytically) in Problem 4 of § 9.3.2. If we follow the
approaches of part (a) then we find the same solutions. The codes (and all the input and output files)
of both approaches are in the Codes\CongSys2 folder.

[111] Wehave 115 solutions for the first equation and 10 solutions for the second equation and hence we have 1150 combina-
tions.
Index
Absolute value, 4, 43, 96, 143 Divisibility, 28, 29, 34, 149, 152, 157
Abundant number, 125, 126 check (test), 57, 93
Algebra, 85 Divisor function, 5, 38, 125, 128
Algebraic manipulation, 11, 55, 86
Alternating sum, 103 Eavesdropper, 168
Arithmetic Elementary number theory, 1, 130
function, 24, 128 Elimination (for solving systems of equations), 86
mean, 100 Encoded message, 168
series, 23, 28, 35, 166 Encoding, 167, 168
Artificial intelligence, 172 function, 167, 168
ASCII (alphanumeric code), 169, 170 method, 167
Encrypted message, 167, 168, 170
Bezout theorem, 46, 140, 141 Encryption, 167, 170
Binomial exponent, 167
coefficient, 4, 42 method, 167
theorem, 34, 35, 145 system, 167–169
Bounding inequalities, 95 Euclid formula, 64
Euler
C++ (language, codes), 1, 171 criterion, 27–30, 101
Calculus, 96, 100 function, 5
Ceiling, 4, 135 theorem, 14, 16, 17, 22, 131, 153, 154, 161
Chinese remainder theorem, 36, 54, 112–117, 119, 121, 123, Even perfect number, 5
130, 132, 153, 156, 157, 168, 171–173 Exponential
Cipher text, 167, 168 congruence equation, 102, 106, 108, 110, 113, 115, 117,
Coding, 94–96, 171 121
Combination (of sets), 4 Diophantine equation, 69
Combinatorics argument, 40
Comparison (for solving systems of equations), 85, 86 Factorial, 4, 29, 41, 82, 95–98, 109, 147, 172
Complete residue system, 5, 104 Factorial power, 4
Completely multiplicative function, 24, 128 Fermat
Complex number, 4 last theorem, 58, 61, 94, 133
Composite number, 22, 35, 43–49, 56, 125–127, 143 little theorem, 16, 19, 23, 28, 48, 104, 107, 131, 132,
Composity check (test), 56, 93 151, 154, 155, 158, 165, 168
Computer code, 1, 41, 103, 137 number, 4, 48
Computing, 1, 103, 171 Floor, 4, 135
Conditional statement, 37 Fraction part, 6–8
Congruence equation, 101–104
Conjecture, 48, 49, 127 GCD, 140–144
Continued fraction, 4, 6–8, 11, 12, 58 Generating function, 40
ladder, 7, 11, 12, 58 Geometric
symbol, 4 mean, 100
technique, 11 series, 164, 165
Contradiction, 13, 17, 18, 48, 49, 51, 59, 64, 73, 81, 104, 132, Goldbach conjecture, 49
140 Graph, 88, 91, 92, 94, 96
Contraposition, 32, 34, 43, 126, 132 Greatest common divisor, 4, 140, 141
Converse (of conditional statement), 22, 32, 34, 85 Group, 13, 16
Coprimality, 20, 22, 32, 33, 48, 115, 123 theory, 13
Coprime, 44, 46, 49
Cryptography, 1, 167 Index of integer, 4, 19, 106, 156, 172
Induction, 97, 98
Decoding, 167, 168 Inequality, 52, 53, 90, 95–100, 135–137, 139
function, 167, 168 Integer number, 4, 5
method, 167 Integer part, 6, 7, 164, 165
Decryption, 167, 168 Internet, 169, 171
exponent, 167 Irrational number, 7, 76, 81
Digital signature system, 168, 169
Diophantine equation, 55–57 Jacobi symbol, 4, 27, 31–34, 36, 103
Discriminant (of quadratic polynomial), 5, 13, 46, 60, 67,
102, 106 Lagrange polynomial roots theorem, 20, 104, 132
Dividend, 28, 29 Last digit, 49, 58, 145, 147, 148

174
LCE theorem, 23, 102, 104 Pell equation, 10–13, 57, 58, 95
LCM, 140–144 Perfect number, 5, 43, 125–127
Least common multiple, 4, 105 Permutation, 5, 42, 67, 99, 152
Legendre symbol, 4, 23–28, 30–34, 103, 106, 107 phi function, 5
Lehmer totient Polynomial
conjecture, 127 congruence equation, 105, 109, 113–115, 120, 132
problem, 127 Diophantine equation, 56, 57, 69
Linear Polynomial-exponential congruence equation, 113, 116, 118,
algebra, 85, 86 122, 172
combination, 142 Polynomial-exponential Diophantine equation, 73
congruence equation, 102, 112, 114, 116–122, 130, 171, Power rule (for congruence), 101, 154, 161
172 Primality, 44
Logarithms, 19, 41 check (test), 56, 93
Prime
Magnitude check (test), 56, 86 factorization, 35, 41, 56, 101, 127, 133, 152, 155, 157
Mersenne number, 5, 44–46
number, 48, 49 Primitive
prime, 4, 48, 49 Pythagorean triple, 64, 67
Message text, 167–169 root, 4, 15–20, 22, 30, 102, 104, 108, 156, 158
Minimal solution, 10 Private key, 167, 168, 170
Mobius Programming, 96
function, 5, 37, 128, 129 Proof by example, 34
inversion, 37 Public
inversion formula, 38 key, 167, 168
Modular key cryptography, 167
arithmetic, 23, 25, 57, 94, 101–103, 112, 147, 167, 168, key encryption system, 167, 168
172 Pythagorean triple, 62, 64, 67, 69, 95
multiplication, 16
multiplicative inverse, 4, 15, 17–19, 27, 167 Quadratic
multiplicative inversion, 15 congruence equation, 27, 36, 103, 106, 132
Modularity, 26, 31 congruence theorem, 23, 28
check (test), 57, 86 non-residue, 20–23
inconsistency, 86 reciprocity, 30–32
inspection, 57 residue, 20–23
Modulo, 4
Modulus, 4 Random number, 103, 172
Multinomial coefficient, 4, 42 Rational
Multiplicative fraction, 6–12, 58
function, 24, 128 fraction approximation, 7–12, 58
group, 13 number, 5, 7, 8, 76, 81, 153
order, 13 Real number, 5, 6, 135, 139
Multiplicativity, 125 Receiver (of message), 167–169
Multivariate Reduced residue system, 5, 15–17
equation (or system of equations), 85, 90, 109, 116, 123 Relatively prime, 15, 124
inequality, 96, 99 Remainder, 153–156
Residue class, 24, 104, 109, 112, 149, 158
Natural number, 4 Restricted divisor function, 5
Negation, 4 RSA (public key encryption system), 167–169
Non-linear congruence equation, 115, 116 Rules of
Non-primitive Pythagorean triple, 67 cardinality of sets, 125
Number theory, 1, 6, 40, 55, 85, 96, 105, 130, 167, 171, 172 gcd, 49, 141, 142
Numeric libraries, 171 indices, 19
Legendre symbol, 25
Open problem, 127 logarithms, 19, 41
Order of integer, 5, 13
Ordinary Security of encryption, 167
arithmetic, 110, 111 Sender (of message), 167–169
equation, 94, 102 Sensibility checks, 56, 86, 87, 93
Sequence, 40, 103, 159–163, 172
Pairwise Series, 23, 28, 35, 40, 136, 138, 153, 154, 159–166
coprimality, 115 Sign
coprime, 151 bounds, 95
Parity, 35, 39, 55–57, 62, 64, 70–74, 86, 87, 89, 105, 134 check (test), 56, 86, 93
check (test), 56, 57, 86, 93 table, 39, 96
violation, 55, 62, 70–74, 86, 87, 89 Signature, 170

175
Signed message, 168, 170
Software packages, 94, 95, 171
Solvability, 31, 57, 85, 102, 103, 112, 118
Spreadsheet, 11, 41, 94–96, 103, 116, 137
Square free, 38, 44, 128
Substitution (for solving systems of equations), 85, 86
Summatory function, 37, 38, 128, 129
Symmetric, 15, 62
Symmetry, 15, 43, 51–53, 61, 67, 78, 81, 94, 99, 137, 152
System of
congruence equations, 105, 112, 114, 153, 154, 156, 157
Diophantine equations, 85–87, 89, 91, 94
equations, 86
inequalities, 135
linear congruence equations, 112, 114, 117–122, 130,
132, 172
polynomial-exponential congruence equations, 113, 116,
118, 122, 172

Table, 39, 46, 64, 96, 114, 117, 127, 169


tau function, 5, 38, 44, 128
Taylor series, 40
Tetration, 4
Text message, 169
Totally multiplicative function, 24
Totient function, 5, 127, 129
Twin
primes, 46, 47, 49
primes conjecture, 49
Two square theorem, 133

Univariate
equation (or system of equations), 39, 104, 112, 113,
123
inequality, 97

Wilson theorem, 23, 28, 95, 130, 131, 155, 156

176

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy