Method to solving $a^n + b^n = c$

85 Views Asked by At

I have been wondering for a while if there is a method to solving the following form of equation $a^n + b^n = c$ Where a,b,c are all integers. For example, $2^n + 5^n = 29$. One can quickly see that n is 2 but is there a general method?

2

There are 2 best solutions below

0
On

There is, in general, no closed form solution to the equation $a^x + b^x =c$.

We can (from the monotonicity of the function $x\mapsto a^x + b^x$) show that a solution exists for every $c>0$, but (unless ofcourse if $a=0$ or $b=0$), the solution can only be calculated numerically.

That said, if you know an integer solution exists, then you can find it by bisection. First, try to evaluate $a^n+b^n$ for $n=1,2,4,8,16,\dots$ until you reach some value of $n$ for which $a^n+b^n>c$. Then, use bisection to narrow down your choices for $n$. By that I mean:

  • Start with $n_1,n_2$ such that $a^{n_1}+b^{n_1}\leq c<a^{n_2}+b^{n_2}$.
  • Set $n=\frac{n_1+n_2}{2}$, and evaluate $a^{n}+b^{n}$.
  • If $a^{n}+b^{n} < c$, set $n_1$ to $n$. Otherwise, set $n_2$ to $n$.
  • Repeat step $1$.
0
On

Assume $a\ge b\ge 2$ and we are only interested in integer solutions $n$, we have \begin{equation} n\log a + \log(1 + (b/a)^n) = \log c \end{equation} but $(1 + (b/a)^n)$ is somewhere in $[1, 2]$, hence $ n \le \log_a c\le n + \log_a 2$. This implies \begin{equation} \boxed{n = \lfloor \log_a c\rfloor}\quad \text{if}\quad a > 2 \end{equation} \begin{equation} n = \lfloor\log_2 (c)\rfloor - 1\quad\text{if}\quad a = b = 2 \end{equation} It remains to say when this sole $n$ candidate actually satisfies the equation. If it does not, there is no solution.