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-10 of 34 results. Next

A316338 Numbers missing from A316328.

Original entry on oeis.org

960, 961, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1218, 1219, 1220, 1221, 1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1359, 1360, 1361, 1362, 1363, 1364, 1365, 1366, 1367, 1368, 1369, 1370, 1371, 1372, 1373, 1374, 1376, 1442, 1443, 1444, 1445, 1446, 1508, 1509, 1510, 1511, 1512, 1513, 1514, 1515
Offset: 1

Views

Author

N. J. A. Sloane, Jul 14 2018

Keywords

Comments

A316328 is finite, so this sequence is infinite.
See A316667 and A316328 for further information.
A316328 has 2016 terms including the initial 0, and the largest term is 3198. Therefore this sequence contains all numbers > 3198 and 3198 - 2015 = 1183 smaller positive terms, whence the formula. - M. F. Hasler, Nov 05 2019

Crossrefs

Formula

a(n + 1183) = n + 3198 for all n > 0. - M. F. Hasler, Nov 05 2019

A316667 Squares visited by a knight moving on a spirally numbered board always to the lowest available unvisited square.

Original entry on oeis.org

1, 10, 3, 6, 9, 4, 7, 2, 5, 8, 11, 14, 29, 32, 15, 12, 27, 24, 45, 20, 23, 44, 41, 18, 35, 38, 19, 16, 33, 30, 53, 26, 47, 22, 43, 70, 21, 40, 17, 34, 13, 28, 25, 46, 75, 42, 69, 104, 37, 62, 95, 58, 55, 86, 51, 48, 77, 114, 73, 108, 151, 68, 103, 64, 67, 36
Offset: 1

Views

Author

Daniël Karssen, Jul 10 2018, following a suggestion from N. J. A. Sloane, Jul 09 2018

Keywords

Comments

Board is numbered with the square spiral:
.
17--16--15--14--13 .
| | .
18 5---4---3 12 .
| | | | .
19 6 1---2 11 .
| | | .
20 7---8---9--10 .
| .
21--22--23--24--25--26
.
This sequence is finite: At step 2016, square 2084 is visited, after which there are no unvisited squares within one knight move.

Crossrefs

Cf. A316328 (same starting at 0), A329022 (same with diamond-shaped spiral), A316588 (variant on board with x,y >= 0).
Cf. A326924 (choose square closest to the origin), A328908 (using taxicab distance), A328909 (using sup norm); A323808, A323809.
The (x,y) coordinates of square k are (A174344(k), A274923(k)).

Programs

Formula

a(n) = A316328(n-1) + 1.

A316588 Squares visited by knight moves on a diagonally numbered board and moving to the lowest available unvisited square at each step.

Original entry on oeis.org

1, 8, 6, 2, 12, 9, 4, 3, 13, 7, 5, 10, 26, 18, 11, 30, 24, 16, 38, 31, 22, 17, 25, 20, 28, 34, 14, 21, 43, 33, 27, 19, 15, 35, 42, 32, 23, 29, 39, 47, 56, 69, 37, 48, 40, 51, 60, 70, 57, 67, 81, 46, 58, 49, 41, 52, 44, 55, 64, 36, 65, 53, 45, 76, 63, 54, 66
Offset: 1

Views

Author

Daniël Karssen, Jul 07 2018

Keywords

Comments

Board is numbered as follows:
1 2 4 7 11 16 .
3 5 8 12 17 .
6 9 13 18 .
10 14 19 .
15 20 .
21 .
.
This sequence is finite: At step 2402, square 1378 is visited, after which there are no unvisited squares within one knight move.

Crossrefs

A296030 Pairs of coordinates for successive integers in the square spiral (counterclockwise).

Original entry on oeis.org

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

Views

Author

Benjamin Mintz, Dec 03 2017

Keywords

Comments

