OFFSET
0,84
COMMENTS
This is a 3D generalization of a plane filling spiral using the Euclidean norm.
See A343640 for an analog using the sup- or oo-norm, where circles are squares and spheres are cubes.
The integer lattice points, Z^3, are listed in order of increasing Euclidean distance R^2 = x^2 + y^2 + z^2 from the origin. Each shell of given radius is filled using circles located at given latitude (i.e., z-value) on the sphere, and each circle is filled by points with increasing longitude, where the positive x axis corresponds to longitude 0. The latitudes / z-values are alternately increasing and decreasing (so over a period of two shells they follow the same cosine-type shape as the x-values do over the period of each circle).
The sequence can be seen as a table with row length of 3, where each row corresponds to the (x,y,z)-coordinates of one point (the three columns are then A343631, A343632 and A343633), or as a table with row lengths 3*A005875, where A005875(r) is the number of points at distance sqrt(r) from the origin.
Sequence A343640 gives a square spiral variant.
EXAMPLE
Shell r = 0 is the origin, {(0,0,0)}.
Shell r = 1 contains the 6 points {(0,0,1), (1,0,0), (0,1,0), (-1,0,0), (0,-1,0), (0,0,-1)}, located on the North pole, equator and South pole of the unit sphere. The equator (as all circles in the sequel) is "scanned" by increasing longitude = polar coordinate phi in the (x,y) plane with given z, where (x,y,z) = (R,0,0) has longitude 0.
Shell r = R^2 = 2 contains the 12 points (now in order of increasing z-coordinate) {(1,0,-1), (0,1,-1), (-1,0,-1), (0,-1,-1); (1,1,0), (-1,1,0), (-1,-1,0), (1,-1,0); (1,0,1), (0,1,1), (-1,0,1), (0,-1,1)}.
Then again, the points of shell r = R^2 = 3 are ordered by decreasing z-coordinate.
There are no points in shell r = R^2 = 7 = A004215(1), so from there on up to the next empty shell, the shells with even r are filled by decreasing z-coordinate.
PROG
(PARI) A343630_row(n, dir=(-1)^n, Q=Qfb(1, 0, 1), L=List())={for(z=if(n, sqrtint((n-1)\3)+1), sqrtint(n), my(S=if(n>z^2, Set(apply(vecsort, abs(qfbsolve(Q, n-z^2, 3)))), [[0, 0]])); foreach(S, s, forperm(concat(s, z), p, listput(L, p)))); for(i=1, 3, for(j=1, #L, my(X=L[j]); (X[i]*=-1) && listput(L, X))); vecsort(L, (p, q)->if( p[3]!=q[3], (p[3]-q[3])*dir, p[1]==q[1], q[2]-p[2], p[2]*q[2]<0, q[2]-p[2], (q[1]-p[1])*(p[2]+q[2])))} \\ returns row n of the table, i.e., the list of points (x, y, z) in Z^3 with Euclidean norm equal to sqrt(n), sorted by increasing latitude for dir = +1, else decreasing, and increasing longitude.
CROSSREFS
KEYWORD
sign
AUTHOR
M. F. Hasler, Apr 28 2021
STATUS
approved