51st International Mathematical Olympiad
Astana, Kazakhstan 2010
   Problems with Solutions
Contents
Problems                                                                                                                                                                                             5
Solutions                                                                                                                                                                                             7
   Problem   1   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    7
   Problem   2   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    8
   Problem   3   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    9
   Problem   4   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   10
   Problem   5   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   11
   Problem   6   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   13
Problems
Problem 1. Determine all functions f : R → R such that the equality
                                    (     )      ⌊     ⌋
                                  f ⌊x⌋y = f (x) f (y)
holds for all x, y ∈ R. (Here ⌊z⌋ denotes the greatest integer less than or equal to z.)
Problem 2. Let I be the incentre of triangle ABC and let Γ be its circumcircle. Let the line AI
                                                    \ and F a point on the side BC such that
intersect Γ again at D. Let E be a point on the arc BDC
                                        ∠BAF = ∠CAE < 12 ∠BAC.
Finally, let G be the midpoint of the segment IF . Prove that the lines DG and EI intersect on Γ.
Problem 3. Let N be the set of positive integers. Determine all functions g : N → N such that
                                   (          )(        )
                                    g(m) + n m + g(n)
is a perfect square for all m, n ∈ N.
Problem 4. Let P be a point inside the triangle ABC. The lines AP , BP and CP intersect the
circumcircle Γ of triangle ABC again at the points K, L and M respectively. The tangent to Γ at C
intersects the line AB at S. Suppose that SC = SP . Prove that M K = M L.
Problem 5. In each of six boxes B1 , B2 , B3 , B4 , B5 , B6 there is initially one coin. There are two
types of operation allowed:
  Type 1: Choose a nonempty box Bj with 1 ≤ j ≤ 5. Remove one coin from Bj and add two
          coins to Bj+1 .
  Type 2: Choose a nonempty box Bk with 1 ≤ k ≤ 4. Remove one coin from Bk and exchange
          the contents of (possibly empty) boxes Bk+1 and Bk+2 .
Determine whether there is a finite sequence of such operations that results in boxes B1 , B2 , B3 , B4 , B5
                                                     2010                      c     c
being empty and box B6 containing exactly 20102010        coins. (Note that ab = a(b ) .)
Problem 6. Let a1 , a2 , a3 , . . . be a sequence of positive real numbers. Suppose that for some
positive integer s, we have
                                 an = max{ak + an−k | 1 ≤ k ≤ n − 1}
for all n > s. Prove that there exist positive integers ℓ and N , with ℓ ≤ s and such that an = aℓ +an−ℓ
for all n ≥ N .
6
Solutions
Problem 1. Determine all functions f : R → R such that the equality
                                    (     )      ⌊     ⌋
                                  f ⌊x⌋y = f (x) f (y)                                               (1)
holds for all x, y ∈ R. (Here ⌊z⌋ denotes the greatest integer less than or equal to z.)
Answer. f (x) = const = C, where C = 0 or 1 ≤ C < 2.
Solution 1. First, setting x = 0 in (1) we get
                                           f (0) = f (0)⌊f (y)⌋                                      (2)
for all y ∈ R. Now, two cases are possible.
    Case 1. Assume that f (0) ̸= 0. Then from (2) we conclude that ⌊f (y)⌋ = 1 for all y ∈ R.
Therefore, equation (1) becomes f (⌊x⌋y) = f (x), and substituting y = 0 we have f (x) = f (0) =
C ̸= 0. Finally, from ⌊f (y)⌋ = 1 = ⌊C⌋ we obtain that 1 ≤ C < 2.
    Case 2. Now we have f (0) = 0. Here we consider two subcases.
    Subcase 2a. Suppose that there exists 0 < α < 1 such that f (α) ̸= 0. Then setting x = α in (1)