The spiral is also called the Ulam spiral, cf. A174344, A274923 (x and y coordinates). - M. F. Hasler, Oct 20 2019
The n-th positive integer occupies the point whose x- and y-coordinates are represented in the sequence by a(2n-1) and a(2n), respectively. - Robert G. Wilson v, Dec 03 2017
From Robert G. Wilson v, Dec 05 2017: (Start)
The cover of the March 1964 issue of Scientific American (see link) depicts the Ulam Spiral with a heavy black line separating the numbers from their non-sequential neighbors. The pairs of coordinates for the points on this line, assuming it starts at the origin, form this sequence, negated.
The first number which has an abscissa value of k beginning at 0: 1, 2, 10, 26, 50, 82, 122, 170, 226, 290, 362, 442, 530, 626, 730, 842, 962, ...; g.f.: -(x^3 +7x^2 -x +1)/(x-1)^3;
The first number which has an abscissa value of -k beginning at 0: 1, 5, 17, 37, 65, 101, 145, 197, 257, 325, 401, 485, 577, 677, 785, 901, ...; g.f.: -(5x^2 +2x +1)/(x-1)^3;
The first number which has an ordinate value of k beginning at 0: 1, 3, 13, 31, 57, 91, 133, 183, 241, 307, 381, 463, 553, 651, 757, 871, 993, ...; g.f.: -(7x^2+1)/(x-1)^3;
The first number which has an ordinate value of -k beginning at 0: 1, 7, 21, 43, 73, 111, 157, 211, 273, 343, 421, 507, 601, 703, 813, 931, ...; g.f.: -(3x^2+4x+1)/(x-1)^3;
The union of the four sequences above is A033638.
(End)
Sequences A174344, A268038 and A274923 start with the integer 0 at the origin (0,0). One might then prefer offset 0 as to have (a(2n), a(2n+1)) as coordinates of the integer n. - M. F. Hasler, Oct 20 2019
This sequence can be read as an infinite table with 2 columns, where row n gives the x- and y-coordinate of the n-th point on the spiral. If the point at the origin has number 0, then the points with coordinates (n,n), (-n,n), (n,-n) and (n,-n) have numbers given by A002939(n) = 2n(2n-1): (0, 2, 12, 30, ...), A016742(n) = 4n^2: (0, 4, 16, 36, ...), A002943(n) = 2n(2n+1): (0, 6, 20, 42, ...) and A033996(n) = 4n(n+1): (0, 8, 24, 48, ...), respectively. - M. F. Hasler, Nov 02 2019

Examples

			The integer 1 occupies the initial position, so its coordinates are {0,0}; therefore a(1)=0 and a(2)=0.
The integer 2 occupies the position immediately to the right of 1, so its coordinates are {1,0}.
The integer 3 occupies the position immediately above 2, so its coordinates are {1,1}; etc.
		

References

  • S. Wolfram, A New Kind of Science, Wolfram Media, 2002; p. 935.

Crossrefs

Cf. Diagonal rays (+-n,+-n): A002939 (2n(2n-1): 0, 2, 12, 30, ...: NE), A016742 (4n^2: 0, 4, 16, 36, ...: NW), A002943 (2n(2n+1): 0, 6, 20, 42, ...: SW) and A033996 (4n(n+1): 0, 8, 24, 48, ...: SE).

Programs

  • Mathematica
    f[n_] := Block[{k = Ceiling[(Sqrt[n] - 1)/2], m, t}, t = 2k +1; m = t^2; t--; If[n >= m - t, {k -(m - n), -k}, m -= t; If[n >= m - t, {-k, -k +(m - n)}, m -= t; If[n >= m - t, {-k +(m - n), k}, {k, k -(m - n - t)}]]]]; Array[f, 40] // Flatten (* Robert G. Wilson v, Dec 04 2017 *)
    f[n_] := Block[{k = Mod[ Floor[ Sqrt[4 If[OddQ@ n, (n + 1)/2 - 2, (n/2 - 2)] + 1]], 4]}, f[n - 2] + If[OddQ@ n, Sin[k*Pi/2], -Cos[k*Pi/2]]]; f[1] = f[2] = 0; Array[f, 90] (* Robert G. Wilson v, Dec 14 2017 *)
    f[n_] := With[{t = Round@ Sqrt@ n}, 1/2*(-1)^t*({1, -1}(Abs[t^2 - n] - t) + t^2 - n - Mod[t, 2])]; Table[f@ n, {n, 0, 95}] // Flatten (* Mikk Heidemaa May 23 2020, after Stephen Wolfram *)
  • PARI
    apply( {coords(n)=my(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])}, [0..99]) \\ Use concat(%) to remove brackets '[', ']'. This function gives the coordinates of n on the spiral starting with 0 at (0,0), as shown in Examples for A174344, A274923, ..., so (a(2n-1),a(2n)) = coords(n-1). To start with 1 at (0,0), change n to n-=1 in sqrtint(). The inverse function is pos(x,y) given e.g. in A316328. - M. F. Hasler, Oct 20 2019
  • Python
    from math import ceil, sqrt
    def get_coordinate(n):
        k=ceil((sqrt(n)-1)/2)
        t=2*k+1
        m=t**2
        t=t-1
        if n >= m - t:
            return k - (m-n), -k
        else:
            m -= t
        if n >= m - t:
            return -k, -k+(m-n)
        else:
            m -= t
        if n >= m-t:
            return -k+(m-n), k
        else:
            return k, k-(m-n-t)
    

