Problem 2. For a positive integer n, let R(n) be the sum of the remainders when n isdivided by 1, 2, . . . , n. For example, R(4) = 0 0 1 0 = 1, R(7) = 0 1 1 3 2 1 0 = 8.Find all positive integers n such that R(n) = n − 1.
Detailed Explanation
1. Remainders in a Formula
For any divisor , the remainder when is divided by is written as
where is the greatest integer \le x.
Hence the required sum is
2. Useful Observation – The “Large k” Block
When we always have because fits into only once. Therefore for those values the remainder is simply
If we set then the indices (there are roughly of them) produce remainders forming a neat pattern .
3. A Quick Lower–Bound from That Block
Even without computing any of the other remainders, we get
For an even that sum is
For an odd that sum is
4. Compare with the Target
We need
So it is enough to show that our lower bound already beats for large enough .
- Even : We want Cancelling gives
- Odd : We want
Thus
5. Finish by Checking the Small Cases
Manually add remainders for to :
| Match? | |||
|---|---|---|---|
| 1 | 0 | 0 | Yes |
| 2 | 0 | 1 | No |
| 3 | 1 | 2 | No |
| 4 | 1 | 3 | No |
| 5 | 4 | 4 | Yes |
| 6 | 3 | 5 | No |
| 7 | 8 | 6 | No |
| 8 | 8 | 7 | No |
Only and satisfy .
Key Ideas to Remember
- Using links remainders to the floor function.
- Splitting the sum into a convenient region (here, ) often gives a usable bound without full calculation.
- Verifying a finite set of small cases finalises the result when inequalities handle the large cases.
Simple Explanation (ELI5)
Imagine Sharing Candies
Think of the number as n chocolates that you want to share with 1 friend, 2 friends, 3 friends … up to n friends (each different time).
- When you share with 1 friend, nothing is left over.
- With 2 friends, maybe 0 or 1 chocolate is left.
- Those "left-over" chocolates after every sharing are called remainders.
You are asked to add all those left-overs together. The problem wants to know for which special numbers does that total of leftovers equal exactly chocolates.
So the task is:
“Find all chocolate counts so that the sum of leftovers is .”
Playing with small numbers by hand already shows:
- works (total leftover )
- works (total leftover )
The big question: Are there any others? The solution shows those two are the only ones!
Step-by-Step Solution
Step-by-Step Solution
-
Write using the floor function
R(n) &= \sum_{k=1}^{n} \bigl(n-k\,\lfloor n/k \rfloor\bigr) \\ &= n^2 - \sum_{k=1}^{n} k\,\lfloor n/k \rfloor.\tag{1} \end{aligned}$$ -
Need to satisfy
Direct evaluation is hard, so we build an inequality.
-
Focus on indices . For these we have , so
-
Compute that tail sum
• Even :
• Odd :
-
Compare with the target
• Even case: Require
• Odd case: Require
Hence for all we already have , so is impossible.
-
Exhaustively test the small values
Remainders (list) 1 0 0 0 ✔ 2 0,0 0 1 ✘ 3 0,1,0 1 2 ✘ 4 0,0,1,0 1 3 ✘ 5 0,1,2,1,0 4 4 ✔ 6 0,0,0,2,1,0 3 5 ✘ 7 0,1,1,3,2,1,0 8 6 ✘ 8 0,0,2,0,3,2,1,0 8 7 ✘ -
Conclude
Examples
Example 1
Finding total leftover slices when cutting a pizza into different group sizes helps understand cumulative remainders.
Example 2
Quality-control: counting defective items after packing boxes of various sizes relates to remainders left out of each full box.
Example 3
Scheduling buses where leftover passengers must wait illustrates how remainders accumulate.