<s>[INST] On the complete solution to $x^2+y^2=z^k$ for odd $k$? While trying to answer this question, I was looking at a computer output of solutions to $x^2+y^2 = z^k$ for odd $k$ and noticed certain patterns. For example, for $k=5$ we have $x,y,z$,
$$10, 55, 5\\25, 50, 5\\38, 41, 5\\117, 598, 13\\122, 597, 13\\338, 507, 13\\799, 884, 17$$
Question: Is it true that all integer solutions to $x^2+y^2=z^k$ for odd $k>1$ are given by just two formulas, namely,


*

*Primitives $\gcd(x,y)=1$:
$$A^2+B^2 = (a^2+b^2)^k\tag1$$
where $A,B$ is the expansion of $(a+bi)^k = A+Bi$. Example, $$(a+bi)^3 =(a^3 - 3 a b^2)+ (3 a^2 b - b^3)i$$ hence, $$(a^3 - 3 a b^2)^2+ (3 a^2 b - b^3)^2 = (a^2+b^2)^3$$ and so on for other $k$.

*Non-primitives $\gcd(x,y)\neq1$:
$$a^2(a^2+b^2)^{k-1}+b^2(a^2+b^2)^{k-1} = (a^2+b^2)^k\tag2$$
where, for both Forms $1$ and $2$, we use some rational $a,b$?


Example. The first three solutions for $k=5$ above use:
$$a,b = 2/5,\;11/5\quad \text{Form 2}$$
$$a,b = 1,\;2\quad \text{Form 2}$$
$$a,b = -2,\;1\quad \text{Form 1}$$
 [/INST] Must write more correctly. $Z$ representation as a sum of squares gives the standard approach.
$$X^2+Y^2=Z^{k}$$
Uses the standard formula of the Brahmaputra. View the sum of the squares piece.
$$X^2+Y^2=(ab+cd)^2+(cb-ad)^2=(a^2+c^2)(b^2+d^2)$$
So the sum of squares is converted until
$$(b_1^2+d_1^2)...(b_{k}^2+d_{k}^2)=Z^{2k}$$
$$Z^2=b_1^2+d_1^2=...=b_{k}^2+d_{k}^2$$
Odd.
$$(a^2+b^2)(b_1^2+d_1^2).....(b_{k}^2+d_{k}^2)=Z*Z^{2k}$$
$$Z^2=b_1^2+d_1^2=...=b_{k}^2+d_{k}^2$$
$$Z=a^2+b^2$$
$$b_1=b_2=...=b_{k}=a^2-b^2$$
$$d_1=d_2=...=d_{k}=2ab$$
Will as an example this equation.
$$X^2+Y^2=Z^5$$
$$(xb+yd)^2+(yb-xd)^2=(x^2+y^2)(b^2+d^2)=(a^2+c^2)(b^2+d^2)(b^2+d^2)=Z*Z^2*Z^2$$
$$Z=a^2+c^2$$
$$x=ab+cd$$
$$y=cb-ad$$
$$d=a^2-c^2$$
$$b=2ac$$
And then the decision on the record.
$$X=a^5-10c^2a^3+5ac^4$$
$$Y=c^5-10a^2c^3+5ca^4$$
So these numbers are multiples of each its option.
</s>