we obtain 0 = f (0) = f (α)⌊f (y)⌋ for all y ∈ R. Hence, ⌊f (y)⌋ = 0 for all y ∈ R. Finally, substituting
x = 1 in (1) provides f (y) = 0 for all y ∈ R, thus contradicting the condition f (α) ̸= 0.
    Subcase 2b. Conversely, we have f (α) = 0 for all 0 ≤ α < 1. Consider any real z; there exists an
                           z
integer N such that α =       ∈ [0, 1) (one may set N = ⌊z⌋ + 1 if z ≥ 0 and N = ⌊z⌋ − 1 otherwise).
                           N
Now, from (1) we get f (z) = f (⌊N ⌋α) = f (N )⌊f (α)⌋ = 0 for all z ∈ R.
    Finally, a straightforward check shows that all the obtained functions satisfy (1).
Solution 2. Assume that ⌊f (y)⌋ = 0 for some y; then the substitution x = 1 provides f (y) =
f (1)⌊f (y)⌋ = 0. Hence, if ⌊f (y)⌋ = 0 for all y, then f (y) = 0 for all y. This function obviously
satisfies the problem conditions.
    So we are left to consider the case when ⌊f (a)⌋ ̸= 0 for some a. Then we have
                                                                      f (⌊x⌋a)
                           f (⌊x⌋a) = f (x)⌊f (a)⌋,      or f (x) =            .                     (3)
                                                                       ⌊f (a)⌋
This means that f (x1 ) = f (x2 ) whenever ⌊x1 ⌋ = ⌊x2 ⌋, hence f (x) = f (⌊x⌋), and we may assume
that a is an integer.
   Now we have                     (      )        ⌊ ( )⌋
                         f (a) = f 2a · 12 = f (2a) f 12 = f (2a)⌊f (0)⌋;
this implies ⌊f (0)⌋ ̸= 0, so we may even assume that a = 0. Therefore equation (3) provides
                                                   f (0)
                                        f (x) =           = C ̸= 0
                                                  ⌊f (0)⌋
8
for each x. Now, condition (1) becomes equivalent to the equation C = C⌊C⌋ which holds exactly
when ⌊C⌋ = 1.
Problem 2. Let I be the incentre of triangle ABC and let Γ be its circumcircle. Let the line AI
                                                    \ and F a point on the side BC such that
intersect Γ again at D. Let E be a point on the arc BDC
                                             ∠BAF = ∠CAE < 12 ∠BAC.
Finally, let G be the midpoint of the segment IF . Prove that the lines DG and EI intersect on Γ.
Solution 1. Let X be the second point of intersection of line EI with Γ, and L be the foot of the
bisector of angle BAC. Let G′ and T be the points of intersection of segment DX with lines IF
and AF , respectively. We are to prove that G = G′ , or IG′ = G′ F . By the Menelaus theorem
applied to triangle AIF and line DX, it means that we need the relation
                                   G′ F    T F AD              TF     ID
                              1=       ′
                                         =     ·      ,    or      =     .
                                   IG      AT ID               AT     AD
   Let the line AF intersect Γ at point K ̸= A (see Fig. 1); since ∠BAK = ∠CAE we have
d
BK = CE,d hence KE ∥ BC. Notice that ∠IAT = ∠DAK = ∠EAD = ∠EXD = ∠IXT , so
the points I, A, X, T are concyclic. Hence we have ∠IT A = ∠IXA = ∠EXA = ∠EKA, so
                                         TF      IL
IT ∥ KE ∥ BC. Therefore we obtain            =      .
                                         AT     AI
                                                      IL     CL
   Since CI is the bisector of ∠ACL, we get               =     . Furthermore, ∠DCL = ∠DCB =
                                                      AI     AC
∠DAB = ∠CAD = 12 ∠BAC, hence the triangles DCL and DAC are similar; therefore we get
CL      DC
     =      . Finally, it is known that the midpoint D of arc BC is equidistant from points I, B, C,
AC      AD
       DC      ID
hence       =      .
       AD      AD
   Summarizing all these equalities, we get
                                    TF     IL      CL     DC     ID
                                         =     =        =     =     ,
                                    AT     AI      AC     AD     AD