Formula

a(2*n-1) = A174344(n).
a(2*n) = A274923(n) = -A268038(n).
abs(a(n+2) - a(n)) < 2.
a(2*n-1)+a(2*n) = A180714(n).
f(n) = floor(-n/4)*ceiling(-3*n/4 - 1/4) mod 2 + ceiling(n/8) (gives the pairs of coordinates for integers in the diagonal rays). - Mikk Heidemaa, May 07 2020

A328928 Squares visited by a knight moving on a taxicab geometry numbered board where the knight moves to the smallest numbered unvisited square; the minimum distance from the origin is used if the square numbers are equal; the smallest spiral number ordering is used if the distances are equal.

Original entry on oeis.org

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

Views

Author

Scott R. Shannon, Oct 31 2019

Keywords

Comments

This sequence uses the taxicab geometry distance from the 0-squared origin to enumerate each square on the board. At each step the knight goes to an unvisited square with the smallest square number. If the knight has a choice of two or more squares with the same number it then chooses the square which is the closest to the 0-squared origin. If two or more squares are found which also have the same distance to the origin, then the square which was first drawn in a square spiral numbering is chosen, i.e., the smallest spiral numbered square as in A316667.
The sequence is finite. After 1092366 steps a square with the number 728 (standard spiral number = 1165673) is visited, after which all neighboring squares have been visited.
See A328908(n) for the position on the spiral (cf. A316328) of the square visited at move n. - M. F. Hasler, Nov 04 2019

Examples

			The squares are labeled using their taxicab geometry distance from the origin:
.
    +----+----+----+----+----+----+----+
    |  6 |  5 |  4 |  3 |  4 |  5 |  6 |
    +----+----+----+----+----+----+----+
    |  5 |  4 |  3 |  2 |  3 |  4 |  5 |
    +----+----+----+----+----+----+----+
    |  4 |  3 |  2 |  1 |  2 |  3 |  4 |
    +----+----+----+----+----+----+----+
    |  3 |  2 |  1 |  0 |  1 |  2 |  3 |
    +----+----+----+----+----+----+----+
    |  4 |  3 |  2 |  1 |  2 |  3 |  4 |
    +----+----+----+----+----+----+----+
    |  5 |  4 |  3 |  2 |  3 |  4 |  5 |
    +----+----+----+----+----+----+----+
    |  6 |  5 |  4 |  3 |  4 |  5 |  6 |
    +----+----+----+----+----+----+----+
.
If the knight has a choice of two or more squares with the same number which also have the same distance from the origin, then the square with the minimum square spiral number, as shown in A316667, is chosen.
		

Crossrefs

Cf. A174344, A274923, A296030 (coordinates of the n-th point on the spiral).

Programs

Formula

a(n) = |A174344(p)| + |A274923(p)| with p = A328908(n)+1. - M. F. Hasler, Nov 04 2019

A328909 Knight's tour on spirally numbered infinite board, when the knight always jumps on the unvisited square closest to the origin, first according to the sup-norm, then 2-norm, then number of the square: a(n) = number of square visited at move n.

Original entry on oeis.org

