Prove that $a+b$ can't divide $a^a+b^b$ nor $a^b+b^a$

Let $p=a+b$, and suppose that $p$ divides at least one of $a^a+b^b$ or $a^b+b^a$.

Then $p$ divides the product $$(a^a+b^b)(a^b+b^a)=a^p+b^p+(ab)^a+(ab)^b $$

By Fermat's little theorem

  • $a^p= a\mod p$
  • $b^p= b\mod p$
  • $a^p+b^p= a+b = 0 \mod p$

So (remember we suppose that $p$ divides the product) we have : $$ (ab)^a+(ab)^b=0\mod p$$

But $b=-a\mod p$.

$$ (-a^2)^a+(-a^2)^b=0 \mod p$$

As $a+b$ is odd, one of $a$ and $b$ is odd and the other is even. So

$$ a^{2a}=a^{2b} \mod p $$

it means that $2b-2a$ is multiple of the order $r$ of $a$, and that order $r$ divides $p-1=a+b-1$. But if $r$ divides $(2b-1)-(2a-1)$ and $2(a+b-1)=(2a-1)+(2b-1)$, then either $r=2$ or it divides $2a-1$ and $2b-1$ (they are both different prime numbers) so $r=1$.

So $a=1\mod p$ or $a=-1\mod p$. But $a+b=p$. So $a<p$, so $a=1$ (but then $2a-1$ is not prime) or $a=p-1$ (but then $2b-1$ is not prime), this is not possible.

A contradiction. So, our first hypothesis that $p$ divides the product is false.


Since $2a-1, 2b-1$ are primes, then $a,b\neq 1$. Since $a+b$ is a prime, then we can suppose $a$ is even and $b$ is odd.

Suppose $p=a+b|a^a+b^b$. We have: $$a^a+b^b\equiv a^a-a^b=a^b(a^{a-b}-1) \pmod {a+b}$$

Since $\gcd(a^b,a+b)=1$, then $p|a^{a-b}-1$. Let $h=ord_p(a)$, then $h|p-1,h|a-b$, then $h|p-1-(a-b)=2b-1$, thus $h=1$ or $h=2b-1$.

If $h=1$, then $a+b|a-1$, but this is impossible since $a+b>a-1$.

Then $h=2b-1$, which means $p|a^{2b-1}-1$. Hence $p|a^{2a-1}(a^{2b-1}-1)=a^{2a+2b-2}-2^{2a-1}$, then $p|2^{2a-1}-1$. Thus $2b-1|2a-1$, or $2a-1=2b-1$ (since they are both primes), or $a=b$, which is impossible.

Proving $a+b \not|a^b+b^a$ is similar.