# Pairs of perfect squares

Two perfect squares are said to be friendly if one is obtained from the other by adding the digit 1 on the left. For example, $$1225 = 35 ^ 2$$ and $$225 = 15 ^ 2$$ are friendly. Prove that there are in finite pairs of friendly and odd perfect squares.

Maybe Any product of square-full numbers is square-full. $$4n(n+1)+1=4n^{2}+4n+1=(2n+1)^{2}$$

I don't know if that would help: http://oeis.org/A060355

• Here's a hint: You wish to find $a,b$ such that $b^2-a^2=(b-a)(b+a)=10^k$. $10^k$ has only prime factors $2,5$, so $(b-a)\ \text{and}\ (b+a)$ each also must comprise only prime factors of $2,5$. – Keith Backman Oct 17 '19 at 18:03
• To add on to Keith's comment, I'd suggest trying to find some pairs $a,b$ such that $b^2-a^2=5^{2k}$ for some $k\in\mathbb N$, since then, you can multiply $a,b$ by $2^k$. – Don Thousand Oct 17 '19 at 18:15
• @EsposaDoYoongi As Mike Bennett's comment to my answer pointed out, I forgot to check on & handle the restriction that $a^2$ must be a $k-1$ digit integer. This involved quite a bit more work, as you can see, but I believe it's now properly handled. I checked the algebra manipulations, & am reasonably confident in them, but it's getting very late for me (after $3$ a.m. in my time zone), so I'm quite tired & could have reasonably easily made a mistake. Please check the calculations yourself, let me know if anything is wrong, & I'll also check sometime later today when I'm more awake & alert. – John Omielan Oct 18 '19 at 10:12

Let $$a^2$$ and $$b^2$$, with $$b^2 \gt a^2$$, be the odd perfect squares which are also friendly. As Keith Backman's comment states, you get

$$b^2 - a^2 = (b+a)(b-a) = 10^{k} \tag{1}\label{eq1A}$$

As Mike Bennett's comment below suggests, another required condition is that $$a^2$$ be $$k$$ digits long, so $$b^2$$ is formed by adding a digit $$1$$ to the left of $$a^2$$ expressed in base $$10$$, i.e., it's also required that

$$10^{k} \gt a^2 \gt 10^{k-1} \tag{1B}\label{eq1B}$$

Note that, in \eqref{eq1A}, $$b+a$$ and $$b-a$$ must be both negative or both positive. Consider the case they are both positive. Since the only prime factors of $$10^k$$ are $$2$$ and $$5$$, plus that the sum & difference of $$2$$ odd numbers is always even, you have from \eqref{eq1A}

$$b + a = (2^c)(5^d), c \ge 1 \tag{2}\label{eq2A}$$

$$b - a = (2^e)(5^f), e \ge 1 \tag{3}\label{eq3A}$$

Also, since $$10^k = (2^k)(5^k)$$, you have

$$c + e = d + f = k \implies e = k - c, \; f = k - d \tag{4}\label{eq4A}$$

Adding \eqref{eq2A} to \eqref{eq3A} and dividing by $$2$$ gives

$$b = (2^{c-1})(5^d) + (2^{e-1})(5^f) \tag{5}\label{eq5A}$$

Subtracting \eqref{eq3A} from \eqref{eq2A} and dividing by $$2$$ gives

$$a = (2^{c-1})(5^d) - (2^{e-1})(5^f) \tag{6}\label{eq6A}$$

For $$a$$ and $$b$$ to both be odd requires that either $$c = 1$$ and $$e = k - c = k - 1 \gt 1$$, or $$e = 1$$ and $$c = k - e = k - 1 \gt 1$$. Thus, for every integer $$k \ge 3$$, you get the following $$2$$ possible sets of solutions:

$$b = 5^{d} + (2^{k-2})(5^{k-d}), a = 5^{d} - (2^{k-2})(5^{k-d}), 0 \le d \le k \tag{7}\label{eq7A}$$

$$b = (2^{k-2})(5^{d}) + 5^{k-d}, a = (2^{k-2})(5^{d}) - 5^{k-d}, 0 \le d \le k \tag{8}\label{eq8A}$$

However, the restriction in \eqref{eq1B} must also hold for any specific $$d$$ and $$k$$ to be valid values. In particular, for \eqref{eq7A} to be applicable, you require

\begin{aligned} & 10^k \gt \left(5^{d} - (2^{k-2})(5^{k-d})\right)^2 \gt 10^{k-1} \\ & 10^k \gt 5^{2d} - (2^{k-1})(5^k) + (2^{2k-4})(5^{2k-2d}) \gt 10^{k-1} \\ & 10(10^{k-1}) \gt 5^{2d} - 5(10^{k-1}) + (2^{2k-4})(5^{2k-2d}) \gt 10^{k-1} \\ & 15(10^{k-1}) \gt 5^{2d} + (2^{2k-4})(5^{2k-2d}) \gt 6(10^{k-1}) \end{aligned}\tag{9}\label{eq9A}

