login
Coordinate triples (x(n), y(n), z(n); n >= 0) of the 3D square spiral filling space with shells of increasing radius for the sup-norm, in turn filled by squares extending from one pole to the opposite one.
10

%I #44 Jun 16 2021 20:58:14

%S 0,0,0,0,0,1,1,0,1,1,1,1,0,1,1,-1,1,1,-1,0,1,-1,-1,1,0,-1,1,1,-1,1,1,

%T 0,0,1,1,0,0,1,0,-1,1,0,-1,0,0,-1,-1,0,0,-1,0,1,-1,0,1,0,-1,1,1,-1,0,

%U 1,-1,-1,1,-1,-1,0,-1,-1,-1,-1,0,-1,-1,1,-1,-1,0,0,-1,0,0,-2,1,0,-2,1,1,-2,0,1,-2,-1,1,-2,-1,0,-2,-1,-1,-2,0,-1,-2,1,-1,-2

%N Coordinate triples (x(n), y(n), z(n); n >= 0) of the 3D square spiral filling space with shells of increasing radius for the sup-norm, in turn filled by squares extending from one pole to the opposite one.

%C This is a 3D generalization of the 2D square spiral and could be used to produce a 3D variant of Ulam's prime spiral.

%C See A343630 for an analog using the Euclidean or 2-norm instead of the sup- or oo-norm used here, so points are partitioned in spheres and circles instead of squares and cubes here.

%C The integer lattice points, Z^3, are listed in order of increasing sup norm R = max(|x|, |y|, |z|). Each "sphere" or shell of given radius R is filled starting at the North or South pole using concentric squares on the top and bottom face and squares of fixed size (2R+1) X (2R+1) at intermediate z-coordinates. Each square (circle for the sup-norm) is filled in the sense of increasing longitude, where the positive x axis corresponds to longitude 0, i.e., the points (r,0,z), (0,r,z), (-r,0,z) and (0,-r,z) are visited in this order. The z-values are alternatively increasing and decreasing (so over a period of two shells they follow the same rectangle-wave shape as the x-values do over the period of each square).

%C 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 (then the three columns are A343641, A343642 and A343643), or as a table with row lengths 3*A010014, where A010014(r) is the number of points with sup-norm r.

%C There are (2n+1)^3 integer lattice points with sup norm <= n. Therefore, the point number n (where 0 is the origin) is in the shell r = round(n^(1/3)/2) = floor(...+1/2). Within shell r, which starts with the point number (2r-1)^3 (except for r=0), the first and last (2r+1)^2 points are on square spirals on the top and bottom faces, and the other points are on 2r-1 squares forming "belts" of 8r points each, on the side faces of the cube.

%H Hugo Pfoertner, <a href="/A343640/a343640.png">Visualization of shells 0, 1, 2</a>.

%H Hugo Pfoertner, <a href="/A343640/a343640_1.txt">List of terms up to r = 10 (n = 9260)</a>, [n, x, y, z].

%e Shell r = 0 is the origin, {(0,0,0)}.

%e Shell r = 1 contains the 3*3 + 4*2 + 3*3 = 26 points with oo-norm 1, i.e., all points with coordinates within {-1, 0, 1} except for the origin. They are listed in a square spiral starting at the North Pole: (0,0,1), (1,0,1), (1,1,1), (0,1,1), (-1,1,1), (-1,0,1), (-1,-1,1), (0,-1,1), (1,-1,1); then on the equator: (1,0,0), (1,1,0), (0,1,0), (-1,1,0), (-1,0,0), (-1,-1,0), (0,-1,0), (1,-1,0), and then on the South face using an inward spiral: (1,0,-1), (1,1,-1), (0,1,-1), (-1,1,-1), (-1,0,-1), (-1,-1,-1), (0,-1,-1), (1,-1,-1), (0,0,-1).

%e Since there are no empty shells, the z-coordinate is always increasing for even r and decreasing for odd r.

%o (PARI) A343640_row(n)={local(L=List(), a(r, z, d=I)= if(r, for(i=1,8*r, listput(L,[real(r),imag(r),z]); r+=d; abs(real(r))==abs(imag(r)) && d*=I), listput(L,[0,0,z])), s=(-1)^n /* flip South <-> North for odd n */); /* main prog: (1) square spiral on South face from center to board */ for(d=!n,n, a(d,-s*n)); /* (2) "equatorial(?) bands" from South to North */ for(z=1-n,n-1, a(n,s*z)); /* (3) square spiral on North face ending in pole */ for(d=0,n, a(n-d,s*n)); Vec(L)} \\ row n of the table = list of points (x,y,z) in the shell n, i.e., with sup norm n. [Missing "s*" in a(n,s*z) added on May 27 2021]

%o A343640_vec=concat([A343640_row(r) | r<-[0..2]]) \\ From r=0 up to n there are (2n+1)^3 points with 3 coordinates each!

%Y Cf. A343641, A343642, A343643 (list of x, y resp. z-coordinates only).

%Y Cf. A343631, A343632, A343633 (variant using the Euclidean norm => circle shaped spirals), A342561, A343632, A342563 (another variant).

%Y Cf. A010014 (number of points on a shell with given radius), A016755.

%Y Cf. A174344, A268038, A274923 (2-dimensional square spiral).

%K sign,tabf

%O 0,84

%A _M. F. Hasler_, Apr 28 2021