6. Let $a_{0}=0, a_{1}=a_{2}=1, a_{3 n}=a_{n}, a_{3 n+1}=a_{3 n+2}=a_{n}+1(n \geqslant 1)$, then $a_{2021}=$
$$
\begin{array}{l}
a_{2021}=a_{3 \cdot 673+2}=a_{673}+1=a_{3 \cdot 224+1}+1=a_{224}+2=a_{3 \cdot 74+2}+2=a_{74}+3 \\
=a_{3 \cdot 24+2}+3=a_{24}+4=a_{8}+4=a_{3 \cdot 2+2}+4=a_{2}+5=6 .
\end{array}
$$