Skip to main content
OlympiadHQ

Browse · MathNet

Print

International Mathematical Olympiad

number theory

Problem

Let be an odd prime number and be the set of positive integers. Suppose that a function satisfies the following properties: - ; - for any pair of relatively prime positive integers not both equal to ; - for any pair of relatively prime positive integers . Prove that
Solution
Denote by the set of all pairs of coprime positive integers. Notice that for every there exists a pair with . Moreover, if is one such pair, then all such pairs are of the form , where . So there exists a unique such pair with ; we denote this pair by .

Lemma. Let and . Then .

Proof. We induct on . The base case is . In this case, we have that , and , so the claim holds.

Assume now that , and so , since and are coprime. Two cases are possible.

Case 1: . Notice that , since and . Thus by the induction hypothesis.

Case 2: . (Then, clearly, .) Now we estimate . Since , we have Thus , so , hence , and thus .

Observe that . We know from Case 1 that . We have by the inductive hypothesis. Then, since and , we have , and we are done.

The Lemma proves that, for all , if and only if the inverse of modulo , taken in , is at most . Then, for any odd prime and integer such that , iff the inverse of is less than . Since , including multiplicities (two for each quadratic residue in each set), we conclude that the desired sum is twice the number of quadratic residues that are less than , i.e., Since the number of perfect squares in the interval is , we conclude that

---

Alternative solution.

We provide a different proof for the Lemma. For this purpose, we use continued fractions to find explicitly.

The function is completely determined on by the following

Claim. Represent as a continued fraction; that is, let be an integer and be positive integers such that and Then is even.

Proof. We induct on . If , then and . Then, for , an easy induction shows that .

Now consider the case . Perform the Euclidean division , with . We have because . Hence Then the number of terms in the continued fraction representations of and differ by one. Since , the inductive hypothesis yields and thus

Now we use the following well-known properties of continued fractions to prove the Lemma: Let and be coprime positive integers with , with the notation borrowed from the Claim. In particular, . Assume that and define if necessary. Then - , \quad and - .

Assume that . Then , and with strict inequality for , and Now we finish the proof of the Lemma. It is immediate for . If , then , so If , we have , so Thus, for any , we find that , and so

Techniques

Inverses mod nQuadratic residuesGreatest common divisors (gcd)