For any larger $$k$$, having $$2d \le k$$ will not work since the second term in the middle, i.e., $$(2^{2k-4})(5^{2k-2d})$$, would be larger than the upper bound. Thus, have

$$2d = k + g, \; g \gt 0 \tag{10}\label{eq10A}$$

$$2k - 2d = 2k - (k + g) = k - g \tag{11}\label{eq11A}$$

You also have $$2d \gt k - g$$ and $$k - 1 \ge k - g$$. Divide all $$3$$ parts of the inequalities of \eqref{eq9A} by $$5^{k - g}$$ to get

\begin{aligned} & 15(2^{k-1})(5^{g-1}) \gt 5^{2g} + 2^{2k-4} \gt 6(2^{k-1})(5^{g-1}) \\ & 15(2^{k-1})(5^{g-1}) \gt 25(5^{2(g-1)}) + 2^{2k-4} \gt 6(2^{k-1})(5^{g-1}) \end{aligned}\tag{12}\label{eq12A}

To make the algebra somewhat simpler, let $$h = 5^{g-1}$$ to see that \eqref{eq12A} is a set of $$2$$ quadratic inequalities, i.e.,

\begin{aligned} 15(2^{k-1})h & \gt 25h^2 + 2^{2k-4} \\ 0 & \gt 25h^2 - 15(2^{k-1})h + 2^{2k-4} \\ 25h^2 - 15(2^{k-1})h + 2^{2k-4} & \lt 0 \end{aligned}\tag{13}\label{eq13A}

and

\begin{aligned} 25h^2 + 2^{2k-4} & \gt 6(2^{k-1})h \\ 25h^2 - 6(2^{k-1})h + 2^{2k-4} & \gt 0 \end{aligned}\tag{14}\label{eq14A}

Using the quadratic formula, the roots of the LHS of \eqref{eq13A} are

\begin{aligned} h & = \frac{15(2^{k-1}) \pm \sqrt{\left(15(2^{k-1})\right)^2 - 4(25)(2^{2k-4})}}{50} \\ & = \frac{15(2^{k-1}) \pm \sqrt{225(2^{2k-2}) - 25(2^{2k-2})}}{50} \\ & = \frac{15(2^{k-1}) \pm \sqrt{(25(2^{2k-2}))(9 - 1)}}{50} \\ & = \frac{15(2^{k-1}) \pm 5(2^{k-1})\sqrt{8}}{50} \\ & = \frac{(2^{k-1})(15 \pm 5(2)\sqrt{2})}{2(25)} \\ & = \frac{(2^{k-2})(15 \pm 10\sqrt{2})}{25} \end{aligned}\tag{15}\label{eq15A}

Similarly, using the quadratic formula gives that the roots of the LHS of \eqref{eq14A} are

\begin{aligned} h & = \frac{6(2^{k-1}) \pm \sqrt{\left(6(2^{k-1})\right)^2 - 4(25)(2^{2k-4})}}{50} \\ & = \frac{6(2^{k-1}) \pm \sqrt{36(2^{2k-2}) - 25(2^{2k-2})}}{50} \\ & = \frac{(2^{k-1})(6 \pm \sqrt{11})}{2(25)} \\ & = \frac{(2^{k-2})(6 \pm \sqrt{11})}{25} \end{aligned}\tag{16}\label{eq16A}

The inequalities mean $$h$$ must be between the larger root in \eqref{eq16A} and the larger root in \eqref{eq15A}. Thus, you have the following inequalities, where I've multiplied by $$25$$ to clear the fractions and then taken the logarithms of the values, to the base of $$5$$, so can isolate $$g$$ appropriately, to get

\begin{aligned} & \frac{(2^{k-2})(6 + \sqrt{11})}{25} \lt 5^{g-1} \lt \frac{(2^{k-2})(15 + 10\sqrt{2})}{25} \\ & (2^{k-2})(6 + \sqrt{11}) \lt 5^{g+1} \lt (2^{k-2})(15 + 10\sqrt{2}) \\ & (k-2)\log_{5}(2) + \log_{5}(6 + \sqrt{11}) \lt g + 1 \lt (k-2)\log_{5}(2) + \log_{5}(15 + 10\sqrt{2}) \end{aligned}\tag{17}\label{eq17A}

Note that

$$i = \log_{5}(6 + \sqrt{11}) \approx 1.3866955655 \tag{18}\label{eq18A}$$

$$j = \log_{5}(15 + 10\sqrt{2}) \approx 2.0952564 \tag{19}\label{eq19A}$$

Since $$j - i \lt 1$$, this means there's not even necessarily an integer value between the lower & upper bounds in \eqref{eq17A}. Also, from \eqref{eq10A}, $$k$$ and $$g$$ must have the same parity, so even if there's an integer in between, not all values of $$k$$ will work since some will give just one $$g$$ value with the wrong parity.

