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.

Previous Showing 31-32 of 32 results.

A337108 Square spiral constructed by greedy algorithm, so that each diagonal and antidiagonal contains distinct numbers.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Aug 16 2020

Keywords

Comments

This sequence is a variant of A308896; here we walk a bishop, there a rook.
Visually, we have a superposition of two images that we can separate by considering the parity of the x and y coordinates (see illustrations in Links section).

Examples

			The spiral begins:
        7----7----6----7----1----7----4----7----7
        |                                       |
        6    5----5----4----1----5----5----5    6
        |    |                             |    |
        3    4    3----3----2----3----3    4    3
        |    |    |                   |    |    |
        6    5    2    1----1----1    2    4    6
        |    |    |    |         |    |    |    |
        0    0    0    0    0----0    0    0    0
        |    |    |    |              |    |    |
        6    3    2    2----1----2----2    3    6
        |    |    |                        |    |
        7    4    4----3----1----3----4----4    5
        |    |                                  |
        6    6----5----5----1----6----5----6----6
        |
        8----7----8----7----1----7----4----7----8
		

Crossrefs

See A274641 and A308896 for similar sequences.
Cf. A035608.

Programs

  • PARI
    \\ See Links section.

Formula

a(n) = 0 iff n belongs to A035608.

A357046 Squares visited by a knight moving on a board covered with horizontal dominoes [m|m], m = 0, 1, 2, ... in a diamond-shaped spiral, when the knight always jumps to the unvisited square with the least number on the corresponding domino.

Original entry on oeis.org

0, 11, 14, 1, 4, 13, 10, 3, 18, 7, 2, 5, 22, 9, 28, 31, 60, 15, 32, 29, 52, 25, 8, 27, 12, 53, 26, 23, 6, 17, 34, 59, 30, 87, 126, 51, 24, 45, 20, 39, 16, 33, 58, 55, 86, 125, 50, 47, 76, 21, 40, 67, 36, 61, 94, 57, 54, 85, 176, 129, 56, 93, 138, 187, 92, 137, 96, 35, 38, 19
Offset: 0

Views

Author

M. F. Hasler, Oct 19 2022

Keywords

Comments

The sequence lists the squares visited by the knight by giving their (unique) "square spiral number", as shown, e.g., in A316328 and others. (Listing the labels m of the dominoes would obviously be ambiguous; see EXAMPLE for that sequence.)
The dominoes [m|m], m = 0, 1, 2, ... are placed in a diamond-shaped spiral,
12 12 28 28
_ 13 13 11 11 27 27 _
14 14 [2 | 2] 10 10 26 26
_ 15 15 [3 | 3] [1 | 1] [9 | 9] 25
_ 16 [4 | 4] [0 | 0] [8 | 8] 24 24
The spiral starts from the origin (where the [0|0] is placed) with one step in direction North-East (where [1|1] is placed), then one in direction North-West (=> [2|2]), then two towards South-West (=> [3|3] and [4|4]) and two towards South-East (=> [5|5] and [6|6]), then three towards North-East, etc. [We chose the counter-clockwise spiral as usual in mathematics, but one would obviously get the same sequence if the spiral of dominoes and the square spiral numbering the positions were chosen in the opposite, clockwise sense.]
The endpoints of the "straight lines" are labeled with the "quarter-squares" A002620, in particular, rightmost and leftmost dominoes of each "shell" are labeled with the odd resp. even square numbers.
The sequence ends at a(2550) where the knight is stuck at position (x, y) = (28, 4) on the domino labeled m = 964.

Examples

			The knight hops from the left 0 (= the origin) on the right 1, then on the left 2, then on the right 0, then on the left 3, then on the right 2, etc.
The list of these labels would be 0, 1, 2, 0, 3, 2, 8, 3, 4, 5, 1, 4, 6, 7, 9, 11, 12, 14, 11, 10, 24, 22, 7, 8, 10, 9, 23, 6, 5, 15, 13, 12, 27, 26, 48, 23, ...
As explained in comments, the terms a(n) correspond to the (unique) "square spiral numbers" of these locations (cf. A274641 or A174344 (upside down) or A316328).
		

Crossrefs

Cf. A316328, A326924 and A326922 (choose square closest to the origin), A328908 and A328928 (variant using taxicab distance); A328909 and A328929 (variant using sup norm).
Cf. A274641, A174344 (upside down), A268038, A274923 for the square spiral numbering and corresponding (x,y) coordinates.

Programs

  • PARI
    /* function domino([x,y]) gives the label m on the domino at (x,y); it uses the map DOM to store this label with key x + i*y. */
    DOM=Map(); {domino(x)=while(!mapisdefined(DOM, x[1]+I*x[2], &x), my(M=#DOM\2, side=sqrtint(M*4-!!M), pos=sqrtint(M)*I^(side-1)+side\/2%2*I, dir=(1+I)*I^side); for(m=M, M+side\2, mapput(DOM, pos, m); mapput(DOM, pos+1, m); pos+=dir)); x}
    {coords(n, m=sqrtint(n), k=m\/2)=if(m<=n-=4*k^2, [n-3*k, -k], n>=0, [-k, k-n], n>=-m, [-k-n, k], [k, 3*k+n])}
    {local(U=[]/* used squares */, K=vector(8, i, [(-1)^(i\2)<<(i>4), (-1)^i<<(i<5)])/* knight moves */, pos(x, y)=if(y>=abs(x), 4*y^2-y-x, -x>=abs(y), 4*x^2-x-y, -y>=abs(x), (4*y-3)*y+x, (4*x-3)*x+y), t(x, p=pos(x[1], x[2]))=if(p<=U[1]||setsearch(U, p), oo, [domino(x), p]), nxt(p, x=coords(p))=vecsort(apply(K->t(x+K), K))[1][2]); my(A=List(0)/*list of positions*/); for(n=1, oo, U=setunion(U, [A[n]]); while(#U>1&&U[2]==U[1]+1, U=U[^1]); iferr(listput(A, nxt(A[n])), E, break)); print("Index of last term: ", #A-1); A357046(n)=A[n+1];} \\ same code as A326924 except for norml2 => domino
    /* to get the sequence of labels m (cf.example): */
    [domino(coords(A357046(n))) | n <- [0..99]]
Previous Showing 31-32 of 32 results.