5. Determine the largest natural number $n$ such that there exists a sequence of $n$ real numbers with the following properties:

(i) the sum of any three consecutive terms of the sequence is positive,

(ii) the sum of any five consecutive terms of the sequence is negative.
Solution.

For $n=6$ there exists a sequence with the desired property, for example,

$$
3,-5,3,3,-5,3
$$

(5 points)

Note. A student who finds only an example for $n=5$, (e.g., $-1-13-1-1$) gets 2 points.

Assume there exists a sequence of length $n \geqslant 7$ with the desired property. Choose any 7 consecutive terms

$$
a_{1}, a_{2}, a_{3}, a_{4}, a_{5}, a_{6}, a_{7}
$$

of such a sequence. Then, due to (i), we have

$$
\begin{aligned}
& \text { (1) }\left\{\begin{array}{l}
a_{1}+a_{2}+a_{3}>0 \\
a_{2}+a_{3}+a_{4}>0 \\
a_{3}+a_{4}+a_{5}>0 \\
a_{4}+a_{5}+a_{6}>0 \\
a_{5}+a_{6}+a_{7}>0
\end{array}\right. \\
& \text { (2) }\left\{\begin{array}{l}
a_{1}+a_{2}+a_{3}+a_{4}+a_{5}<0 \\
a_{2}+a_{3}+a_{4}+a_{5}+a_{6}<0 \\
a_{3}+a_{4}+a_{5}+a_{6}+a_{7}<0
\end{array}\right.
\end{aligned}
$$

By adding the inequalities (1),

$$
\left(a_{1}+a_{2}+a_{3}\right)+\left(a_{2}+a_{3}+a_{4}\right)+\left(a_{3}+a_{4}+a_{5}\right)+\left(a_{4}+a_{5}+a_{6}\right)+\left(a_{5}+a_{6}+a_{7}\right)>0
$$

By adding the inequalities (2),

$$
\left(a_{1}+a_{2}+a_{3}+a_{4}+a_{5}\right)+\left(a_{2}+a_{3}+a_{4}+a_{5}+a_{6}\right)+\left(a_{3}+a_{4}+a_{5}+a_{6}+a_{7}\right)<0
$$

The left sides of these inequalities are equal, leading to a contradiction.

(10 points) Therefore, $n<7$. The longest such sequence has 6 terms.