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.

4 min read
108 views
Published July 6, 2025
Number Theory
Modular Arithmetic
Floor & Ceiling Functions
Inequalities and Bounding Arguments

💡 Want to ask your own questions?

Get instant explanations with AI • Free trial

Detailed Explanation

1. Remainders in a Formula

For any divisor kk, the remainder when nn is divided by kk is written as
nmodk=nknkn \bmod k = n - k\,\left\lfloor \frac{n}{k} \right\rfloor where x\lfloor x \rfloor is the greatest integer \le x.

Hence the required sum is

R(n)=k=1n(nkn/k).R(n)=\sum_{k=1}^{n} \bigl(n-k\,\lfloor n/k \rfloor\bigr).

2. Useful Observation – The “Large k” Block

When k>n2k > \frac{n}{2} we always have nk=1,\left\lfloor \frac{n}{k} \right\rfloor = 1, because kk fits into nn only once. Therefore for those kk values the remainder is simply nmodk=nk.n \bmod k = n-k.

If we set m=n2,m=\left\lfloor \frac{n}{2} \right\rfloor, then the indices k=m+1,m+2,,nk=m+1,\,m+2,\dots, n (there are roughly n2\frac{n}{2} of them) produce remainders forming a neat pattern 0,1,2,0,1,2,\dots.

3. A Quick Lower–Bound from That Block

Even without computing any of the other remainders, we get

R(n)    Sum of (nk) for k>n/2.\boxed{R(n)\;\ge\; \text{Sum of }(n-k)\text{ for }k>n/2}.

For an even n=2qn=2q that sum is

q(q1)2.\frac{q(q-1)}{2}.

For an odd n=2q+1n=2q+1 that sum is

q(q+1)2.\frac{q(q+1)}{2}.

4. Compare with the Target n1n-1

We need R(n)=n1.R(n)=n-1.

So it is enough to show that our lower bound already beats n1n-1 for large enough nn.

  • Even n=2qn=2q: We want q(q1)2    2q.\frac{q(q-1)}{2}\;\ge\;2q. Cancelling q>0q>0 gives q14    q5  (n10).q-1\ge4\;\Rightarrow\;q\ge5\;(n\ge10).
  • Odd n=2q+1n=2q+1: We want q(q+1)2    2q+1    q23q20    q4  (n9).\frac{q(q+1)}{2}\;\ge\;2q+1 \;\Longrightarrow\; q^2-3q-2\ge0 \;\Rightarrow\; q\ge4\;(n\ge9).

Thus R(n)  >  n1 for every n9.\boxed{R(n)\;>\;n-1 \text{ for every } n\ge9}.

5. Finish by Checking the Small Cases

Manually add remainders for n=1n=1 to 88:

nnR(n)R(n)n1n-1Match?
100Yes
201No
312No
413No
544Yes
635No
786No
887No

Only n=1n=1 and n=5n=5 satisfy R(n)=n1R(n)=n-1.

Key Ideas to Remember

  1. Using nmodk=nkn/kn \bmod k = n - k\,\lfloor n/k \rfloor links remainders to the floor function.
  2. Splitting the sum into a convenient region (here, k>n/2k>n/2) often gives a usable bound without full calculation.
  3. 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 nn 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 nn does that total of leftovers equal exactly n1n-1 chocolates.

So the task is:
“Find all chocolate counts nn so that the sum of leftovers is n1n-1.”

Playing with small numbers by hand already shows:

  • n=1n=1 works (total leftover =0=0)
  • n=5n=5 works (total leftover =4=4)

The big question: Are there any others? The solution shows those two are the only ones!

👆 Found this helpful? Get personalized explanations for YOUR questions!

Step-by-Step Solution

Step-by-Step Solution

  1. Write R(n)R(n) 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}$$
  2. Need to satisfy

    R(n)=n1k=1nkn/k=n2n+1.R(n)=n-1\quad\Longrightarrow\quad \sum_{k=1}^{n} k\,\lfloor n/k \rfloor = n^2-n+1.

    Direct evaluation is hard, so we build an inequality.

  3. Focus on indices k>n/2k>n/2. For these kk we have n/k=1\lfloor n/k \rfloor=1, so

    R(n)k=n/2+1n(nk).R(n) \ge \sum_{k=\lfloor n/2\rfloor+1}^{n} (n-k).

  4. Compute that tail sum

    Even n=2qn=2q: R(n)r=0q1r=q(q1)2.R(n) \ge \sum_{r=0}^{q-1} r = \frac{q(q-1)}{2}.

    Odd n=2q+1n=2q+1: R(n)r=0qr=q(q+1)2.R(n) \ge \sum_{r=0}^{q} r = \frac{q(q+1)}{2}.

  5. Compare with the target n1n-1

    • Even case: Require q(q1)22q    q5  (n10).\frac{q(q-1)}{2} \ge 2q \;\Longrightarrow\; q\ge5 \;(n\ge10).

    • Odd case: Require q(q+1)22q+1    q4  (n9).\frac{q(q+1)}{2} \ge 2q+1 \;\Longrightarrow\; q\ge4 \;(n\ge9).

    Hence for all n9n\ge9 we already have R(n)nR(n)\ge n, so R(n)=n1R(n)=n-1 is impossible.

  6. Exhaustively test the small values 1n81\le n\le8

    nnRemainders (list)R(n)R(n)n1n-1
    1000 ✔
    20,001 ✘
    30,1,012 ✘
    40,0,1,013 ✘
    50,1,2,1,044 ✔
    60,0,0,2,1,035 ✘
    70,1,1,3,2,1,086 ✘
    80,0,2,0,3,2,1,087 ✘
  7. Conclude

    The only positive integers satisfying R(n)=n1 are n=1 and n=5.\boxed{\text{The only positive integers satisfying } R(n)=n-1 \text{ are } n=1 \text{ and } n=5.}

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.

Visual Representation

References

🤔 Have Your Own Question?

Get instant AI explanations in multiple languages with diagrams, examples, and step-by-step solutions!

AI-Powered Explanations
🎯Multiple Languages
📊Interactive Diagrams

No signup required • Try 3 questions free