5. Given the sequence $\left\{a_{n}\right\}$, where $a_{1}=3$, and for any $n \in \mathbf{N}_{+}$ it satisfies $a_{n}=\sqrt{\frac{a_{n+1}}{3}}$, then $a_{n}=$ $\qquad$
5. $3^{2^{n}-1}$ Detailed Explanation: From the problem, we know that $a_{n}>0, a_{n+1}=3 a_{n}^{2}$. Taking the logarithm of both sides with base 3, we get $\log _{3} a_{n+1}=2 \log _{3} a_{n}+1$, which means $\left(\log _{3} a_{n+1}+1\right)=2\left(\log _{3} a_{n}+1\right)$. Therefore, $\log _{3} a_{n}+1=2^{n-1}\left(\log _{3} a_{1}+1\right)=2^{n}$, solving for $a_{n}$ yields $a_{n}=3^{2^{n}-1}$.