<s>[INST] If $1+2^n+4^n$ is prime number then prove that $n=3^k$ for some $k\in \mathbb{N}$. If $1+2^n+4^n$ is prime number then prove that $n=3^k$ for some $k\in \mathbb{N}$.
I've looked at https://math.stackexchange.com/a/186723/283318 for an inspiration. In base 2, $1+2^n+4^n=10\ldots010\ldots01$ and I am completely stuck. 
 [/INST] Let's solve a slightly more general problem and let's do it a novel way: Consider the function, for fixed $a$:
$$f_a(n)=1+a^n+a^{2n}.$$
We are here wondering about the case $a=2$. We will prove the following statement:

$f_a(1)$ divides $f_a(3n+1)$ and $f_a(3n+2)$ for any non-negative integer $n$.

This proves to be remarkably easy; we can notice that $f_a$ satisfies the following recurrence (whose derivation is shown below; it is easy to verify algebraically, but looks like magic if I just plop it in):
$$f_a(n+3)=(1+a+a^2)f_a(n+2)-(a+a^2+a^3)f_a(n+1)+a^3f(n)$$
We take this mod $f_a(1)=1+a+a^2$ since we only care about whether $f_a(1)$ divides $f_a(n)$. Notice that $a^3\equiv 1\pmod{f_a(1)}$ as it can be written $(a-1)f_a(1)+1$. The other coefficients are obviously $0$ mod $f_a(1)$ so we get
$$f_a(n+3)\equiv f_a(n)\pmod{f_a(1)}$$
which tells us that if $f_a(1)$ divides $f_a(n)$ it divides $f_a(n+3)$ as well. Obviously $f_a(1)$ divides itself, so it divides $f_a(3n+1)$ for non-negative integer $n$. Moreover, one may check the following identity (found by polynomial division):
$$1+a^2+a^4=(1-a+a^2)(1+a+a^2)$$
which tells us that $f_a(1)$ divides $f_a(2)$ too.
From here, it is easy: Notice that for $f_a(n)$ to be prime, it must be that $n$ is either $1$ or a multiple of $3$ since otherwise $f_a(1)$ is a proper factor. However, if we factor $n=3^k\cdot m$ for $m$ coprime to $3$. Then $f_a(3^k\cdot m)=f_{a^{3^k}}(m)$ which may only be a prime if $m$ is $1$ (since $m$ is not a multiple of $3$). Thus, $n=3^k$ if $f_a(n)$ is prime.

To find the recurrence, I noted that
$$\frac{1}{1-cx}=1+cx+c^2x^2+c^3x^3+\ldots$$
so the series $f(n)$ has generating function
$$\frac{1}{1-x}+\frac{1}{1-ax}+\frac{1}{1-a^2x}=f(0)+f(1)x+f(2)x^2+\ldots$$
which, putting the fraction together gives
$$\frac{\text{something awful}}{(1-x)(1-ax)(1-a^2x)}=f(0)+f(1)x+f(2)x^2+\ldots$$
or expanding the denominator
$$\frac{\text{something awful}}{1-(1+a+a^2)x+(a+a^2+a^3)x^2-a^3x^3}=f(0)+f(1)x+f(2)x^2+\ldots$$
The awful stuff on top is a quadratic polynomial. Thus, if we multiply through by the denominator, the coefficients of $x^3$ and higher on the left hand must vanish in order to equal the left side; the coefficient of $x^{n+3}$ is $$f(n+3)-(1+a+a^2)f(n+2)+(a+a^2+a^3)f(n+1)-a^3f(n)=0$$
and then we just isolate $f(n+3)$ to get the recurrence.
</s>