0, 9, 2, 5, 8, 3, 6, 1, 4, 7, 10, 13, 28, 31, 14, 11, 26, 23, 44, 19, 22, 43, 40, 17, 34, 37, 18, 15, 32, 29, 52, 25, 46, 21, 42, 69, 20, 39, 16, 33, 12, 27, 24, 45, 74, 41, 68, 103, 38, 35, 60, 93, 30, 53, 84, 49, 78, 115, 160, 75, 116, 47, 76, 113, 72, 107, 150, 67, 36, 61, 94, 57, 54, 85, 50, 79, 82
Offset: 0

Views

Author

M. F. Hasler, Oct 31 2019

Keywords

Comments

Differs from A326924 (where only the 2-norm is considered) from a(34) = 42 on, and from A316328 (which considers only the number of the square) from a(48) = 38 on.
When the knight lands on square number a(25108) = 21040 of coordinates (73, -57), there is no unvisited square within reach. The sequence then stops, or can be extended by specifying that the knight has to go back on its path until an unvisited square comes within reach, as in A323809.
The least unvisited square at move 25108 is square number 17822 at (67,67). It is however close to the border of the visited region and the knight will visit it in the infinite extension of the sequence shortly after, at move n = 25358. Is there a square that will never be visited in that infinite extension? (Cf. comments in A323809.) - M. F. Hasler, Nov 04 2019

Examples

			The squares are numbered as in the spiral given in A174344 (upside down to get a counterclockwise spiral, but this is irrelevant here).
The knight starts at a(0) = 0 with coordinates (0, 0).
It jumps to a(1) = 9 with coordinates (2, -1): all 8 available squares (+-2, +-1) and (+-1, +-2) are at the same sup-norm and Euclidean distance from the origin, but square number 9 has the smallest number.
		

Crossrefs

Cf. A328929 for the value on the visited square, sup norm of coordinates of a(n).
Cf. A323809 ~ A316328 ~ A316667, A326924, A328908 (variants).
Cf. A174344, A274923, A296030 (coordinates of square number n).

Programs

  • PARI
    {local(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]), 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, [vecmax(abs(x)), norml2(x), p]), nxt(p, x=coords(p))=vecsort(apply(K->t(x+K), K))[1][3]); 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); A328909(n)=A[n+1];} \\ To compute the infinite extension of the sequence, set en upper limit to the for() loop and replace "break" by listput(A, A[n-1])

Formula

A328929(n) = max(|A174344(a(n))|, |A274923(a(n))|) = sup norm of the coordinates of square a(n).

A326924 Squares visited by a knight on a spirally numbered board, moving always to the unvisited square closest to the origin.

Original entry on oeis.org

0, 9, 2, 5, 8, 3, 6, 1, 4, 7, 10, 13, 28, 31, 14, 11, 26, 23, 44, 19, 22, 43, 40, 17, 34, 37, 18, 15, 32, 29, 52, 25, 46, 21, 76, 47, 50, 27, 12, 33, 16, 39, 20, 45, 24, 51, 48, 77, 114, 73, 70, 105, 38, 35, 60, 93, 30, 53, 84, 49, 78, 115, 74, 41, 68, 103, 36, 61, 94, 57, 54, 85, 124, 81
Offset: 0

Views

Author

M. F. Hasler, Oct 21 2019

Keywords

Comments

"Closest to the origin" is meant in the sense of Euclidean distance, and in case of a tie, the square coming earliest on the spiral.
Differs from the original A316328 from a(34) = 76 on. See there for more information and other related sequences.
The knight gets trapped at the 22325th move at position (x,y) = (81, -18), from which it can't reach any unvisited square.
Sequence A326922 gives the distance^2 of the square number a(n) visited at move n. - M. F. Hasler, Oct 22 2019
From M. F. Hasler, Nov 04 2019: (Start)
When a(22325) = 25983 at (81, -18) is reached, at distance sqrt(6885) from the origin, the last unvisited square has number 13924, at (-59, 59), distance sqrt(6962) from the origin. This suggests that in an infinite extension (knight moves one step back if no unvisited square is available, cf. A323809) the knight might eventually visit every square. Can this be disproved by a counterexample of a square which will never be visited in the infinite extension? (In A328908 such a counterexample exists even before the knight gets stuck.)
The ratio a(n)/n oscillates between 0.5 and less than 1.7 for all n > 3000, even < 1.5 for all n > 14000, cf. graph of the sequence. What is the superior and inferior limit of this ratio, assuming the infinite extension beyond n = 22325?
(End)

