6. Find all $n \geqslant 2\left(n \in \mathbf{Z}_{+}\right)$, such that $n$ can be written as $n=k^{2}+d^{2}$, where $k$ is the smallest prime factor of $n$, and $d$ is a factor of $n$ greater than 1.