# Find all integers $a$ and $b$, such that $\frac{a^b + 1}{b^a + 1}$ an integer.

I've recently been attempting to solve the following problem and made some initial progress. However, im not able to progress any further, any hint would be greatly appreciated!

Let $$a$$ and $$b$$ be positive integers. For which values of $$a$$ and $$b$$ is the quotient $$\frac{a^b + 1}{b^a + 1}$$ an integer?

Thus far I have found that when $$b=1$$, then $$\frac{a^b + 1}{b^a + 1}$$ is an integer for all odd positive integers $$a$$. Likewise, the quotient is an integer when $$a=b$$ and when $$(a,b)=(2,4)$$ and $$(a,b)=(4,2)$$.

I haven't yet been able to find any more solutions and I also have no ideas on how I can prove that there are no more solutions, other than the ones given.

I'm not sure where you got this problem. It seems to me that it is either impossible or very difficult to get a complete answer.

In particular, your claim that "there are no more solutions" is wrong.

As an example: $$a = 2$$ and $$b = 386$$.

There are other families of examples: take any odd $$a$$ and take $$b = a^n$$, where $$n$$ divides $$a^{n - 1}$$ (e.g. $$n = a^k$$ for some $$k$$).

• I claimed that I was unable to find any more solutions, as opposed to there being no more. But thank you for showing that particular solution, I had not found that. – J-S Dec 26 '19 at 17:09
• FYI: even for $a = 2$ there are more: $b = 20136, 59140, 373164544$. See oeis.org/… – WhatsUp Dec 26 '19 at 17:11
• Also, for $a = 3$ there are $b = 27, 19683$. This is not yet on OEIS. – WhatsUp Dec 26 '19 at 17:14

There are infinitely many solutions of the following form.

If $$p$$ is an odd positive integer and $$k = p^{p^r}$$, then $$k^p+1 = p^{p^{r+1}}+1$$ divides $$p^k+1 = p^{p^{p^r}}+1$$. This is because $$x+1$$ divides $$x^p+1$$.

• I don't know why, but I already gave this example (in a more general form) in my answer. – WhatsUp Dec 26 '19 at 17:37