cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-5 of 5 results.

A343640 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.

Original entry on oeis.org

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, 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, 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
Offset: 0

Views

Author

M. F. Hasler, Apr 28 2021

Keywords

Comments

This is a 3D generalization of the 2D square spiral and could be used to produce a 3D variant of Ulam's prime spiral.
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.
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).
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.
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.

Examples

			Shell r = 0 is the origin, {(0,0,0)}.
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).
Since there are no empty shells, the z-coordinate is always increasing for even r and decreasing for odd r.
		

Crossrefs

Cf. A343641, A343642, A343643 (list of x, y resp. z-coordinates only).
Cf. A343631, A343632, A343633 (variant using the Euclidean norm => circle shaped spirals), A342561, A343632, A342563 (another variant).
Cf. A010014 (number of points on a shell with given radius), A016755.
Cf. A174344, A268038, A274923 (2-dimensional square spiral).

Programs

  • 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]
    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!

A343633 Z-coordinate of the points following the 3D spiral defined in A343630.

Original entry on oeis.org

0, 1, 0, 0, 0, 0, -1, -1, -1, -1, -1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, -2, -2, -2, -2, -3, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1, -1, 0
Offset: 0

Views

Author

M. F. Hasler, Apr 28 2021

Keywords

Comments

See the main entry A343630 for details about this 3D generalization of an Ulam type spiral using the Euclidean norm.
Sequences A343631 and A343632 give the x and y-coordinates.
The sequence can be seen as a table with row lengths A005875, where A005875(r) is the number of points at distance sqrt(r) from the origin.
Sequence A343643 is the analog for the square spiral variant A343640.

Crossrefs

Cf. A343631, A343633 (list of x and z-coordinates).
Cf. A343643 (variant using the sup norm => square spiral).
Cf. A342563 (variant which scans each sphere by increasing z).
Cf. A005875 (number of points on a shell with given radius).
Cf. A004215 (numbers that can't be written as sum of 3 squares => empty shells).

Programs

  • PARI
    d=1; A343633_vec=concat([[P[3] | P<-S=A343630_row(n,d)]+(#S&&!d*=-1) | n<-[0..9]]) \\ the variable d is necessary to correct the z-scan direction in rows between A004215(2k-1) and A004215(2k).

A343630 Coordinate triples (x(n), y(n), z(n); n >= 0) of the 3D spiral filling space with shells of increasing radius, using circles at fixed z-values which alternatingly move up and down as do the x-values.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 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, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 0, 0, -2, 2, 0, 0, 0, 2, 0, -2, 0, 0, 0, -2, 0, 0, 0
Offset: 0

Views

Author

M. F. Hasler, Apr 28 2021

Keywords

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.

Examples

			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.
		

Crossrefs

Cf. A343631, A343632, A343633 (list of x, y resp. z-coordinates only).
Cf. A343640, A343641, A343642, A343643 (variant using the sup norm => square spiral).
Cf. A342561, A342562, A342563 for a variant which scans each sphere by increasing z.
Cf. A005875 (number of points on a shell with given radius).
Cf. A004215 (numbers that can't be written as sum of 3 squares => empty shells).

Programs

  • 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.
    A343630_vec=concat([[Vec(P) | P<-A343630_row(n)] | n<-[0..6]]) \\ beyond the empty row 7 one must correct the second argument, e.g. by using {... P<-S=A343630_row(n,d)]+(#S&&!d*=-1) ...} to flip the sign of d, initialized to 1, at each nonempty shell.

A343641 X-coordinate of points following the 3D square spiral defined in A343640.

Original entry on oeis.org

0, 0, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 0, 0, 1, 1, 0, -1, -1, -1, 0, 1, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1, 0
Offset: 0

Views

Author

M. F. Hasler, Apr 28 2021

Keywords

Comments

See A343640 for more about this 3D generalization of the 2D Ulam type square spiral.
The sequence can be seen as a table with row lengths A010014, where A010014(r) is the number of points of Z^3 with sup-norm r.

Crossrefs

Cf. A343640 (triples), A343642 and A343643 (list of y and z-coordinates).
Cf. A343631 (variant using the Euclidean norm), A342561 (another variant).
Cf. A010014 (number of points on a shell with given radius => row lengths).

Programs

  • PARI
    A343641_vec=concat([[P[1]| P<-A343640_row(r)] | r<-[0..2]]) \\ From r=0 up to n there are (2n+1)^3 points with 3 coordinates each.

A343632 Y-coordinate of the points following the 3D spiral defined in A343630.

Original entry on oeis.org

0, 0, 0, 1, 0, -1, 0, 0, 1, 0, -1, 1, 1, -1, -1, 0, 1, 0, -1, 1, 1, -1, -1, 1, 1, -1, -1, 0, 0, 2, 0, -2, 0, 0, 1, 0, -1, 0, 2, 0, -2, 1, 2, 2, 1, -1, -2, -2, -1, 0, 2, 0, -2, 1, -1, 0, 0, 1, 1, -1, -1, 1, 2, 2, 1, -1, -2, -2, -1, 1, 2, 2, 1, -1, -2, -2, -1, 1, 1, -1, -1, 0, 2, 0, -2, 2, 2, -2, -2, 0, 2, 0, -2, 0, 1, 2, 2, 1, -1, -2, -2, -1, 2, 2, -2, -2, 0, 3, 0, -3
Offset: 0

Views

Author

M. F. Hasler, Apr 28 2021

Keywords

Comments

See the main entry A343630 for details about this 3D generalization of an Ulam type spiral using the Euclidean norm.
Sequences A343631 and A343633 give the x and z coordinates.
The sequence can be seen as a table with row lengths A005875, where A005875(r) is the number of points at distance sqrt(r) from the origin.
Sequence A343642 is the analog for the square spiral variant A343640.

Crossrefs

Cf. A343631, A343633 (list of x and z-coordinates).
Cf. A343642 (variant using the sup norm => square spiral).
Cf. A342562 (variant which scans each sphere by increasing z).
Cf. A005875 (number of points on a shell with given radius).
Cf. A004215 (numbers that can't be written as sum of 3 squares => empty shells).

Programs

  • PARI
    d=1; A343632_vec=concat([[P[2] | P<-S=A343630_row(n,d)]+(#S&&!d*=-1) | n<-[0..9]]) \\ the variable d is necessary to correct the z-scan direction in rows between A004215(2k-1) and A004215(2k).
Showing 1-5 of 5 results.