as desired.
                        X                                                           A
                                             A
                                                                B                       C
                                       III
                        TTT
                              G′
                                                                              D
                    F
          B                        L                 C
                K                                E
                              D                                        J
                            Fig. 1                                         Fig. 2
                                                                                                           9
                         AI     AD
Comment. The equality        =      is known and can be obtained in many different ways. For instance,
                         IL     DI
                                                                                        \ to the
one can consider the inversion with center D and radius DC = DI. This inversion takes BAC
                                          IL   AI
segment BC, so point A goes to L. Hence      =    , which is the desired equality.
                                         DI    AD
Solution 2. As in the previous solution, we introduce the points X, T and K and note that it
suffice to prove the equality
            TF     DI             T F + AT     DI + AD            AT        AF
                =         ⇐⇒                 =             ⇐⇒         =          .
            AT     AD                 AT         AD               AD     DI + AD
Since ∠F AD = ∠EAI and ∠T DA = ∠XDA = ∠XEA = ∠IEA, we get that the triangles AT D
                               AT      AI
and AIE are similar, therefore     =      .
                               AD     AE
    Next, we also use the relation DB = DC = DI. Let J be the point on the extension of
segment AD over point D such that DJ = DI = DC (see Fig. 2). Then ∠DJC = ∠JCD =
1
2
  (π − ∠JDC) = 12 ∠ADC = 12 ∠ABC = ∠ABI. Moreover, ∠BAI = ∠JAC, hence triangles ABI
                        AB      AI
and AJC are similar, so      =     , or AB · AC = AJ · AI = (DI + AD) · AI.
                         AJ     AC
    On the other hand, we get ∠ABF = ∠ABC = ∠AEC and ∠BAF = ∠CAE, so triangles ABF
                                         AF    AB
and AEC are also similar, which implies      =    , or AB · AC = AF · AE.
                                         AC    AE
    Summarizing we get
                                                  AI        AF           AT        AF
     (DI + AD) · AI = AB · AC = AF · AE ⇒              =            ⇒        =         ,
                                                  AE     AD + DI         AD    AD + DI
as desired.
Comment. In fact, point J is an excenter of triangle ABC.
Problem 3. Let N be the set of positive integers. Determine all functions g : N → N such that
                                   (          )(        )
                                    g(m) + n m + g(n)
is a perfect square for all m, n ∈ N.
Answer. All functions of the form g(n) = n + c, where c ∈ N ∪ {0}.
Solution. First, it is clear that all functions of( the form)(g(n) = n +   ) c with a constant  nonnegative
                                                                                           2
integer c satisfy the problem conditions since g(m) + n g(n) + m = (n + m + c) is a square.
    We are left to prove that there are no other functions. We start with the following
                                                                                                 
Lemma. Suppose that p  g(k) − g(ℓ) for some prime p and positive integers k, ℓ. Then p  k − ℓ.
                              
Proof. Suppose first that p2  g(k) − g(ℓ), so g(ℓ) = g(k) + p2 a for some integer a. Take some positive
integer D > max{g(k), g(ℓ)} which is not divisible(            ) set n = pD − g(k). Then the positive
                                                        by p and
numbers n + g(k) = pD and n + g(ℓ) = pD + g(ℓ) − g(k) = p(D + pa) are both              ( divisible
                                                                                                 )( by p but)
         2
not by
     ( p   . Now,
               )( applying
                         )  the problem  conditions,  we get that both    the  numbers   g(k) + n   g(n) + k
                                                                        2
and g(ℓ) + n g(n) + ℓ are squares divisible by p (and thus    ( by p );)this( means that) the multipliers
g(n) + k and g(n) + ℓ are also divisible by p, therefore p  g(n) + k − g(n) + ℓ = k − ℓ as well.
    On the other hand, if g(k)−g(ℓ) is divisible by p but not by p2 , then choose the same  ( number D)and
set n = p D −g(k). Then the positive numbers g(k)+n = p D and g(ℓ)+n = p D + g(ℓ)−g(k) are
           3                                                    3                     3
