Maths Olympiad Prep

Library / NMO Selection Tests for the Junior Balkan Mathematical Olympiad /24 of 62

NMO Selection Tests for the Junior Balkan Mathematical Olympiad

Number theory Difficulty 5.6 AIME, harder Prove it Romania

Let nn be a positive integer. For each of the numbers 1,2,…,n1, 2, \dots, n we compute the difference between the number of its odd positive divisors and its even positive divisors. Prove that the sum of these differences is at least 00 and at most nn.
Kürschák Competition, 1999

Solution

We count how many times a number dd contributes to the sum of the differences. It appears ⌊nd⌋\left\lfloor \frac{n}{d} \right\rfloor times; if dd is odd, then this term is to be added, while if dd is even this term is to be subtracted. Thus, the desired sum is
∑k=1n(−1)k+1⌊nk⌋. \sum_{k=1}^{n} (-1)^{k+1} \left\lfloor \frac{n}{k} \right\rfloor.
Adding, if necessary, the term ⌊nn+1⌋=0\left\lfloor \frac{n}{n+1} \right\rfloor = 0 at the end, we can group the terms of the sum into pairs having the sum ⌊n2k−1⌋−⌊n2k⌋≥0\left\lfloor \frac{n}{2k-1} \right\rfloor - \left\lfloor \frac{n}{2k} \right\rfloor \ge 0, hence the sum is non-negative. Similarly, separating the first term (which is equal to nn), adding, if necessary, a 00 term to the end, we can again group the terms into pairs having the sum −⌊n2k⌋+⌊n2k⌋-\left\lfloor \frac{n}{2k} \right\rfloor + \left\lfloor \frac{n}{2k} \right\rfloor.

[n2k+1]≤0, hence the sum is at most n. \left[ \frac{n}{2k+1} \right] \le 0, \text{ hence the sum is at most } n.

Want a route through all this instead of an archive? The track puts 2,604 problems in a working order, from Junior Challenge level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement reproduced verbatim; metadata (topic, difficulty) added by this project.