find all primes $p$ such that $3^p-(p+2)^2$ is a prime find all primes $p$ such that $3^p-(p+2)^2$ is also a prime.
My proof
set  $3^p-(p+2)^2=q$
case $1$:$p=2 \implies q = -7 \notin \mathbb N$. so there is no solution.
case $2$: $p \geq 3$
notice that $p=3 \implies q = 2$ so there is a solution.
claim: with $p\geq 4$ there is no solution.
Proof: we gonna show that $3^p-(p+2)^2$ is always even, and we know that for $p\geq3$ there is no even prime.
so :$$q = 3^p-(p+2)^2= 3^p-p^2-4p-4$$ $3^p$ and $p^2$is odd and $-4p-4$ is even so :
$$odd + odd+even+even=even+even=even$$
therefore there is no solution with $p\geq4$.
is this a valid proof?
 A: Hint: As is very often the case, you don't need calculus when dealing only with integers. In stead of differentiating, you can consider the differences between consecutive values of $3^k-(k+2)^2$.

The details:
For every nonnegative integer $k$ define $f(k):=3^k-(k+2)^2$. With a bit of algebra you'll find that the first difference of this sequence equals
\begin{eqnarray*}
f(k+1)-f(k)&=&
\big(3^{k+1}-((k+1)+2)^2\big)-\big(3^k-(k+2)^2\big)\\
&=&\big(3^{k+1}-3^k\big)-\big((k+3)^2-(k+2)^2\big)\\
&=&3^k\big(3-1\big)-\big(2k+5\big)\\
&=&2\cdot3^k-2k-5.
\end{eqnarray*}
Similarly, the second difference equals
\begin{eqnarray*}
\big(2\cdot3^{k+1}-2(k+1)-5\big)-\big(2\cdot3^k-2k-5\big)
&=&\big(2\cdot3^{k+1}-2\cdot3^k\big)-\big(2(k+1)-2k\big)\\
&=&2\cdot3^k\big(3-1\big)-2\\
&=&4\cdot3^k-2.
\end{eqnarray*}
Clearly the second difference is positive for all $k\geq0$. Then looking at the first difference, for $k=2$ we have
$$2\cdot3^2-2\cdot2-5=4>0,$$
and hence the first difference is positive for all $k\ge2$. It follows that for all $p>3$ we have
$$f(p)>f(3)=2,$$
and hence $f(p)$ is not prime for any prime number $p>3$, because $f(p)$ is even and greater than $2$. For $p=2$ we have $f(2)=-7$ which is of course not prime. So $p=3$ is the unique prime number for which $f(p)$ is prime.
