Primes in four dimensions

A prime can vanish on a circle. Give it four coordinates and it always lights up. Try the same number in each dimension.

Explore the lattice

Dimension
integer points

Try a number

One distance, more directions

Every dot starts at a point with whole-number coordinates, which may be negative or zero. Square those coordinates and add them to get n. That puts every point exactly √n from the origin.

2D

Two families of odd primes

Divide an odd prime by 4. A remainder of 1 gives eight points on the circle. A remainder of 3 leaves the circle empty.

3D

Some spheres stay empty

There are more ways to land on the sphere, but 7 still has none. Try 28, which is 7 multiplied by 4. Its sphere stays empty too.

4D

Every prime comes into view

Four squares can make any positive whole number. An odd prime p lights up exactly 8(p + 1) points on the 3-sphere.

Research notes & references
Proven

Legendre’s three-square theorem

A positive integer n is a sum of three integer squares exactly when n is outside the family 4ᵃ(8b + 7), for integers a, b ≥ 0. For primes the excluded family is p ≡ 7 (mod 8).

Archive of Formal Proofs · three-square theorem

Proven

Lagrange and Jacobi in four squares

r₄(n) = 8σ(n) for odd n; r₄(p) = 8(p + 1) for odd primes p

Lagrange gives existence for every positive n. Jacobi counts all signed, ordered representations by summing eight times each divisor of n that is not a multiple of four. For odd n this uses every divisor, giving the divisor sum σ(n). At the even prime, r₄(2) = 24.

Chern · lectures 8 and 12

Proven

Hurwitz quaternions

The plotted integer tuples give quaternions a + bi + cj + dk of norm a² + b² + c² + d². The Hurwitz order also permits coordinates all in ℤ + ½. Its 24 units consist of 8 signed coordinate axes and 16 independent sign choices of (½, ½, ½, ½). A primitive Hurwitz quaternion, one with no integer divisor greater than one in the order, factors uniquely for a fixed order of prime norms up to inserting adjacent u, u⁻¹ pairs between factors.

Voight · The Hurwitz order, §11.4

Proven

Directions approach uniformity on S³

As odd primes p tend to infinity, the normalized lattice points converge in distribution to uniform surface measure on the unit 3-sphere. Every point of prime norm is primitive. The direction marginal of Aka, Einsiedler and Shapira’s Theorem 1.2 applies by fixing any odd auxiliary prime and discarding that single prime from the sequence.

Aka, Einsiedler & Shapira · Theorem 1.2

How uneven is a finite cloud?

Area fraction at angular radius θ = (θ − sin(θ) cos(θ)) / π

How the fourth axis moves

Divide each coordinate by √n, then rotate in the plane spanned by x and w. Project the resulting unit 3-sphere from its north pole into ordinary 3D space. A perspective camera shows this chart. Points near the pole recede beyond the drawing window and still contribute to the exact count.

(x, y, z, w) ↦ (x, y, z) / (1 − w)

Independent verification program (available on request) Implementation notes