Range of values of $k^2$ equal to the sum of two squares and the difference of two other squares This is an extension of the post linked here: Show that any square number $k^2$ can be written as the sum of two squares and difference of two other squares.
Let $k$ be a nonzero positive integer. What is the range of values of $k$ such that $k^2$ can be simultaneously written as the sum of two nonzero squares $a^2+b ^2$ and the difference of two nonzero squares $c^2-d^2$?
 A: The problem can be rephrased as: find $a,b,k,c,d\in\mathbb{N}^+$ such that:
$$
\begin{cases}
c^2+k^2&=d^2\\
a^2+b^2&=k^2
\end{cases}
$$We will show this system admits a family of solutions $(A_n,B_n,K_n,C_n,D_n)$. Let $P_n$ be the Pell numbers. We have
$$
(2P_n P_{n+1})^2+(P_{n+1}^2-P_n^2)^2 = (P_{2n+1})^2
$$Let $k_n=P_{n+1}-P_n$. Our goal is to use the two-squares theorem (see, for instance, the link below) to write $k_n$ or some scalar multiple of it as a sum of two squares. For its prime factorization, I'll use $q_{i;n}$, $1\leq i\leq r$ for the $r$ distinct primes dividing $k_n$ with multiplicities $e_{i;n}$:
$$
k_n = q_{1;n}^{e_{1;n}} \cdot\ldots q_{r;n}^{e_{r;n}} 
$$Of the primes $\{q_{1;n},\ldots ,q_{r;n}\}$, let $S_n$ be the set such that $q_{i;n}\equiv 3(4)$ and $e_{i;n}$ is odd (this may be empty, which is fine. Let $Q_n$ denote the product of elements in $S_n$. Then, at last, we have
$$
\begin{cases}
Q_n^2(2 P_{n+1}P_n)^2 + Q_n^2 (P_{n+1}-P_n)^2&= Q_n^2(P_{2n+1})^2\\
A_n^2+B_n^2&= Q_n^2 (P_{n+1}-P_n)^2
\end{cases}
$$An example will clarify matters. Let $n=5$. We have $(P_5,P_6,P_{11})=(29,70,5741)$; then we have
$$
(2 \cdot 29\cdot 70)^2+(70^2-29^2)^2=5741^2
$$Factor $70^2-29^2=3^2\cdot 11\cdot 41$. So we have $Q_n=11^1$. Consistent with the original notation, we have 
$$(C_5,K_5,D_5)=2\cdot 20\cdot 29\cdot 11,(70^2-29^2)\cdot 11,5741\cdot11)$$
But now, by two-squares, we can find $A_5,B_5$ such that $A_5^2+B_5^2=K_5^2$; indeed, $(A_5,B_5)=(43560,9801)$ works. This process can be done for every Pell number $P_n$.
https://www.math.uchicago.edu/~may/VIGRE/VIGRE2008/REUPapers/Bhaskar.pdf
