Maths Olympiad Prep

Library / /337 of 462

Algebra Difficulty 6.4 National Olympiad Prove it Ireland

Let N\mathbb{N} denote the strictly positive integers. A function f:NNf : \mathbb{N} \to \mathbb{N} satisfies the following for all nNn \in \mathbb{N}:
f(1)=1f(f(n))=nf(2n)=2f(n)+1. \begin{aligned} f(1) &= 1 \\ f(f(n)) &= n \\ f(2n) &= 2f(n) + 1. \end{aligned}
Find the value of f(2020)f(2020).

Solutions — 3

Solution 1

From f(f(n))=nf(f(n)) = n we obtain for all integers k,n>0k, n > 0 that n=f(k)n = f(k) if and only if f(n)=kf(n) = k.

We first show that f(2n+1)=2f(n)f(2n+1) = 2f(n) for all n>0n > 0. To see this, let k=f(n)k = f(n). Then n=f(k)n = f(k) and f(2k)=2f(k)+1=2n+1f(2k) = 2f(k)+1 = 2n+1 and so 2f(n)=2k=f(2n+1)2f(n) = 2k = f(2n+1).

Next we show that f(2kn)=2kf(n)+2k1f(2^k n) = 2^k f(n) + 2^k - 1 for all k0k \ge 0 and n1n \ge 1. We prove this by induction on kk. When k=0k = 0 this is obvious. For the inductive step we use the given f(2n)=2f(n)+1f(2n) = 2f(n) + 1 to obtain
f(2k+1n)=f(22kn)=2f(2kn)+1=2(2kf(n)+2k1)+1=2k+1f(n)+2k+11. \begin{aligned} f(2^{k+1}n) &= f(2 \cdot 2^k n) = 2f(2^k n) + 1 \\ &= 2(2^k f(n) + 2^k - 1) + 1 = 2^{k+1}f(n) + 2^{k+1} - 1. \end{aligned}
Because f(1)=1f(1) = 1, we obtain f(2k)=2k+11f(2^k) = 2^{k+1} - 1. Using f(f(n))=nf(f(n)) = n this gives f(2k+11)=2kf(2^{k+1} - 1) = 2^k for all k0k \ge 0.

We can now work backwards to find f(2020)f(2020):
f(2020)=f(4505)=4f(505)+3f(505)=2f(252)f(252)=f(463)=4f(63)+3f(63)=f(261)=25=32. \begin{align*} f(2020) &= f(4 \cdot 505) = 4f(505) + 3 \\ f(505) &= 2f(252) \\ f(252) &= f(4 \cdot 63) = 4f(63) + 3 \\ f(63) &= f(2^6 - 1) = 2^5 = 32. \end{align*}
We finally obtain f(252)=432+3=131f(252) = 4 \cdot 32 + 3 = 131, f(505)=262f(505) = 262 and f(2020)=4262+3=1051f(2020) = 4 \cdot 262 + 3 = 1051.

Solution 2

Look for a sequence (a1,b1),(a2,b2),(a3,b3),,(ak,bk)(a_1, b_1), (a_2, b_2), (a_3, b_3), \dots, (a_k, b_k) such that (a1,b1)=(1,1)(a_1, b_1) = (1, 1), ak=2020a_k = 2020 and for j2j \ge 2, either (aj,bj)=(bj1,aj1)(a_j, b_j) = (b_{j-1}, a_{j-1}) or (aj,bj)=(2aj1,2bj1+1)(a_j, b_j) = (2a_{j-1}, 2b_{j-1} + 1). The three given conditions for ff imply that for any such sequence bj=f(aj)b_j = f(a_j) for 1jk1 \le j \le k. In particular, f(2020)=bkf(2020) = b_k. The following sequence works (ignore the fourth column for now)

jaja_jbjb_jaj+bj+1a_j + b_j + 1
1113
2236
34712
481524
5163148
6326396
7633296
812665192
9252131384
10131252384
11262505768
12505262768
1310105251536
14202010513072