Crossrefs

Cf. A174344, A274923, A296030 (coordinate of square number n).

Programs

  • PARI
    {local(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]), 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, [norml2(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); A326924(n)=A[n+1];} \\ To compute the infinite extension, set upper bound in for() loop and replace "break" by listput(A, A[n-1])

A326918 Squares visited by a knight moving on a single-digit square-spiral numbered board where the knight moves to the smallest numbered unvisited square; the minimum distance from the origin is used if the square numbers are equal; the smallest spiral number ordering is used if the distances are equal.

Original entry on oeis.org

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

Views

Author

Scott R. Shannon, Oct 21 2019

Keywords

Comments

This sequence uses the same board numbering as A326413, and like that sequence, if the next step encounters two or more squares with the same square number, it then chooses the square which is the closest to the original 0-squared origin. But if two or more squares are found which also have the same distance to the origin, then the square which was first drawn in the spiral numbering is chosen, i.e., the smallest standard spiral numbered square as in A316667.
The sequence is finite. After 1069 steps a square with the number 9 (standard spiral number = 473) is visited, after which all neighboring squares have been visited.
Sequence A326916(n) gives the number of the square visited at step n, i.e., its rank in the spiral, starting with 0, as illustrated, e.g., in A326413. The digit on that square, i.e., a(n) can be obtained through A007376, cf. formula. - M. F. Hasler, Oct 21 2019

Examples

			The squares are numbered using single digits of the spiral number ordering as:
                                .
    2---2---2---1---2---0---2   :
    |                       |   :
    3   1---2---1---1---1   9   3
    |   |               |   |   |
    2   3   4---3---2   0   1   1
    |   |   |       |   |   |   |
    4   1   5   0---1   1   8   3
    |   |   |           |   |   |
    2   4   6---7---8---9   1   0
    |   |                   |   |
    5   1---5---1---6---1---7   3
    |                           |
    2---6---2---7---2---8---2---9
If the knight has a choice of two or more squares in this spiral with the same number which also have the same distance from the origin, then the square with the minimum standard spiral number, as shown in A316667, is chosen.
		

Crossrefs

Cf. A174344, A274923, A296030 (coordinates of the square number n).

Formula

a(n) = A007376(A326916(n)). - M. F. Hasler, Oct 21 2019

A328908 Knight's tour on spirally numbered infinite chessboard, when the knight always jumps on the unvisited square closest to the origin, first according to 1-norm, then 2-norm, then number of the square: a(n) = number of the square visited at the n-th move.

Original entry on oeis.org

0, 9, 2, 5, 8, 3, 6, 1, 4, 7, 10, 13, 28, 31, 14, 11, 26, 23, 44, 19, 22, 43, 40, 17, 34, 37, 18, 15, 32, 29, 52, 25, 46, 21, 76, 47, 50, 27, 12, 33, 16, 39, 20, 45, 24, 51, 48, 77, 114, 73, 70, 105, 38, 35, 60, 93, 30, 53, 84, 49, 78, 115, 74, 41, 68, 103, 36, 61, 94, 57, 54, 85, 124, 175
Offset: 0

Views

Author

M. F. Hasler, Oct 31 2019

Keywords

Comments

Differs from A326924 (where only the 2-norm is considered) from a(73) = 175 on.
The sequence is also finite, when the knight lands on square number a(1092366) there is no unvisited square within reach.
The 1-norm or taxicab distance from the origin of the square a(n) is given in A328928(n).
It appears that this knight's tour would also completely fills the board, if we consider the infinite extension where the knight is allowed to move back on its last step(s) when there's no unvisited square available: no isolated sets of unvisited squares as defined in A323809, seem to occur. Is there a proof or disproof for this? - M. F. Hasler, Nov 04 2019

Examples

			The squares are numbered as in the spiral given in A174344 (upside down to get a counterclockwise spiral, but this is irrelevant here).
