Maths Olympiad Prep

Track / Stage 6 / 303 of 400 #1303 of 1964

Problem 1303

National olympiad, first round
Number theory Difficulty 6.5 Find the answer

for a positive integer nn, there are positive integers a1,a2,...ana_1, a_2, ... a_n that satisfy these two.
(1) a1=1,an=2020a_1=1, a_n=2020
(2) for all integer ii, iisatisfies 2in,aiai1=22\leq i\leq n, a_i-a_{i-1}=-2 or 33.
find the greatest nn

A number or a short expression. Spacing and $ signs are ignored.

Official solution

1. Let x x be the number of values of i i where aiai1=3 a_i - a_{i-1} = 3 and y y be the number of values of i i where aiai1=2 a_i - a_{i-1} = -2 .
2. From the given conditions, we have:
a1=1andan=2020 a_1 = 1 \quad \text{and} \quad a_n = 2020
Therefore, we can write:
1+3x2y=2020 1 + 3x - 2y = 2020
Simplifying, we get:
3x2y=2019 3x - 2y = 2019
3. We also know that the total number of steps from a1 a_1 to an a_n is n1 n-1 , so:
x+y=n1 x + y = n - 1
4. To find n n , we need to solve the system of equations:
{3x2y=2019x+y=n1 \begin{cases} 3x - 2y = 2019 \\ x + y = n - 1 \end{cases}
5. Solving for y y in terms of x x from the second equation:
y=n1x y = n - 1 - x
6. Substituting y y into the first equation:
3x2(n1x)=2019 3x - 2(n - 1 - x) = 2019
Simplifying, we get:
3x2n+2+2x=2019 3x - 2n + 2 + 2x = 2019
5x2n+2=2019 5x - 2n + 2 = 2019
5x2n=2017 5x - 2n = 2017
7. Solving for n n :
2n=5x2017 2n = 5x - 2017
n=5x20172 n = \frac{5x - 2017}{2}
8. Since n n must be an integer, 5x2017 5x - 2017 must be even. This implies x x must be odd because 2017 is odd.
9. To maximize n n , we need to find the largest x x such that n n is still a positive integer. Since x x must be odd, let x=2k+1 x = 2k + 1 for some integer k k .
10. Substituting x=2k+1 x = 2k + 1 into the equation for n n :
n=5(2k+1)20172 n = \frac{5(2k + 1) - 2017}{2}
n=10k+520172 n = \frac{10k + 5 - 2017}{2}
n=10k20122 n = \frac{10k - 2012}{2}
n=5k1006 n = 5k - 1006
11. To ensure n n is maximized, we need k k to be as large as possible while keeping n n positive. The smallest k k such that n n is positive is when:
5k1006>0 5k - 1006 > 0
5k>1006 5k > 1006
k>201.2 k > 201.2
Since k k must be an integer, the smallest k k is 202.
12. Substituting k=202 k = 202 into the equation for n n :
n=5(202)1006 n = 5(202) - 1006
n=10101006 n = 1010 - 1006
n=4 n = 4
This is incorrect, so we need to re-evaluate our approach. Instead, we should consider the constraints and the sequence construction directly.
13. Given the constraints, we can construct a sequence that satisfies the conditions for n=2019 n = 2019 :
a2=4,a3=2,a4=5,a5=3,,a2019=2020 a_2 = 4, a_3 = 2, a_4 = 5, a_5 = 3, \ldots, a_{2019} = 2020
This sequence can be constructed by ensuring the differences are either 3 3 or 2 -2 and the sequence reaches 2020 at the 2019th term.

Therefore, the largest possible value of n n is 2019 \boxed{2019} .

Source: NuminaMath-1.5, licensed Apache-2.0. Statement and solution reproduced as published; topic, difficulty and ordering added by this site.