Find number pairs $(a,b)$ s.t. $a^2-b^2 = ab$ (in decimal representation)

arithmeticelementary-number-theoryquadratics

Question is in the title. For clarification $ab$ does not mean $a\cdot b$, but the decimal representation $a\cdot 10^{\lfloor\log_{10}b\rfloor+1} + b$. For example $(14,7)$ works because

$14^2-7^2 = 196-49 = 147$,

so they fulfill this pattern. I think solving the general formula shouldn't be that hard, but I have problems including the floored logarithms of $b$.

I'm interested in a special format (like there is for Pythagorean triplets) to find all number pairs that satisfy the given condition
$$
a^2-b^2 = a\cdot 10^{\lfloor\log_{10}b\rfloor+1} + b
$$

and how many of those number pairs exist. I would suggest there are infinitely many, but I can't prove it.

Edit: By trial and error I found – as it seems – infinitely many of those type, namely $(134, 67)$, $(1334, 667)$, $(13334, 6667), …$ because:
$$
134^2-67^2=13467 \\
1334^2-667^2=1334667 \\
\vdots
$$

Are these the only possible combinations? Does this really work infinitely long? If so why?

Edit2: I've written a program to find those pairs. All pairs for $a<10^5$ are:
$$
(14,7),(134,67),(1010, 100), (1016, 127), (1034, 187), (1140, 399), (1190, 475), (1216, 512), (1300, 624), (1334, 667), (1416, 767), (1484, 847), (1530, 900)
$$

One could also see that $b$ always has one digit less than $a$ (so that the final amount of digits work out) and that $a < 1.62 \cdot 10^n$, because otherwise the smallest number of the form $a^2-b^2$ we can get is

$$a^2-(10^{n}-1)^2 \geq (1.62\cdot 10^n)^2 – (10^n-1)^2 \geq 2.6244\cdot 10^{2n} – 10^{2n} > 1.62\cdot 10^n$$
so we wouldn't be able to get $ab$ as decimal representation.

Best Answer

Here is my partial work:

I tried to solve the relaxed equation $a^2-b^2=a\cdot 10^k + b$ and verify the restriction $k=10^{\lfloor\log_{10}b\rfloor+1}$ later.

I multiplied by 4 and used $(2x\pm y)^2=4x^2\pm 4xy+y^2$ to get:

$\left(2a-10^k\right)^2-\left(2b+1\right)^2=10^{2k}-1$

Which can be further written:

$(2a-2b-10^k-1)(2a+2b-10^k+1)=10^{2k}-1$

To make further progress, I would need a formula for factorization of $10^{2k}-1=99\ldots 99$, which does not exist AFAIK. So chances are that you would not be able to find a formula for the general solution, although the problem is solvable for small values of $k$.

However, it is possible to generate infinite sequences of solutions by using particular factorizations. For example, $\underbrace{99\ldots99}_{2k \text{ digits}}=\underbrace{3\ldots3}_{k \text{ digits}}\cdot 300\ldots 03$ will generate the sequence which you found.

Related Question