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-2 of 2 results.

A340945 List of Y-coordinates of point moving along one of the arms of a counterclockwise square spiral with four arms; A340944 gives X-coordinates.

Original entry on oeis.org

0, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -3, -4, -4, -4, -4, -4, -4, -4, -4, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8
Offset: 0

Views

Author

Rémy Sigrist, Jan 30 2021

Keywords

Examples

			The spiral starts as follows:
     +-----+-----+-----+-----+
     |7     6     5     4    |3    .
     |                       |     .
     +     +-----+-----+     +     +
     |8    |           |     |2    |
     |     |           |     |     |
     +     +     +-----+-----+     +
     |9    |     |     |0     1    |
     |     |     |     |           |     .
     +     +     +     +-----+-----+     .
     |10   |     |                       .
     |     |     |                       .
     +     +     +-----+-----+-----+-----+
     .11   .
     .
- so a(0) = a(1) = a(9) = 0,
     a(2) = a(8) = 1,
     a(3) = a(4) = a(5) = a(6) = a(7) = 2,
     a(10) = -1,
     a(11) = -2.
		

Crossrefs

Programs

  • PARI
    See Links section.
    
  • PARI
    a(n) = my(r,s=sqrtint(n,&r)); if(r>s, s++;r-=2*s-1); imag((r-s*I)*I^s); \\ Kevin Ryde, May 28 2023

Formula

a(n) = 0 iff n = 4*x^2 + 4*x + 1 for some x.
a(n) = Im z where z = (r-s*i)*i^s with s = round(sqrt(n)) = A000194(n) and remainder r = n - s^2. - Kevin Ryde, May 28 2023

A362249 Point number on a 4-arm square spiral of point n on the East arm scaled up by steps of that point itself.

Original entry on oeis.org

1, 4, 19, 16, 13, 64, 149, 58, 81, 70, 139, 324, 583, 268, 217, 256, 233, 244, 569, 1024, 1609, 916, 421, 566, 625, 586, 461, 884, 1591, 2500, 3611, 2324, 1323, 1000, 1213, 1296, 1237, 1048, 1269, 2284, 3589, 5184, 7069, 4924, 3169, 1804, 1997, 2290, 2401, 2318, 2053, 1724, 3103, 4876
Offset: 1

Views

Author

Keywords

Comments

Coordinates x=A340944(n), y=A340945(n) are the East arm of a 4-arm square spiral whose arms together visit each integer point in the plane. Call these arms the base spirals.
Construct a large spiral by taking point n on the East spiral as a vector u and scaling up the East spiral by that amount (so first step at u, then turn 90 degrees and step by distance |u|, and so on).
Point n along the large spiral falls somewhere on one of the base spirals. It is point number a(n) on base spiral number A362363(n).
In complex numbers, the East spiral is S(n) = A340944(n) + A340945(n)*i, the scale is u = S(n), the large spiral is L(t) = u*S(t), and its point n is at L(n) = S(n)^2 = S(k)*i^arm where a(n) = k and A362363(n) = arm.

Examples

			Explanatory diagrams for n = 5 and n = 10 are shown in the Links.
		

Crossrefs

Programs

  • MATLAB
    function a  = A362249( max_n )
        E = [0 ; 0]; S = [0 ; 0]; W = [0 ; 0]; N = [0 ; 0]; V = [0 0];
        for k = 1:4*max_n
            l = V(1+mod(k+1,2)); s = (-1)^floor(k/2);
            for m = l+(1*s):s:s*k
                V(1+mod(k+1,2)) = m; V2 = V(end:-1:1).*[-1 1];
                N = [N V2']; E = [E V']; S = [S -V2']; W = [W -V'];
            end
        end
        for n = 2:max_n
            [th,r] = cart2pol(E(1,n), E(2,n));
            rot = [cos(-th) -sin(-th); sin(-th) cos(-th)];
            v = E(:,n)'*rot*r;
            jE = find(sum(abs([E(1,:)-v(1); E(2,:)-v(2)]),1) < 0.5);
            jS = find(sum(abs([S(1,:)-v(1); S(2,:)-v(2)]),1) < 0.5);
            jW = find(sum(abs([W(1,:)-v(1); W(2,:)-v(2)]),1) < 0.5);
            jN = find(sum(abs([N(1,:)-v(1); N(2,:)-v(2)]),1) < 0.5);
            a(n-1) = max([jE jS jW jN])-1;
        end
    end % Thomas Scheuerle, Apr 13 2023
  • PARI
    x(n, k) = (n^2 + k^2 - 2*n*k^2 + k^4)/(1 + k^2/(n - k^2)^2) - (k^2*(n^2 + k^2 - 2*n*k^2 + k^4))/((n - k^2)^2*(1 + k^2/(n - k^2)^2));
    y(n, k) = (2*k*n^2)/((n - k^2)*(1 + k^2/(n - k^2)^2)) + (2*k^3)/((n - k^2)*(1 + k^2/(n - k^2)^2)) - (4*k^3*n)/(n - k^2 + (n*k^2)/(n^2 - 2*n*k^2 + k^4) - k^4/(n^2 - 2*n*k^2 + k^4)) + (2*k^5)/((n - k^2)*(1 + k^2/(n - k^2)^2));
    t(n) =  {my(k = (sqrtint(4*n) + 1)\2); my(cy = abs(y(n,k))); my(cx = abs(x(n,k))); my(d = (cy > cx)); my(e = (n - k^2) < 0); return(max(cx,cy)^2+min(cx,cy)*(-1)^d*(-1)^e)};
    a(n) = if(issquare(n), return(n^2), return(t(n)));
    

Formula

A340944(a(n)) + i*A340945(a(n)) = (A340944(n) + i*A340945(n))^2 / i^A362363(n).
a(k^(2*n)) = k^(4*n).
a(4^n + 2^n) = 2^(4*n + 2).
a(A002061(n)) = 4*n^4 - 8*n^3 + 4*n^2 + 2*n - 1, for n > 0.
Showing 1-2 of 2 results.