(2023 Volume 5) On A Number Theory Problem
(2023 Volume 5) On A Number Theory Problem
1. Introduction: stating the problem. We all know that any two consecutive integers n
and n + 1 are relatively prime, which can also be expressed as gcd(n, n + 1) = 1 for any integer
n. (Here and further throughout this note by gcd(x, y) we denote the greatest common divisor
of the integers x and y. We have that x and y are relatively prime if and only if gcd(x, y) = 1.)
This is because any common divisor of n and n + 1 must also divide (n + 1) − n = 1. Similarly,
any two consecutive odd numbers are relatively prime, that is, gcd(2n − 1, 2n + 1) = 1 for any
integer n, since any common divisor of 2n − 1 and 2n + 1 must divide their difference, which is 2.
But both 2n − 1 and 2n + 1 are odd, hence the conclusion follows. We invite the reader to show
similarly that gcd(2n + 1, 4n + 1) = 1, or gcd(30n + 3, 24n + 2) = 1 for all n. On the other hand,
we evidently do not have gcd(2n + 3, 3n + 2) = 1 for every integer n, as long as this does not hold
for (at least) n = 1. So, naturally, we asked ourselves about the following
Problem 1. Let a, b, c, and d be integers. What necessary and sufficient conditions must they
satisfy in order to have gcd(an + b, cn + d) = 1 for all integers n?
The very simple (but, as we will see, also very useful to solving our problem) identity
a(cn + d) − c(an + b) = ad − bc
therefore
d1 | d2 = gcd(4n + 1, k − 4).
But d2 | 4n + 1, too, and
d2 | kn + 1 = n(k − 4) + 4n + 1
gcd(4n + 1, kn + 1) = 1 ⇔ gcd(4n + 1, k − 4) = 1
for every integer n. Thus the condition from the statement of the problem is equivalent to gcd(4n+
1, k − 4) = 1 for all integers n. This is true if k − 4 = ±2s for some nonnegative integer s and some
choice of the signs plus/minus, because 4n + 1 is odd and has no common factors (other than 1
and −1) with ±2s . On the other hand, if k − 4 has an odd factor greater than 1, that factor will
be a common factor for k − 4 and 4n + 1 for some n (this is clear if the odd factor is of the form
4t + 1; when it is of the form 4t − 1, it will be also a factor of (4t − 1)2 = 4t(t − 1) + 1). Since,
under this assumption, k − 4 and 4n + 1 cannot be relatively prime for all n, it follows that an
odd factor greater than 1 is not allowed for k − 4, and we conclude that the numbers required by
the problem are those of the form 4 ± 2s , s being a nonnegative integer.
This still doesn’t suggest any general necessary and sufficient condition as required by Problem
1, but it makes a connection between gcd(an + b, cn + d) and gcd(cn + d, ad − bc) which, at first
glance, seemed to us to be true in general (but is not). Namely, because
a(cn + d) − c(an + b) = ad − bc
it follows that
gcd(an + b, cn + d) | gcd(cn + d, ad − bc)
for all n. On the other hand, we also have the equality
showing that the greatest common divisor of cn + d and ad − bc also divides d(an + b) – so, if we
had d = 1 (as in the previous example), then
and, hence,
gcd(cn + d, ad − bc) = gcd(an + b, cn + d)
would follow.
(Similarly, when b = 1, gcd(an + b, ad − bc) = gcd(an + b, cn + d) holds.) Thus we considered
the case d = 1, and got the next result.
Problem 3. Let a, b, and c be integers. Then we have
gcd(an + b, cn + 1) = 1
for every integer n if and only if any prime divisor of a − bc is also a factor of c.
Solution. As we just seen, the equality
a(cn + 1) − c(an + b) = a − bc
implies
gcd(an + b, cn + 1) | gcd(cn + 1, a − bc),
while
n(a − bc) + b(cn + 1) = an + b
implies
gcd(cn + 1, a − bc) | gcd(an + b, cn + 1)
gcd(an + b, cn + 1) = 1, ∀ n ∈ Z
⇔ gcd(cn + 1, a − bc) = 1, ∀ n ∈ Z.
Then it is very easy to see that the condition ”any prime divisor of a − bc is also a factor of c” is
sufficient to have gcd(an + b, cn + 1) = 1, or, equivalently, gcd(cn + 1, a − bc) = 1 for all n. Indeed,
if there exists some integer n for which gcd(cn + 1, a − bc) > 1, then a common prime divisor p
exists for both cn + 1 and a − bc. Since we assumed that p | a − bc ⇒ p | c, this p would divide
both c and cn + 1, which is impossible, so no n exists with gcd(an + b, cn + 1) > 1.
The condition ”any prime divisor of a − bc is also a factor of c” is also necessary to have
gcd(cn + 1, a − bc) = 1 for all n. If not, we would have gcd(cn + 1, a − bc) = 1 for all n, while a
prime q would exist such that q | cn + 1, and q does not divide c. But, this being the case, we can
find an n such that cn + 1 ≡ 0 mod q (the congruence cx + 1 ≡ 0 mod q is solvable). Since q
also divides a − bc, we get the contradiction q | gcd(cn + 1, a − bc), thus finishing the proof.
Well, this was the red herring that troubled our way towards the demonstration for the general
case: the misleading idea that we could use a connection between gcd(an + b, cn + d) and gcd(cn +
d, ad − bc) (or gcd(an + b, ad − bc)), as we did in the previous Problems 2 and 3. Nevertheless,
Problem 3 (and its particular case, Problem 2) finally led us to the general necessary and sufficient
conditions for which Problem 1 asks (but only when we decided to give up chasing chimeras).
Observing that ”any prime divisor of a − bc is also a factor of c” implies ”any prime divisor of
a − bc is also a factor of a”, too (and, anyway, some symmetry about a and c is inevitable) we
finally realized what we were looking for.
3. The solution. We now solve Problem 1, after we reformulate it as
Problem 4. For integers a, b, c, d the following statements are equivalent.
(i) The numbers an + b and cn + d are relatively prime for any integer n.
(ii) We have that b and d are relatively prime, and any prime divisor of ad − bc is also a factor
of both a and c.
Solution. The condition gcd(b, d) = 1 is obviously necessary in order to have gcd(an + b, cn +
d) = 1 for any integer n (take n = 0) – and we assume further that this is the case. Then note
that the equality
a(cn + d) − c(an + b) = ad − bc
holds for any n, and assume that a prime p divides ad − bc, but it does not divide a. Since a is
relatively prime to p, the congruence ax + b ≡ 0 mod p is solvable, hence we can find an integer
n satisfying it, that is, such that
an + b ≡ 0 mod p.
Multiplying this by d, and using the divisibility of ad − bc by p, we get
or
b(cn + d) ≡ 0 mod p.
Now, if p divides b, since it also divides ad − bc, it follows that p divides ad. But p does not divide
a, hence we get p | d, and the assumption that b and d are relatively prime is contradicted. So p
does not divide b, hence b(cn + d) ≡ 0 mod p implies cn + d ≡ 0 mod p. We summarize: when
gcd(b, d) = 1, if a prime p exists such that p divides ad − bc, but p does not divide a, then we can
Finally, we invite the reader to see that 2n + 1 and 4n − 17 are not relatively prime for any n,
and to find such an n that 2n + 1 and 4n − 17 have a common divisor greater than 1.