respectively divisible by p3 (but not by p4 ) and by p (but not by p2 ). Hence
                                                                             ( in analogous
                                                                                      ) ( way we   ) obtain                                                                            
that the numbers g(n) + k and g(n) + ℓ are divisible by p, therefore p g(n) + k − g(n) + ℓ = k − ℓ.
10
    We turn to the problem. First, suppose that g(k) = g(ℓ) for some k, ℓ ∈ N. Then by Lemma we
have that k − ℓ is divisible by every prime number, so k − ℓ = 0, or k = ℓ. Therefore, the function g
is injective.
    Next, consider the numbers g(k) and g(k + 1). Since the number (k + 1) − k = 1 has no prime
divisors, by Lemma the same holds for g(k + 1) − g(k); thus |g(k + 1) − g(k)| = 1.
    Now, let g(2) − g(1) = q, |q| = 1. Then we prove by induction that g(n) = g(1) + q(n − 1). The
base for n = 1, 2 holds by the definition of q. For the step, if n > 1 we have g(n + 1) = g(n) ± q =
g(1) + q(n − 1) ± q. Since g(n) ̸= g(n − 2) = g(1) + q(n − 2), we get g(n) = g(1) + qn, as desired.
    Finally, we have g(n) = g(1) + q(n − 1). Then q cannot be −1 since otherwise for n ≥ g(1) + 1
we have g(n) ≤ 0 which is impossible. Hence q = 1 and g(n) = (g(1) − 1) + n for each n ∈ N, and
g(1) − 1 ≥ 0, as desired.
Problem 4. Let P be a point inside the triangle ABC. The lines AP , BP and CP intersect the
circumcircle Γ of triangle ABC again at the points K, L and M respectively. The tangent to Γ at C
intersects the line AB at S. Suppose that SC = SP . Prove that M K = M L.
Solution 1. We assume that CA > CB, so point S lies on the ray AB.
                                                                    PM   PA
  From the similar triangles △P KM ∼ △P CA and △P LM ∼ △P CB we get    =    and
                                                                    KM   CA
LM    CB
    =    . Multiplying these two equalities, we get
PM    PB
                                         LM   CB P A
                                            =   ·    .
                                         KM   CA P B
                                                  CB       PB
Hence, the relation M K = M L is equivalent to          =     .
                                                   CA      PA
    Denote by E the foot of the bisector of angle B in triangle ABC. Recall that the locus of points X
           XA     CA
for which      =       is the Apollonius circle Ω with the center Q on the line AB, and this circle
          XB      CB
passes through C and E. Hence, we have M K = M L if and only if P lies on Ω, that is QP = QC.
                                                                  Ω
                           L
                                                          C
                                                          C
                                                          C
                                            P
                                            P
                                            P
                                                                            S
                       A                     E                B
                                 M
                                                 Fig. 1
                                                                                                   11
   Now we prove that S = Q, thus establishing the problem statement. We have ∠CES = ∠CAE +
∠ACE = ∠BCS + ∠ECB = ∠ECS, so SC = SE. Hence, the point S lies on AB as well as on the
perpendicular bisector of CE and therefore coincides with Q.
Comment. In this solution we proved more general fact: SC = SP if and only if M K = M L.
Solution 2. As in the previous solution, we assume that S lies on the ray AB.
    Let P be an arbitrary point inside both the circumcircle ω of the triangle ABC and the angle
ASC, the points K, L, M defined as in the problem.
    Let E and F be the points of intersection of the line SP with ω, point E lying on the segment SP
(see Fig. 2).
                                         F                    L
                                                                          K
                                 ω
                                                                          C
                                                          P
                                                          P
                                                          P
                                 M
                                                                  E
                                             A            B           S
                                                 Fig. 2
                                 SP   SA
   We have SP 2 = SC 2 = SA · SB, so=    , and hence △P SA ∼ △BSP . Then ∠BP S =
                                 SB   SP
                      d + LF
