Positive integers $\displaystyle a, b$ are both relatively prime and less than or equal to 2008. $\displaystyle a^2 + b^2$ is a perfect square.

$\displaystyle b$ has the same digits as $\displaystyle a$ in the reverse order. The number of such ordered pairs $\displaystyle (a, b)$ is _________ .

I started with 2 digits:

Let $\displaystyle a=xy$ and $\displaystyle b=yx$

$\displaystyle (10x+y)^2 + (10y+x)^2$

$\displaystyle 101x^2 + 40xy + 101y^2$

which can't be factorized and isn't a perfect square.

Tried the same with 3 digits and ended up with this:

$\displaystyle 10001x^2 + 200y^2 + 10001z^2 + 400xz + 2020xy + 2020yz$

This also isn't factorizable.

I've simply got no idea of how to proceed from here.