# If $n$ is a positive integer such that $2^n+n^2$ is a prime number , then is it true that $6|n-3$ ?

If $n$ is a positive integer such that $2^n+n^2$ is a prime number , then is it true that $6|n-3$ ? Trivially $n$ cannot be even , so this leaves us only with the possibilities $n \equiv1,3,5( \mod 6)$ , but I cannot reduce the cases . Please help , Thanks in advance .

• @Mesih $17$ is prime and $6|0$, no? – hunter Apr 4 '15 at 13:37
• Note that if $n$ "cannot be even", then $n$ is odd, so $n-3$ is even. Therefore you are done with $2\mid n-3$, and only $3\mid n-3$ needs to be shown. – hardmath Apr 4 '15 at 13:40
• What about $n=1$? – Mike Apr 4 '15 at 13:40
• @hardmath : that is , only $3|n$ – user228168 Apr 4 '15 at 13:40
• @Mike : As is clear from ajotatxe's answer , $2^n+n^2$ can be a multiple of $3$ , so we need $2^n+n^2 >3$ i.e. $n>1$ – user228168 Apr 4 '15 at 13:49

If $n\equiv1,5\pmod 6$ then $n^2\equiv 1\pmod 6$.

On the other hand, $2^n\equiv 2$ or $4\pmod 6$ depending on $n$ is odd or even. So if $n^2\equiv 1\pmod 6$, then $$2^n+n^2\equiv 2+1\equiv 3\pmod 6$$ therefore $2^n+n^2$ is a multiple of three.

Notice the case $1^2+2^1$, that is the only exception to your statement.

$$2^{6a+1}+(6a+1)^2=64^a\cdot2+(6a+1)^2\equiv0\pmod3$$ as $64\equiv1\pmod3\implies64^a\equiv1^a$

Similarly, $$2^{6a+5}+(6a+5)^2=64^a\cdot32+36a^2+60a+25\equiv0\pmod3$$

Alternatively, if $(n,3)=1,n\equiv\pm1\pmod3\implies n^2\equiv1$

$2^n+n^2\equiv2^n+1\pmod3\iff(-1)^n+1$

Now $(-1)^n+1\equiv0\pmod3$ which is true if $n$ is odd

We need $n\equiv1\pmod2$ and $n\equiv\pm1\pmod3\implies n\equiv1,5\pmod6$

• As $6a+5\equiv-1\pmod3\implies(6a+5)^2\equiv1\pmod3,$ one needs not expand the last square. – awllower Apr 4 '15 at 13:43