∠SAP . Since 2∠BP S = BE  c and 2∠SAP = BE
                                         d + EKd we have
                                             c = EK.
                                             LF  d                                                 (4)
                                             d+M
On the other hand, from ∠SP C = ∠SCP we have EC d    d + EM
                                                 F = EC  d , or
                                             d
                                             M     d.
                                               F = EM                                              (5)
                            \
    From (4) and (5) we get M      d
                              FL = M F + FcL = M
                                               d     d =M
                                                 E + EK \ EK and hence M K = M L. The
claim is proved.
Problem 5. In each of six boxes B1 , B2 , B3 , B4 , B5 , B6 there is initially one coin. There are two
types of operation allowed:
  Type 1: Choose a nonempty box Bj with 1 ≤ j ≤ 5. Remove one coin from Bj and add two
          coins to Bj+1 .
  Type 2: Choose a nonempty box Bk with 1 ≤ k ≤ 4. Remove one coin from Bk and exchange
          the contents of (possibly empty) boxes Bk+1 and Bk+2 .
12
Determine whether there is a finite sequence of such operations that results in boxes B1 , B2 , B3 , B4 , B5
                                                     2010                      c     c
being empty and box B6 containing exactly 20102010        coins. (Note that ab = a(b ) .)
Answer. Yes. There exists such a sequence of moves.
Solution. Denote by (a1 , a2 , . . . , an ) → (a′1 , a′2 , . . . , a′n ) the following: if some consecutive boxes
contain a1 , . . . , an coins, then it is possible to perform several allowed moves such that the boxes
contain a′1 , . . . , a′n coins respectively, whereas the contents of the other boxes remain unchanged.
                            2010
   Let A = 20102010 , respectively. Our goal is to show that
                                         (1, 1, 1, 1, 1, 1) → (0, 0, 0, 0, 0, A).
     First we prove two auxiliary observations.
Lemma 1. (a, 0, 0) → (0, 2a , 0) for every a ≥ 1.
Proof. We prove by induction that (a, 0, 0) → (a − k, 2k , 0) for every 1 ≤ k ≤ a. For k = 1, apply
Type 1 to the first box:
                                      (a, 0, 0) → (a − 1, 2, 0) = (a − 1, 21 , 0).
   Now assume that k < a and the statement holds for some k < a. Starting from (a − k, 2k , 0),
apply Type 1 to the middle box 2k times, until it becomes empty. Then apply Type 2 to the first
box:
           (a − k, 2k , 0) → (a − k, 2k − 1, 2) → · · · → (a − k, 0, 2k+1 ) → (a − k − 1, 2k+1 , 0).
Hence,
                              (a, 0, 0) → (a − k, 2k , 0) → (a − k − 1, 2k+1 , 0).                            
                                                                    2
                                                                  ..
                                                                2.
                                                          (e.g. P3 = 22 = 16). Then (a, 0, 0, 0) →
                                                                                     2
Lemma 2.      For every positive integer n, let Pn = |{z}
                                                     2
                                                                 n
(0, Pa , 0, 0) for every a ≥ 1.
Proof. Similarly to Lemma 1, we prove that (a, 0, 0, 0) → (a − k, Pk , 0, 0) for every 1 ≤ k ≤ a.
   For k = 1, apply Type 1 to the first box:
                                  (a, 0, 0, 0) → (a − 1, 2, 0, 0) = (a − 1, P1 , 0, 0).
   Now assume that the lemma holds for some k < a. Starting from (a − k, Pk , 0, 0), apply Lemma 1,
then apply Type 1 to the first box:
           (a − k, Pk , 0, 0) → (a − k, 0, 2Pk , 0) = (a − k, 0, Pk+1 , 0) → (a − k − 1, Pk+1 , 0, 0).
Therefore,
                          (a, 0, 0, 0) → (a − k, Pk , 0, 0) → (a − k − 1, Pk+1 , 0, 0).                       
                                                                                                                                                  13
   Now we prove the statement of the problem.
   First apply Type 1 to box 5, then apply Type 2 to boxes B4 , B3 , B2 and B1 in this order. Then