Thus, f(2020)=1051f(2020) = 1051. This is a complete proof, but the sequence has been pulled out of a hat. To motivate the sequence, we note that aj+bj+1a_j+b_j+1 either stays constant or doubles with each unit increase in jj. As a1+b1+1=3a_1+b_1+1=3, it follows that aj+bj+1a_j+b_j+1 is equal to 3 multiplied by a power of 2 for all jj. So we can start at the bottom with a14=2020a_{14} = 2020 and guess what power of 2 we have to multiply by 3 to get 2020+f(2020)+12020+f(2020)+1. The next number of the required form is 3072, which (if correct, we don't yet know this) would imply f(2020)=1051f(2020) = 1051. We then work backwards using:
(aj1,bj1)={(aj2,bj12)aj even, bj odd(bj,aj)aj odd, bj even. (a_{j-1}, b_{j-1}) = \begin{cases} \left(\frac{a_j}{2}, \frac{b_j-1}{2}\right) & a_j \text{ even, } b_j \text{ odd} \\ (b_j, a_j) & a_j \text{ odd, } b_j \text{ even.} \end{cases}
It is not obvious that this approach will work. When we start with bkb_k such that bk+2021=32nb_k+2021 = 3 \cdot 2^n, the process will always terminate with a pair (a1,b1)=(a,1)(a_1, b_1) = (a, 1). However, only with starting value bk=1051b_k = 1051 we get a=1a = 1 as required.

f(n)=32kn1. f(n) = 3 \cdot 2^k - n - 1.

Solution 3

After showing that f(2n+1)=2f(n)f(2n+1) = 2f(n) as in Solution 1, it is possible to work out the first few f(n)f(n) by hand. These values suggest that when k0k \ge 0 is an integer and 2kn<2k+12^k \le n < 2^{k+1} we have
f(n)=32kn1. f(n) = 3 \cdot 2^k - n - 1.
We show this by induction on k0k \ge 0. When k=0k = 0 we must have n=1n = 1 and the claim is true, because f(1)=1f(1) = 1. For the inductive step we assume the formula is true for numbers strictly between 2k112^{k-1} - 1 and 2k2^k, for a given k1k \ge 1.

We consider two cases: firstly when nn is even, and secondly when nn is odd. If nn is even and 2kn<2k+12^k \le n < 2^{k+1}, then 2k1n2<2k2^{k-1} \le \frac{n}{2} < 2^k and so, by assumption,
f(n2)=32k1n21. f\left(\frac{n}{2}\right) = 3 \cdot 2^{k-1} - \frac{n}{2} - 1.
Substituting the doubling rule from the original question it follows that:
f(n)=2f(n2)+1=32kn1. f(n) = 2f\left(\frac{n}{2}\right) + 1 = 3 \cdot 2^k - n - 1.
Thus, the result holds for even nn. Now if nn is odd, 2kn<2k+12^k \le n < 2^{k+1} implies
32k2k+11<32kn132k2k1. 3 \cdot 2^k - 2^{k+1} - 1 < 3 \cdot 2^k - n - 1 \le 3 \cdot 2^k - 2^k - 1.
Simplifying, and using the fact that all three quantities are integers, this is equivalent to:
2k32kn1<2k+1. 2^k \le 3 \cdot 2^k - n - 1 < 2^{k+1}.
Now as the middle term is even, we have earlier proved the formula for ff for even numbers in this range, which gives:
f(32kn1)=32k(32kn1)1=n. f(3 \cdot 2^k - n - 1) = 3 \cdot 2^k - (3 \cdot 2^k - n - 1) - 1 = n.
Then the self-inverse property of ff implies f(n)=32kn1f(n) = 3 \cdot 2^k - n - 1. The induction step is now complete. Having proved this result, we finally note that:
210=10242020<211 2^{10} = 1024 \le 2020 < 2^{11}
and so we can immediately calculate f(2020)=1051f(2020) = 1051.

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

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