Lemma: $\gcd(a^n - 1, a^m - 1) = a^{\gcd(n, m)} - 1$
Proof: Several proofs can be found here
$4^n+2^n+1 = \frac{8^n-1}{2^n-1}$. Let $n=3^t \times k$, where $k$ is not divisible by $3$. The numerator becomes $8^{3^t \times k}-1 = \left( {8^{3^t}} \right) ^k-1$, which has a factor $\left(8^{3^t}-1 \right)$.
The denominator becomes $2^{3^t \times k}-1$. By our lemma, $\gcd(8^{3^t}-1, 2^{3^t \times k}-1)$ $= \gcd(8^{3^t}-1, 8^{3^{t-1} \times k}-1)$ $ = 8^{\gcd(3^t, {3^{t-1} \times k})} - 1 = 8^{3^{t-1}}-1 = 2^{3^{t}}-1$, since $3 \nmid k$.
We now rewrite the fraction $\frac{8^n-1}{2^n-1}$as follows:
$$\frac{ \left( 2^{3^{t}}-1 \right) \left( {\left(2^{3^{t}}\right)}^2 + 2^{3^{t}} +1\right) \left( {\left(8^{3^{t}}\right)}^{k-1} + {\left(8^{3^{t}}\right)}^{k-2} + ... +1\right)}{\left( 2^{3^{t}}-1 \right) \left( {\left(2^{3^{t}}\right)}^{k-1} + {\left(2^{3^{t}}\right)}^{k-2} + ... +1\right)}$$
$\gcd\left( \left( {\left(2^{3^{t}}\right)}^2 + 2^{3^{t}} +1\right),\left( {\left(2^{3^{t}}\right)}^{k-1} + {\left(2^{3^{t}}\right)}^{k-2} + ... +1\right) \right) = 1$, so the only way the fraction cancels to a prime is when $\left( {\left(8^{3^{t}}\right)}^{k-1} + {\left(8^{3^{t}}\right)}^{k-2} + ... +1\right)$ $=\left( {\left(2^{3^{t}}\right)}^{k-1} + {\left(2^{3^{t}}\right)}^{k-2} + ... +1\right)$. This only occurs when $k=1$. Hence, $n$ is of the form $3^t$.