apply Lemma 2 twice:
       (1, 1, 1, 1, 1, 1) → (1, 1, 1, 1, 0, 3) → (1, 1, 1, 0, 3, 0) → (1, 1, 0, 3, 0, 0) → (1, 0, 3, 0, 0, 0) →
               → (0, 3, 0, 0, 0, 0) → (0, 0, P3 , 0, 0, 0) = (0, 0, 16, 0, 0, 0) → (0, 0, 0, P16 , 0, 0).
We already have more than A coins in box B4 , since
                     2010                  2010                2010             2011           11 )2011          11·2011          215
     A ≤ 20102010           < (211 )2010          = 211·2010          < 22010          < 2(2              = 22             < 22         < P16 .
   To decrease the number of coins in box B4 , apply Type 2 to this stack repeatedly until its size
decreases to A/4. (In every step, we remove a coin from B4 and exchange the empty boxes B5
and B6 .)
                   (0, 0, 0, P16 , 0, 0) → (0, 0, 0, P16 − 1, 0, 0) → (0, 0, 0, P16 − 2, 0, 0) →
                                           → · · · → (0, 0, 0, A/4, 0, 0).
   Finally, apply Type 1 repeatedly to empty boxes B4 and B5 :
                 (0, 0, 0, A/4, 0, 0) → · · · → (0, 0, 0, 0, A/2, 0) → · · · → (0, 0, 0, 0, 0, A).
Comment. Starting with only 4 boxes, it is not hard to check manually that we can achieve at most 28
coins in the last position. However, around 5 and 6 boxes the maximal number of coins explodes. With 5
                                            14
boxes it is possible to achieve more than 22 coins. With 6 boxes the maximum is greater than PP 14 .
                                                                                                                                             2
Problem 6. Let a1 , a2 , a3 , . . . be a sequence of positive real numbers. Suppose that for some
positive integer s, we have
                                 an = max{ak + an−k | 1 ≤ k ≤ n − 1}                           (6)
for all n > s. Prove that there exist positive integers ℓ and N , with ℓ ≤ s and such that an = aℓ +an−ℓ
for all n ≥ N .
Solution 1. First, from the problem conditions we have that each an (n > s) can be expressed as
an = aj1 + aj2 with j1 , j2 < n, j1 + j2 = n. If, say, j1 > s then we can proceed in the same way
with aj1 , and so on. Finally, we represent an in a form
                                                   an = ai1 + · · · + aik ,                                                                       (7)
                                              1 ≤ ij ≤ s, i1 + · · · + ik = n.                                                                    (8)
Moreover, if ai1 and ai2 are the numbers in (7) obtained on the last step, then i1 + i2 > s. Hence we
can adjust (8) as
                             1 ≤ ij ≤ s, i1 + · · · + ik = n, i1 + i2 > s.                         (9)
   On the other hand, suppose that the indices i1 , . . . , ik satisfy the conditions (9). Then, denoting
sj = i1 + · · · + ij , from (6) we have
                   an = ask ≥ ask−1 + aik ≥ ask−2 + aik−1 + aik ≥ · · · ≥ ai1 + · · · + aik .
Summarizing these observations we get the following
14
Claim. For every n > s, we have
                   an = max{ai1 + · · · + aik : the collection (i1 , . . . , ik ) satisfies (9)}.               
     Now we denote
                                                               ai
                                                  m = max
                                                         1≤i≤s i
                                              aℓ
and fix some index ℓ ≤ s such that m =            .
                                               ℓ
    Consider some n ≥ s2 ℓ + 2s and choose an expansion of an in the form (7), (9). Then we have
n = i1 + · · · + ik ≤ sk, so k ≥ n/s ≥ sℓ + 2. Suppose that none of the numbers i3 , . . . , ik equals ℓ.
Then by the pigeonhole principle there is an index 1 ≤ j ≤ s which appears among i3 , . . . , ik at
least ℓ times, and surely j ̸= ℓ. Let us delete these ℓ occurrences of j from (i1 , . . . , ik ), and add
j occurrences of ℓ instead, obtaining a sequence (i1 , i2 , i′3 , . . . , i′k′ ) also satisfying (9). By Claim, we
have
                            ai1 + · · · + aik = an ≥ ai1 + ai2 + ai′3 + · · · + ai′k′ ,
                                                                 aℓ  aj
or, after removing the coinciding terms, ℓaj ≥ jaℓ , so             ≤ . By the definition of ℓ, this means
                                                                 ℓ   j
that ℓaj = jaℓ , hence
                                       an = ai1 + ai2 + ai′3 + · · · + ai′k′ .
Thus, for every n ≥ s2 ℓ + 2s we have found a representation of the form (7), (9) with ij = ℓ for
some j ≥ 3. Rearranging the indices we may assume that ik = ℓ.
   Finally, observe that in this representation, the indices (i1 , . . . , ik−1 ) satisfy the conditions (9)
with n replaced by n − ℓ. Thus, from the Claim we get
                                 an−ℓ + aℓ ≥ (ai1 + · · · + aik−1 ) + aℓ = an ,
which by (6) implies
                                 an = an−ℓ + aℓ         for each n ≥ s2 ℓ + 2s,
as desired.
Solution 2. As in the previous solution, we involve the expansion (7), (8), and we fix some index
1 ≤ ℓ ≤ s such that
                                         aℓ             ai
                                            = m = max .
                                         ℓ        1≤i≤s i
Now, we introduce the sequence (bn ) as bn = an − mn; then bℓ = 0.
   We prove by induction on n that bn ≤ 0, and (bn ) satisfies the same recurrence relation as (an ).
The base cases n ≤ s follow from the definition of m. Now, for n > s from the induction hypothesis
we have
      bn = max (ak + an−k ) − nm = max (bk + bn−k + nm) − nm = max (bk + bn−k ) ≤ 0,
           1≤k≤n−1                         1≤k≤n−1                                 1≤k≤n−1
as required.
    Now, if bk = 0 for all 1 ≤ k ≤ s, then bn = 0 for all n, hence an = mn, and the statement is
trivial. Otherwise, define
                            M = max |bi |,      ε = min{|bi | : 1 ≤ i ≤ s, bi < 0}.
                                   1≤i≤s
                                                                                                             15
Then for n > s we obtain
                               bn = max (bk + bn−k ) ≥ bℓ + bn−ℓ = bn−ℓ ,
                                     1≤k≤n−1
so
                                    0 ≥ bn ≥ bn−ℓ ≥ bn−2ℓ ≥ · · · ≥ −M.
   Thus, in view of the expansion (7), (8) applied to the sequence (bn ), we get that each bn is
contained in a set
                      T = {bi1 + bi2 + · · · + bik : i1 , . . . , ik ≤ s} ∩ [−M, 0]
We claim that this set is finite. Actually, for any x ∈ T , let x = bi1 + · · · + bik (i1 , . . . , ik ≤ s). Then
                                   M                                     M
among bij ’s there are at most           nonzero terms (otherwise x <       · (−ε) < −M ). Thus x can be
                                    ε                                     ε
                                           M
expressed in the same way with k ≤            , and there is only a finite number of such sums.
                                            ε
   Finally, for every t = 1, 2, . . . , ℓ we get that the sequence
                                           bs+t , bs+t+ℓ , bs+t+2ℓ , . . .
is non-decreasing and attains the finite number of values; therefore it is constant from some index.
Thus, the sequence (bn ) is periodic with period ℓ from some index N , which means that
                               bn = bn−ℓ = bn−ℓ + bℓ            for all n > N + ℓ,
and hence
          an = bn + nm = (bn−ℓ + (n − ℓ)m) + (bℓ + ℓm) = an−ℓ + aℓ                   for all n > N + ℓ,
as desired.