Note, though, as indicated from the question & answers in Multiples of an irrational number forming a dense subset, since $$\log_{5}(2)$$ is irrational, for any range $$[p,q]$$ for real $$0 \le p \lt q \lt 2,$$ there will be an infinite number of even positive integers $$k$$ for which $$(k-2)\log_{5}(2)$$ minus the largest even integer less than it will be in $$[p,q]$$. Thus, if you choose $$p \gt 3 - j \approx 0.9047436$$ (from \eqref{eq19A}) and $$q \lt 3 - i \approx 1.6133044345$$ (from \eqref{eq18A}), then there will be an odd integral integral value of $$g+1$$ which satisfies \eqref{eq17A}, so there will be an even value of $$g$$ which matches the parity of $$k$$. You can use basically the same process for odd $$k$$. This proves there are an infinite number of pairs of friendly, odd perfect squares. Note you can also use a similar procedure for \eqref{eq8A} to prove it also produces an infinite number of pairs of friendly, odd perfect squares.

One small issue is that, if you want to only use positive integers is the determined value of $$a$$ might be negative. However, since only its value squared is used, $$-a$$ (which is positive) is also a solution.

Note your specific example of $$b = 35 = 25 + 10 = 5^2 + 2 \times 5$$ and $$a = 15 = 25 - 10 = 5^2 - 2 \times 5$$ comes from \eqref{eq7A} with $$k = 3, d = 2$$. Also, in \eqref{eq17A}, you get $$\approx 1.81737212357 \lt g + 1 \lt \; \approx 2.52593295807$$, so $$g + 1 = 2 \implies g = 1$$, which with $$k = 3$$ in \eqref{eq10A} gives $$2d = 3 + 1 \implies d = 2$$. This shows the handling for the restriction of \eqref{eq1B} also gives the same result.

• I think it's a bit more subtle than this if you actually want the larger square to correspond to appending a single digit $1$ to the front of the decimal expansion of the smaller square (the great majority of the pairs $(k,d)$ in your parametrizations (7) and (8) correspond to adding a $1$ to some digit, not necessarily appending it). For example, in (7), $k=96$ and $d=68$ does the trick, but nothing works for $k=97$. – Mike Bennett Oct 18 '19 at 5:37
• @MikeBennett Do you remember me from school at UBC? Anyway, thanks for the feedback. You're right about it being more subtle than what I stated. What I wrote are necessary conditions, but not necessarily sufficient. Another required condition is that $10^k \gt a^2 \ge 10^{k-1}$. I'm going to work on seeing how I can fix the answer so it's correct. – John Omielan Oct 18 '19 at 5:49
• @MikeBennett It's taken me some time to figure out how to handle this & to write it up, but I believe I now have it being handled correctly. I checked your example, to get that $k = 96$ and $d = 69$ (not $d = 68$) works but, as you wrote, nothing works for $k = 97$. – John Omielan Oct 18 '19 at 10:19
• Can you solve separating in a system? $b + a = 2^{n-1}$, $b-a = 2 . 5^n$; $b = 5^n+ 2^{n-2}$, $a = 2^{n-2}-5^n$ – trombho Oct 18 '19 at 16:40
• @EsposaDoYoongi Note I have gone through my answer to find & make a few more fixes. As for your comment request, what you state is a possible solution for the equation $b^2 - a^2 = 10^k$. However, as Mike pointed out, and I've spent a lot of time figuring out, checking on & writing myself, the trickiest & hardest part to deal with is to ensure that $a^2$ is a $k$ digit integer. This puts quite a tight restriction on the set of values which may work. Please read through what I wrote and, if there's any mistakes or something I can clarify for you, please let me know. – John Omielan Oct 18 '19 at 17:30

Be $$a, b$$ belonging to integers, we want to show that for all $$a, b$$ belonging to integers, there is $$k$$ belonging to the natural such that they are infinite.

$$a ^ 2 - b ^ 2 = 10 ^ k$$

$$(a + b) (a-b) = 2^k. 5 ^ k$$

$$\begin{cases} a + b = 2 ^ {k-1} \\ a - b = 2.5 ^ k \end{cases}$$

$$2a = 2.5 ^ k + 2 ^ {k-1}$$

$$a = 5 ^ k + 2 ^ {k-1}$$

$$2b = 2 ^ {k-1} - 2.5 ^ k$$

$$b = 2 ^ {k-2} - 5 ^ k$$

Taking $$a = 2 ^ {k-2} + 5 ^ k$$

$$b = 5 ^ k - 2 ^ {k-2}$$

Take: $$a ^ 2 - b ^ 2 = 2 ^ {2k - 4} + 2.2 ^ {k-2} .5 ^ k + 5 ^ 2k - 5 ^ 2k + 2.2 ^ {k-2} .5 ^ k- 2 ^ {2k-4}$$

$$a ^ 2-b ^ 2 = 2 ^ k.5 ^ k$$

$$a ^ 2-b ^ 2 = 10 ^ k$$

So we have k belonging to the natural such that $$k \geq 2$$. We have infinite numbers

$$a = 2 ^ {k-1} + 5 ^ k$$

$$b = 5 ^ k - 2 ^ {k-2}$$ such that $$a ^ 2$$ and $$b ^ 2$$ are friendly and a, b are odd