I ran across this stackoverflow question regarding finding solutions to
$$\left(a+b\right)^2=a.b$$ for $a,b\in\Bbb{N}$ where $a.b$ denotes concatenation of $a$ and $b$. Since concatenation isn't really a "true" mathematical operation, I'll write $$\left(a+b\right)^2=a\times10^c+b$$
where $c=\lfloor{log_{10}b}\rfloor+1$. The post there also has an implicit stipulation that neither $a$ nor $b$ may contain leading zeros, but that does not matter for the sake of this question- I can filter those solutions later. I wish to gain some mathematical insight into the pattern of these solutions, so that maybe I can write a more efficient solver.
The naive method of searching for solutions by iterating over pairs of $a$ and $b$ takes $O\left(n^2\right)$ time. By instead iterating over all squares $i^2$, and decomposing each into $\lfloor2\log_{10}i\rfloor$ separate $a,b$ pairs, we can search for solutions in $O\left(n\log(n)\right)$ time. I've since realized that because $a,b<i$ and $a\times10^c+b=i^2$, that $a$ and $b$ must both be within $+0/-2$ orders of magnitude of $i$, and so there is at most three possibly valid $a,b$ pairs per $i^2$. This brings the time complexity down to $O\left(n\right)$, but I still feel like there might be other mathematical insights that could allow me to prune other invalid $a,b$, whether they result in an asymptotic speedup or not.
Is there a closed-form solution to this problem, or any particular pattern to the $a$ and $b$ forming valid solutions?