# If $a^n+n^{a}$ is prime number and $a=3k-1$ then $n\equiv 0\pmod 3$?

Is it true that :

If $a^n+n^{a}$ is prime number and $a=3k-1$ then $n\equiv 0\pmod 3$

where $a>1,n>1 ; a,n,k \in \mathbb{Z^+}$

I have checked statement for many pairs $(a,n)$ and it seems to be true.

Small Maple code that prints $(a,n)$ pairs :

Any idea how to prove this statement ?

-

Since it is prime, we know that $a^n+n^a \equiv 1 \text{ or } 5 \mod 6$, and because $a \equiv 2 \mod 3$ we know that $a \equiv 2 \text{ or } 5 \mod 6.$

The case $a \equiv 2 \mod 6:$
Note that $n^2 \equiv n^8 \equiv n^{14} \dots \mod 6.$
When $n \equiv 0, 1, 2, 3, 4, 5 \mod 6, n^2 \equiv 0, 1, 4, 3, 4, 1 \mod 6$ and $2^n \equiv 4, 2, 4, 2, 4, 2 \mod 6.$
Adding these gives $a^n+n^a \equiv 4, 3, 2, 5, 2, 3 \mod 6$. 1 does not appear at all and 5 appears only when $n \equiv 3 \mod 6,$ meaning that $n \equiv 0 \mod 3,$ as required.

The case $a \equiv 5 \mod 6:$
Note that $n^5 \equiv n^{11} \equiv n^{17} \dots \mod 6.$
When $n \equiv 0, 1, 2, 3, 4, 5 \mod 6, n^5 \equiv 0, 1, 2, 3, 4, 5 \mod 6$ and $5^n \equiv 1, 5, 1, 5, 1, 5 \mod 6.$
Adding these gives $a^n+n^a \equiv 1, 0, 3, 2, 5, 4 \mod 6$. 1 appears only when $n \equiv 0\mod 6$, implying that $n \equiv 0 \mod 3,$ as required.
However, 5 appears as well, when $n \equiv 4 \mod 6,$ suggesting the possibility of the result being false for these values of $a$ and $n$.

Edit
I have found that $a=215$ and $n=76$ is a counterexample. $a^n+n^a$ is prime, $a \equiv 2 \mod 3$ but $n\not\equiv 0 \mod 3$.

-
if $n\equiv 0\pmod 3$ then $n \not\equiv 4\pmod 6$ –  pedja Nov 17 '11 at 15:18
@pedja I have shown that $a^n+n^a$ might be prime without the need for $n \equiv 0 \mod 3$. $n \equiv 0 \mod 3$ is your conclusion, not an assumption. –  Peter Phipps Nov 17 '11 at 15:23
could you give me an example of such prime number please ? –  pedja Nov 17 '11 at 15:30
@pedja that would be the counterexample to disprove your conjecture. Your Maple code suggests you have already checked the easy numbers. So no, I can't provide an example at this time. –  Peter Phipps Nov 17 '11 at 15:36
if you find counterexample to my conjecture please let me know.. –  pedja Nov 17 '11 at 15:40

Assume $n$ ist not $\equiv 0 \mod 3$, which means $n=3l+1$ or $n=3l+2$. Now see if $n^a + a^n$ is divisibile by 3. If yes, you get a contradiction to $n^a + a^n$ being a prim.

So if $n \equiv 1$ you get (remember $a \equiv -1$) $$a^n + n^a \equiv (-1)^{3l+1} + 1 \equiv 0 \mod 3$$ and if $n \equiv 2$ you get $$a^n + n^a \equiv (-1)^{3l+2} + (-1)^{3k-1} \equiv 1-1 = 0 \mod 3$$

-
counterexamples : $8^2+2^8=320 , 8^4+4^8=69632$ –  pedja Nov 16 '11 at 9:34
Dont you assume that $a^n + n^a$ is prime ? –  MaoK Nov 16 '11 at 9:37
try $2^{15}+15^2$ –  pedja Nov 16 '11 at 9:52
Yap, thats a prim. But thats no counter example, since $n=15 \equiv 0 \mod 3$ –  MaoK Nov 16 '11 at 9:59
please calculate : $2^{14}+14^2$ and $2^{16}+16^2$ –  pedja Nov 16 '11 at 10:08