Olympiad Maths Prep

Track / Stage 9 / 47 of 80 #1927 of 2000

Problem 1927

IMO P2/P5; hard shortlist
Algebra Difficulty 9.2 Prove it Balkan Mathematical Olympiad Shortlist · Balkan Mathematical Olympiad

Let f:NNf: N \rightarrow N be a function from the positive integers to the positive integers for which f(1)=1f(1) = 1, f(2n)=f(n)f(2n) = f(n) and f(2n+1)=f(n)+f(n+1)f(2n+1) = f(n)+f(n+1) for all nNn \in N. Prove that for any natural number nn, the number of odd natural numbers mm such that f(m)=nf(m) = n is equal to the number of positive integers not greater than nn having no common prime factors with nn.

This one wants a proof. Work it on paper, read the official solution, then mark yourself honestly — the ladder only means something if the record is true.

Official solutions — 2

Solution 1

The crucial observation that solves this problem is that the function ff encodes Euclid's algorithm when we view numbers in binary. To make this precise, we will write g(n)g(n) for f(n+1)f(n+1), and consider for each integer nn the pair (f(n),g(n))(f(n), g(n)). If we let xx be the binary string representing nn then the recurrence relations give us that
(f(x0),g(x0))=(f(x),f(x)+g(x)) and (f(x1),g(x1))=(f(x)+g(x),g(x)). (f(x0), g(x0)) = (f(x), f(x) + g(x)) \text{ and } (f(x1), g(x1)) = (f(x) + g(x), g(x)).
Thus we can calculate the pair (f(x),g(x))(f(x), g(x)) as follows: start from the pair (1,1)=(f(1),g(1))(1, 1) = (f(1), g(1)). Now read the binary digits of xx from left to right, ignoring the initial 1: whenever you see a 0 add the first coordinate to the second, and whenever you see a 1 add the second coordinate to the first. For example, to calculate the pair (f(27),g(27))(f(27), g(27)) we write 27=1101127 = 11011 in binary, which gives us the sequence of pairs
(f(1),g(1))=(1,1)(f(11),g(11))=(2,1)(f(110),g(110))=(2,3)(f(1101),g(1101))=(5,3)(f(11011),g(11011))=(8,3) \begin{aligned} (f(1), g(1)) &= (1, 1) \\ (f(11), g(11)) &= (2, 1) \\ (f(110), g(110)) &= (2, 3) \\ (f(1101), g(1101)) &= (5, 3) \\ (f(11011), g(11011)) &= (8, 3) \end{aligned}
Now from this it follows by induction that (f(n),g(n))(f(n), g(n)) are coprime positive integers, with f(n)g(n)f(n) \ge g(n) if and only if nn is odd. To complete the proof, we just need to show that each pair (a,b)(a, b) of coprime positive integers arises as (f(n),g(n))(f(n), g(n)) for a unique positive integer nn.

To show existence of nn, imagine running Euclid's algorithm on the pair (a,b)(a, b): that is to say, we successively either subtract the first coordinate from the second or the second from the first (depending on which of the two is the larger) until we can't go any further, which is when we reach the pair (1,1)(1, 1). We can record this as a string consisting of a 0 for each time we subtracted the first from the second, and a 1 for each time we subtracted the second from the first. Reversing this string and prepending a 1 gives the binary expansion of a number nn which (by our method of calculating (f,g)(f, g)) has (f(n),g(n))=(a,b)(f(n), g(n)) = (a, b). To get uniqueness of nn we just have to note that when we ran Euclid's algorithm to construct nn in the previous paragraph, we had no choices at any stage: there is a unique series of reductions that takes (a,b)(a, b) to (1,1)(1, 1) while remaining in positive integers. This series of reductions corresponds to a unique binary string, so the integer nn we constructed was unique.

Solution 2

As in the previous solution, we consider the pair (f(n),f(n+1))(f(n), f(n+1)) for each positive integer nn, show by induction that (f(n),f(n+1))(f(n), f(n+1)) are coprime, and that f(n)f(n+1)f(n) \ge f(n+1) if and only if nn is even. However, to show that each pair (a,b)(a, b) of coprime positive integers arises as (f(n),f(n+1))(f(n), f(n+1)) for a unique nn, we proceed by strong induction on a+ba+b. Specifically, if a<ba < b then (a,ba)=(f(m),f(m+1))(a, b-a) = (f(m), f(m+1)) for some integer mm, whence (a,b)=(f(2m),f(2m+1))(a, b) = (f(2m), f(2m+1)) by the recursive rules for ff. To show uniqueness, if (a,b)=(f(n),f(n+1))(a, b) = (f(n), f(n+1)) then (since a<ba < b) we know that n=2kn = 2k must be even. However, then by the recursive rules for ff again (a,ba)=(f(k),f(k+1))(a, b-a) = (f(k), f(k+1)) so that (inductive hypothesis) k=mk = m. This gives uniqueness. The case a>ba > b is similar and the exceptional case (a,b)=(1,1)(a, b) = (1, 1) is easy, which completes the proof.

Source: MathNet, licensed CC-BY-4.0. Statement and solution reproduced as published; topic, difficulty and ordering added by this site.