This is in some sense an extension of the earlier MO question, "Gaussian prime spiralsGaussian prime spirals." Gaussian primes in the complex plane, $a+b i$, require $a^2 +b^2$ prime off the axes. The generalization to quaternions leads to Hurwitz primes $a + b i + c j + d k$, which require $a^2 + b^2 + c^2 + d^2$ prime (here I am ignoring the Hurwitz integers whose components are in $\mathbb{Z}+\frac{1}{2}$). So this suggests exploring points in $\mathbb{Z}^3$ with $a^2+b^2+c^2$ prime. (I realize this ignores the nice algebraic properties of complex numbers and quaternions.)
The Gaussian prime spirals were created by walking along a lattice direction and turning
left at Gaussian primes. The generalization is to start at a point $p \in \mathbb{Z}^3$, walk
along a lattice direction until a point $(a,b,c)$ is hit with $a^2 +b^2 + c^2$ prime, and then
turn. It makes sense to iterate through the six lattice directions,
$(+x,+y,+z,-x,-y,-z)$, in that order.
The result seems again to be a closed cycle.
Here is one example, with $p=(30,40,10)$ (marked in red),
which cycles after encountering 739 "primes" (marked in yellow):
It appears that whether or not every Gaussian prime spiral cycles runs up against
long-unsolved problems.
What is the situation with these 3D "prime" spirals?
Is there much known about the density and distribution of primes that are
are sum of three squares?
Are there theorems or conjectures that would either imply all spirals are closed,
or the opposite, that there should exist infinite unclosed spirals?