6. Given the sequence $\left\{a_{n}\right\}$ has a period of $7$, and $\left\{b_{n}\right\}$ has a period of $13$. If there exist $k$ consecutive terms satisfying
$$
a_{1}=b_{1}, a_{2}=b_{2}, \cdots, a_{k}=b_{k},
$$

then the maximum value of $k$ is $\qquad$
6. 18 .

First, let the first 7 terms of the sequence $\left\{a_{n}\right\}$ be $1,1,1,1$, $1,2,1$;

the first 13 terms of the sequence $\left\{b_{n}\right\}$ be $1,1,1,1,1,2,1$, $1,1,1,1,1,2$.
It is easy to see that $k=18$ meets the requirement.
Second, if $a_{19}=b_{19}$, then
$$
\begin{array}{l}
a_{6}=b_{6}=b_{19}=a_{19}=a_{5}=b_{5}=b_{18}=a_{18}=a_{4}=b_{4} \\
=b_{17}=a_{17}=a_{3}=b_{3}=b_{16}=a_{16}=a_{2}=b_{2} \\
=b_{15}=a_{15}=a_{1}=b_{1}=b_{14}=a_{14}=a_{7} .
\end{array}
$$

At this point, the period of the sequence $\left\{a_{n}\right\}$ is 1, which contradicts the given information.