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}$$