A while ago, I posted the HP A4 Paper Mysterious Question which goes like this:

**Problem of the Week**

Suppose is a function from positive integers to positive integers satisfying , , and , for all positive integers .

Find the maximum of when is greater than or equal to 1 and less than or equal to 1994.

So far no one seems to have solved the question on the internet yet!

I have given it a try, and will post the solution below!

If you are interested in Math Olympiad, it is a good idea to invest in a good book to learn more tips and tricks about Math Olympiad. One excellent Math Olympiad author is Titu Andreescu, trainer of the USA IMO team. His book 104 Number Theory Problems: From the Training of the USA IMO Team is highly recommended for training specifically on Number Theory Olympiad questions, one of the most arcane and mysterious fields of mathematics. He does write on other Math Olympiad subjects too, like Combinatorics, so do check it out by clicking the link above, and looking at the Amazon suggested books.

Now, to the solution of the Mysterious HP A4 Paper Question:

We will solve the problem in a few steps.

## Step 1

First, we will prove that . We will do this by induction. When , . Suppose . Then,

Thus, we have proved that for all integers n.

## Step 2

Next, we will prove a little lemma. Let . We will prove, again by induction, that . Note that means the composition of the function g with itself n times.

Firstly, for the base case, is true. Suppose is true. Then, . Thus, the statement is true.

## Step 3

Next, we will prove that if , then . We will write , where is odd. We have that .

Since is odd, we have , where .

Continuing, we have

We will write , where is odd. We have .

where , and .

where , .

Case 1: All the are 0, then . Then, , i.e. .

Thus, .

Case 2: Not all the are 0, then, . We have , thus, , which means that . Thus, .

## Step 4 (Conclusion)

Using Step 1, we have , . Using Step 3, we guarantee that if , then . Thus, the maximum value of f(n) is **10**.

Ans: 10