Maths Olympiad Prep

Library / PMO Area Stage /7 of 12

PMO Area Stage

Algebra Difficulty 6.4 National Olympiad Prove it Philippines

Problem:

Consider the function f:N→Zf: \mathbb{N} \rightarrow \mathbb{Z} satisfying, for all n∈Nn \in \mathbb{N},

a. ∣f(n)∣=n|f(n)|=n

b. 0≤∑k=1nf(k)<2n0 \leq \sum_{k=1}^{n} f(k)<2 n.

Evaluate ∑n=12018f(n)\sum_{n=1}^{2018} f(n).

Solution

Solution:

Let Sn=∑k=1nf(k)S_{n}=\sum_{k=1}^{n} f(k). We want the value of S2018S_{2018}.

Claim: f(n)={n if Sn−1<n−n if Sn−1≥nf(n)= \begin{cases}n & \text{ if } S_{n-1}<n \\ -n & \text{ if } S_{n-1} \geq n\end{cases}

Proof: The inequality condition is 0≤Sn−1+f(n)<2n0 \leq S_{n-1}+f(n)<2 n.

- If n>Sn−1n>S_{n-1}, then 0≤Sn−1+f(n)<n+f(n)0 \leq S_{n-1}+f(n)<n+f(n) so f(n)>−nf(n)>-n. Therefore, f(n)=nf(n)=n.
- If n≤Sn−1n \leq S_{n-1}, then n+f(n)≤Sn−1+f(n)<2nn+f(n) \leq S_{n-1}+f(n)<2 n so f(n)<nf(n)<n. Therefore, f(n)=−nf(n)=-n.

Claim: If Sn=0S_{n}=0, then

Sn+1S_{n+1}Sn+2S_{n+2}Sn+3S_{n+3}Sn+4S_{n+4}⋯\cdotsSn+2jS_{n+2j}Sn+2j+1S_{n+2j+1}⋯\cdots
n+1n+12n+32n+3nn2n+42n+4⋯\cdots2n+2+j2n+2+jn+1−jn+1-j⋯\cdots

where j=1,2,…,n+1j=1,2, \ldots, n+1.

The pattern here: Sn+1,Sn+3,Sn+5,…S_{n+1}, S_{n+3}, S_{n+5}, \ldots are numbers decreasing by 1, while Sn+2,Sn+4,Sn+6,…S_{n+2}, S_{n+4}, S_{n+6}, \ldots are numbers increasing by 1.

Proof: Sn=0<nS_{n}=0<n so f(n+1)=n+1f(n+1)=n+1. Thus, Sn+1=0+(n+1)=n+1S_{n+1}=0+(n+1)=n+1.

Sn+1=n+1<n+2S_{n+1}=n+1<n+2 so f(n+2)=n+2f(n+2)=n+2. Thus, Sn+2=n+1+(n+2)=2n+3S_{n+2}=n+1+(n+2)=2n+3.

Sn+2=2n+3>n+3S_{n+2}=2n+3>n+3 so f(n+3)=−n−3f(n+3)=-n-3. Thus, Sn+3=2n+3+(−n−3)=nS_{n+3}=2n+3+(-n-3)=n.

We prove the claim by strong induction. Suppose the pattern holds for Sn+1,Sn+2,…,Sn−1+2jS_{n+1}, S_{n+2}, \ldots, S_{n-1+2j}.

Since Sn−1+2j=Sn+1+2(j−1)=n+1−(j−1)=n+2−j<n+2jS_{n-1+2j}=S_{n+1+2(j-1)}=n+1-(j-1)=n+2-j<n+2j, then f(n+2j)=n+2jf(n+2j)=n+2j so Sn+2j=(n+2−j)+(n+2j)=2n+2+jS_{n+2j}=(n+2-j)+(n+2j)=2n+2+j.

On the other hand, since Sn+2j=2n+2+j=(n+2j+1)+(n+1−j)≥n+2j+1S_{n+2j}=2n+2+j=(n+2j+1)+(n+1-j) \geq n+2j+1, then f(n+2j+1)=−(n+2j+1)f(n+2j+1)=-(n+2j+1) so Sn+2j+1=(2n+2+j)−(n+2j+1)=n+1−jS_{n+2j+1}=(2n+2+j)-(n+2j+1)=n+1-j, which proves the claim.

Eventually, Sn+1,Sn+3,…,Sn+2j+1,…S_{n+1}, S_{n+3}, \ldots, S_{n+2j+1}, \ldots will decrease to 0, when j=n+1j=n+1. Thus, if Sn=0S_{n}=0, it follows that the next 0 value is S3(n+1)S_{3(n+1)}.

Therefore, S3=0S_{3}=0, S3⋅4=S12=0S_{3 \cdot 4}=S_{12}=0, S3⋅13=S39=0S_{3 \cdot 13}=S_{39}=0, S3⋅40=S120=0S_{3 \cdot 40}=S_{120}=0, S3⋅121=S363=0S_{3 \cdot 121}=S_{363}=0, S3⋅364=S1092=0S_{3 \cdot 364}=S_{1092}=0.

Since 2018=1092+2⋅4632018=1092+2 \cdot 463, then S2018=2⋅1092+2+463=2649S_{2018}=2 \cdot 1092+2+463=2649.

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.