The knight starts at a(0) = 0 with coordinates (0, 0).
It jumps to a(1) = 9 with co-ordinates (2, -1): all 8 available squares (+-2, +-1) and (+-1, +-2) are at the same taxicab (2 + 1 = 3) and Euclidean distance (sqrt(2^2 + 1^2) = sqrt(5)) from the origin, but square number 9 has the smallest number.
a(73) = 175 with coordinates (7, 0) is the first destination which is preferred due to the 1-norm (= 7) over A326924(73) = 81 with coordinates (5, -4), having 1-norm 5 + 4 = 9 but Euclidean or 2-norm sqrt(41) smaller than 7.
a(1000) = 816 with coordinates (-10, -14).
a(2000) = 2568 with coordinates (-7, -25).
a(5000) = 4476 with coordinates (21, -33).
a(10000) = 15560 with coordinates (-2, -62).
a(20000) = 19566 with coordinates (-36, 70).
a(50000) = 62092 with coordinates (125, -33).
a(10^5) = 135634 with coordinates (-184, -26), taxicab distance 210 from the origin.
a(200'000) = 259798 with coordinates (47, 255).
a(500'000) = 713534 with coordinates (-68, -422).
a(1'000'000) = 995288 with coordinates (217, 499).
a(1'092'366) = 1165672 with coordinates (188, 540), taxicab norm 728 from the origin, is the last square visited by the knight before there is no unvisited square within reach.
By then the earliest square on the spiral not yet visited is number 629641 at (397, 396), taxicab norm 793, and the unvisited square closest to the origin is number 1794929 at (1, 670), taxicab norm 671.
		

Crossrefs

Cf. A328928 for the "value" (= 1-norm) on the visited square.
Cf. A316328 ~ A316667, A326924, A328909 (variants).
Cf. A174344, A274923, A296030 (coordinates of square number n).

Programs

  • PARI
    {Nmax=1e5;/* Full seq. with > 10^6 terms takes long to compute. */ local( K=[[(-1)^(i\2)<<(i>4),(-1)^i<<(i<5)]|i<-[1..8]], 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), 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]), t(x, p=pos(x[1],x[2]))=if(pt(x+K), K))[1][3], U=0,Umin=0); my(A=List(0)); for(n=1, Nmax, U+=1<<(A[n]-Umin); while(bittest(U,0), U>>=1;Umin++); iferr(listput(A, nxt(A[n])), E, break)); print("Index of the last term: ", #A-1); A328908(n)=A[n+1];}

Formula

A328928(n) = |A174344(a(n))| + |A274923(a(n))|, the 1-norm (or taxicab distance) of the square visited at the n-th step.

A326413 Successive squares visited by a knight on the single-digit square spiral, with ties resolved towards the left.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Oct 17 2019

Keywords

Comments

Take the standard counterclockwise square spiral starting at 0, as in A304586, but only write one digit at a time in the cells of the spiral: 0,1,2,3,4,5,6,7,8,9,1,0,1,1,1,2,...
Place a chess knight at cell 0. Move it to the lowest-numbered cell it can attack, and if there is a tie, move it to the cell closest (in Euclidean distance) to the start, and if there is still a tie, move to the left(*).
No cell can be visited more than once.
Inspired by the Trapped Knight video and A316667.
Just as for A316667, the sequence is finite. After a while, the knight has no unvisited squares it can reach, and the sequence ends with a(1217) = 4.
(*)Moving to the left means choose the point with the lowest x-coordinate. This leads to an unambiguous choice of tied squares only for the 'move left' case.

Examples

			The digit-square spiral is
                                .
                                .
    2---2---2---1---2---0---2   2
    |                       |   |
    3   1---2---1---1---1   9   3
    |   |               |   |   |
    2   3   4---3---2   0   1   1
    |   |   |       |   |   |   |
    4   1   5   0---1   1   8   3
    |   |   |           |   |   |
    2   4   6---7---8---9   1   0
    |   |                   |   |
    5   1---5---1---6---1---7   3
    |                           |
    2---6---2---7---2---8---2---9
		

Crossrefs

Extensions

More terms from Luca Petrone
Corrected and extended by Eric Angelini, Oct 24 2019
Showing 1-10 of 34 results. Next