Tuesday, 23 September 2025

Obscure Difference of Two Squares

 Here's an interesting problem that appeared in this YouTube video:

Find the values of \(a, b \in \mathbb{N}\) such \(a^b-b=77\).

With two unknowns and only one equation, the problem seems daunting but the factorisation of 77 and the fact that the values of \(a\) and \(b\) are restricted to natural numbers will be enough to solve the problem. However, the solution that the video describes hinges on the use of a difference of two squares and this is not at all obvious. Let's begin:$$ \begin{align} a^b-b &= 77 \\ (a^{b/2})^2-(\sqrt{b})^2 &= 77 \\ (a^{b/2}-\sqrt{b}) \times  (a^{b/2}+\sqrt{b}) &= 7 \times 11 \end{align} $$We know that \(a^{b/2}-\sqrt{b} < a^{b/2}+\sqrt{b}\) and so there are only two possible factorisations of 77. These are \(1 \times 77\) and \(7 \times 11 \). Not only is the second option more likely but the first option in fact does not yield a solution, as we'll show later. Let's proceed using the \(7 \times 11\) factorisation.$$ \begin{align} a^{b/2}-\sqrt{b} &=7 \dots 1\\ a^{b/2}+\sqrt{b} &=11 \dots 2 \end{align}$$Adding equations 1 and 2 together gives:$$ \begin{align} 2 a^{b/2} &=18 \\ a^{b/2} &=9 \\ \end{align}$$Let's substitute \(a^{b/2}=9\) back in the equation 1:$$ \begin{align} 9 - \sqrt{b} &= 7 \\ \sqrt{b} &= 2 \\ b &=4 \\ \because a^{b/2} &= 9 \\ a^2 &= 9 \\ a&=3 \end{align}$$So we have a solution with \(a = 3\) and \(b=4\). Substituting these values back into the original equation should confirm the solution:$$ \begin{align} a^b -b &= 77 \\ 3^4-4 &=77\\77 &= 77 \end{align}$$But what of the \(1 \times 77\) factorisation? Let's confirm that this does not yield a solution:$$ \begin{align} a^{b/2}-\sqrt{b} &=1 \dots 1\\ a^{b/2}+\sqrt{b} &=77 \dots 2 \end{align}$$Adding equations 1 and 2 together gives$$ \begin{align} 2a^{b/2} &=78\\ a^{b/2} &= 39 \end{align}$$Substitute \(a^{b/2}=39\) back in the equation 1:$$ \begin{align} 39 - \sqrt{b} &=77 \\ \sqrt{b}=-38 \end{align}$$There is no value of \(b\) that satisfies this equation so we can confirm that the \(1 \times 77\) factorisation does not yield a solution. I did not think up the method of solution described here and all credit is due the author of the linked video. It did occur to me to generalise the problem and consider what other biprimes (or semiprimes) yield a solution. In other words, what prime values of \(x\) and \(y\), with \(x<y\), allow for natural number solutions to:$$a^b-b=xy$$The two equations we obtain from this relationship are:$$ \begin{align} a^{b/2}-\sqrt{b} &=x \dots 1\\ a^{b/2}+\sqrt{b} &=y \dots 2 \end{align}$$Adding equations 1 and 2 gives:$$ \begin{align} 2a^{b/2} &= x+y \\ a^{b/2} &= \frac{x+y}{2} \end{align}$$Substituting into equation 1 gives:$$ \begin{align} \frac{x+y}{2}-\sqrt{b} &= x \\ \sqrt{b} &= \frac{x+y}{2}-x \\ \sqrt{b} &= \frac{x+y-2x}{2} \\ b &= \frac{(y-x)^2}{4}  \end{align}$$Testing this equation with \(x=7\) and \(y=11\) we see that \(b=4\) and so all is well. So what other prime values of \(x\) and \(y\) will yield solutions? Testing we find that \(x=3\) and \(y=5\) yield a value of \(b=1\). This leads to:$$ \begin{align} a^{b/2} &=\frac{x+y}{2}\\ \sqrt{a} &= 4 \\ a &=16 \end{align}$$Checking, we see that:$$ \begin{align} a^b-b &=15 \\ 16^1-1 &=15\\15 &= 15 \end{align}$$Rather than randomly checking prime values of \(x\) and \(y\), the design of a search algorithm is a more organised approach (permalink). Let's exclude those cases where either \(a=1\) or \(b=1\) as these are rather trivial. For semiprimes with prime factors less than 300, I found the following additional semiprimes (the calculations are very processor intenstive). The first is 6557:$$ \begin{align} 6557 &=79 \times 83 \\ \text{with } a &= 9 \text{ and }b= 4 \end{align}$$Checking, we find that:$$ \begin{align} a^b-b &= 6557 \\9^4 - 4 &= 6557 \\ 6561-4  &= 6557\\ 6557&=6557 \end{align}$$The second is 50621:$$ \begin{align} 50621 &=223 \times 227\\ \text{with } a &= 15 \text{ and }b= 4 \end{align}$$Checking, we find that:$$ \begin{align} a^b-b &= 50621 \\ 15^4 - 4 &= 50621\\50625-4 &= 50621\\50621 &= 50621 \end{align}$$The third is 194477:$$ \begin{align} 194477 &=439 \times 443 \\ \text{with } a &= 21 \text{ and } b=4 \end{align}$$Checking, we find that:$$ \begin{align} a^b-b &= 194477 \\ 21^4-4 &= 194477 \\ 194481-4 &= 194477 \\ 194477 &= 194477 \end{align}$$That's probably enough. As can be seen, the semiprimes that satisfy are few and far between but it was an interesting exercise. Notice that the prime factors in each case are adjacent primes.

No comments:

Post a Comment