Kanel-Belov A.Y.

The periods of two sequences are 7 and 13. What is the maximum length of the initial segment that can coincide?
Example. Consider the sequence with period 7 and initial terms $0,0,0,0,0,1,0$ and the sequence with period 13 and initial terms $0,0,0,0,0,1,0,0,0,0,0,0,1$. They have a common initial segment $0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0$ of length 18.

Estimate. If there is a common initial segment of length 19, then $a_{7}=a_{14}=a_{1}=a_{15}=a_{2}=a_{16}=a_{3}=a_{17}=a_{4}=a_{18}=a_{5}$ $=a_{19}=a_{6}$, which means the period of the first sequence is not 7 but 1. Contradiction.

## Answer

18.