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-40 of 81 results. Next

A362956 a(n) is the y-coordinate of the n-th point in a square spiral mapped to a square grid rotated by Pi/4 using the distance-limited strip bijection described in A307110.

Original entry on oeis.org

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

Views

Author

Hugo Pfoertner, May 10 2023

Keywords

Crossrefs

A362955 gives the corresponding x-coordinates.

Programs

  • PARI
    \\ for functions ax, ay, p see A362955
    for (k=0, 81, print1 (p(ax(k),ay(k))[2]", "))

A367895 a(n) is the x-coordinate of the n-th point in a square spiral mapped to a square grid rotated by Pi/4 using the variant of the distance-limited strip bijection described in A367150.

Original entry on oeis.org

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

Views

Author

Hugo Pfoertner and Rainer Rosenthal, Dec 04 2023

Keywords

Crossrefs

A367896 gives the corresponding y-coordinates.

Programs

  • PARI
    \\ ax(n), ay(n) after Kevin Ryde's functions in A174344 and A274923.
    \\ It is assumed that the PARI program from A367150 has been loaded and the functions defined there are available.
    ax(n) = {my (m=sqrtint(n), k=ceil(m/2)); n -= 4*k^2; if (n<0, if (n<-m, k, -k-n), if (n
    				

A328894 a(n) is the number of steps before being trapped for a knight starting on square n on a single-digit square-spiral numbered board and 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

1069, 884, 995, 884, 885, 988, 885, 943, 549, 1070, 942, 548, 881, 951, 987, 886, 661, 601, 1123, 1313, 1034, 1070, 1101, 1070, 1930, 943, 655, 882, 1930, 943, 1471, 992, 583, 884, 806, 704, 1062, 1098, 1096, 1129, 1174, 723, 438, 1102, 854
Offset: 1

Views

Author

Scott R. Shannon, Oct 29 2019

Keywords

Comments

This is the number of completed steps before being trapped for a knight starting on a square with square spiral number n for a knight with step rules given in A326918. We use the standard square spiral number of A316667 to define the start square, as opposed to its single-digit board value, as it is a unique value for each square on the board.
Unlike board numbering methods which have a unique smallest value at the origin, which causes the knight to immediately move toward it when starting from any other square, the single-digit numbering method has multiple small values distributed over the board. Therefore when starting from an arbitrary square the knight may move in any direction, toward the smallest valued neighboring square one knight leap away. Only when two or more such squares exist with the same number does the origin start to act as the square of attraction. This means some knight paths will meander well away from the origin and can become trapped before ever approaching it.
For starting squares n from 1 to 10^6 the longest path before being trapped is a(435525) = 2865. The smallest path to being trapped is a(42329) = 109. The path which ends on the square with the largest standard square spiral number is a(31223), which ends on square 47863. The first path which ends on the square with the smallest standard spiral number is a(138), which ends on square 4. This square is adjacent to the origin, but it is curious that the three squares with smaller spiral numbers, 1,2,3, do not act as the end square for any of the starting squares studied.

Examples

			a(1) = 1069. See A326918.
The squares are numbered using single digits of the spiral number ordering as:
                                .
                                .
    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
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

A334751 a(n) is the number immediately above n in a clockwise square spiral of the positive integers with the first step to the right.

Original entry on oeis.org

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

Views

Author

Peter Kagey, May 10 2020

Keywords

Comments

Equivalently the number immediately below n in a counterclockwise spiral of the positive integers with the first step to the right.
This is a permutation of the positive integers. A334752 is the inverse permutation.

Examples

			For n = 1, a(1) = 8 because 8 is immediately above one in the clockwise square spiral with first step to the right:
  21--22--23--24--25--26
  |                    |
  20  7---8---9---10  27
  |   |            |   |
  19  6   1---2   11  28
  |   |       |    |   |
  18  5---4---3   12  29
  |                |   |
  17--16--15--14--13  30
                       |
  36--35--34--33--32--31
		

Crossrefs

Cf. A068225 (right), A068226 (left), A334752 (below).
Cf. A174344 (x-coordinate), A268038 (y-coordinate).

A334752 a(n) is the number immediately below n in a clockwise square spiral of the positive integers with the first step to the right.

Original entry on oeis.org

4, 3, 14, 15, 16, 5, 6, 1, 2, 11, 12, 13, 32, 33, 34, 35, 36, 17, 18, 19, 20, 7, 8, 9, 10, 27, 28, 29, 30, 31, 58, 59, 60, 61, 62, 63, 64, 37, 38, 39, 40, 41, 42, 21, 22, 23, 24, 25, 26, 51, 52, 53, 54, 55, 56, 57, 92, 93, 94, 95, 96, 97, 98, 99, 100, 65, 66
Offset: 1

Views

Author

Peter Kagey, May 10 2020

Keywords

Comments

Equivalently the number immediately above n in a counterclockwise square spiral of the positive integers with the first step to the right.
This is a permutation of the positive integers. A334751 is the inverse permutation.

Examples

			For n = 1, a(1) = 4 because 4 is immediately below 1 in the clockwise square spiral with first step to the right:
  21--22--23--24--25--26
  |                    |
  20  7---8---9---10  27
  |   |            |   |
  19  6   1---2   11  28
  |   |       |    |   |
  18  5---4---3   12  29
  |                |   |
  17--16--15--14--13  30
                       |
  36--35--34--33--32--31
		

Crossrefs

Cf. A068225 (right), A068226 (left), A334751 (above).
Cf. A174344 (x-coordinate), A268038 (y-coordinate).

A335856 Squares visited by a chess king on a spirally numbered infinite board where the king moves to the adjacent unvisited square containing the lowest prime number. If no such square is available it chooses the lowest-numbered adjacent unvisited square.

Original entry on oeis.org

1, 2, 3, 11, 29, 13, 31, 59, 32, 14, 4, 5, 17, 37, 67, 103, 149, 104, 66, 38, 18, 19, 7, 23, 47, 79, 48, 24, 8, 6, 20, 41, 71, 43, 73, 109, 72, 42, 21, 22, 44, 45, 46, 76, 75, 113, 74, 112, 110, 111, 157, 211, 271, 209, 269, 337, 267, 205, 151, 107, 69, 39, 40, 68, 105, 106, 70, 108
Offset: 1

Views

Author

Scott R. Shannon, Jun 27 2020

Keywords

Comments

This sequences gives the numbers of the squares visited by a chess king moving on a square-spiral numbered board where the king starts on the 1 numbered square and at each step moves to the adjacent unvisited square containing the lowest prime number. If no adjacent unvisited square contains a prime number then the square with the lowest spiral number is chosen. Note that if the king simply moves to the lowest unvisited number the sequence will be infinite as the king will just follow the square spiral path.
The sequence is finite. After 719 steps the square with number 437 is visited, after which all adjacent neighboring squares have been visited.
Of the 719 visited squares 165 contain prime numbers while 554 contain composites. As the odd numbers are diagonally adjacent in the square spiral the king's path will contain many diagonal steps, often taking numerous diagonal steps is succession - see the attached link image.
The largest visited square is a(709) = 1367. The lowest unvisited square is 33.
The 719 steps until self-trapping occurs are significantly larger than the expected average of 210 moves to self-trapping for a random walk of the king on an infinite chessboard. See the link to the probability density graphs in A323562. - Hugo Pfoertner, Jul 19 2020
When the grid points are labeled starting with 0 at the origin, the king gets trapped after 171 moves at (3,0), after going as far as (10,-11) to the south-east and (-8,7) and (-5,8) to the north-east, see A383183. - M. F. Hasler, May 13 2025

Examples

			The board is numbered with the square spiral:
.
  17--16--15--14--13   .
   |               |   .
  18   5---4---3  12   29
   |   |       |   |   |
  19   6   1---2  11   28
   |   |           |   |
  20   7---8---9--10   27
   |                   |
  21--22--23--24--25--26
.
a(1) = 1, the starting square for the king.
a(2) = 2. The four unvisited squares around a(1) the king can move which contain prime numbers are 2,3,5,7. Of those 2 is the lowest.
a(4) = 11. The two unvisited squares around a(3) = 3 the king can move to which contain prime numbers are 11 and 13. Of those 11 is the lowest.
a(9) = 32. There are no unvisited squares around a(8) = 59 which contain prime numbers. The seven other unvisited squares are numbered 32,33,58,60,93,94,95. Of those 32 is the lowest.
		

Crossrefs

Cf. A000040 (the primes), A010051 (characteristic function of the primes).

Programs

  • Python
    from sympy import isprime # or use A010051
    def square_number(z): return int(4*y**2-y-x if (y := z.imag) >= abs(x := z.real)
        else 4*x**2-x-y if -x>=abs(y) else (4*y-3)*y+x if -y>=abs(x) else (4*x-3)*x+y)
    def A335856(n, moves=(1, 1+1j, 1j, 1j-1, -1, -1-1j, -1j, 1-1j)):
        if not hasattr(A:=A335856, 'terms'): A.terms=[1]; A.pos=0
        while len(A.terms) < n:
            try: move = min((1-isprime(s), s, z) for d in moves if
                            (s := square_number(z := A.pos+d)+1)not in A.terms)
            except ValueError:
                raise IndexError(f"Sequence has only {len(A.terms)} terms")
            A.terms.append(move[1]); A.pos = move[2]
        return A.terms[n-1]
    A335856(999) # gives IndexError: Sequence has only 720 terms
    A335856.terms # shows all 720 terms; append [:N] to see only N terms
    # M. F. Hasler, May 13 2025

Extensions

Name edited by Peter Munn, May 11 2025
More terms (complete sequence) from M. F. Hasler, May 13 2025

A341327 The spiral numbers not covered by any square in the square spiral tiling of A341160.

Original entry on oeis.org

6, 19, 28, 29, 53, 54, 61, 62, 63, 86, 87, 114, 115, 116, 117, 161, 162, 163, 164, 185, 186, 187, 188, 189, 227, 228, 229, 230, 231, 232, 244, 245, 246, 247, 248, 311, 312, 313, 314, 315, 407, 408, 409, 410, 411, 412, 413, 771, 772, 773, 774, 775, 776, 777, 778, 779, 866, 867, 868, 869, 870, 871
Offset: 1

Views

Author

Scott R. Shannon, Feb 09 2021

Keywords

Comments

See A341160 for an image of the square spiral tiling which shows the uncovered numbers in black.

Examples

			a(1) = 6 and a(2) = 19 as the first, third, fourth, and seventh square of A341160 cover the numbers (1), (5,18), (7,20), (40) respectively which leaves a gap containing numbers 6 and 19 which cannot be covered by any subsequence square.
		

Crossrefs

A344547 Lexicographically earliest sequence of nonnegative terms forming a clockwise square spiral when nothing else is read except the parity of the terms (see the Comments section).

Original entry on oeis.org

0, 1, 3, 2, 5, 4, 7, 6, 8, 9, 10, 12, 11, 14, 16, 18, 13, 20, 22, 24, 15, 26, 28, 30, 32, 17, 34, 36, 38, 40, 19, 42, 44, 46, 48, 50, 21, 52, 54, 56, 58, 60, 23, 62, 64, 66, 68, 70, 72, 25, 74, 76, 78, 80, 82, 84, 27, 86, 88, 90, 92, 94, 96, 98, 29, 100, 102, 104, 106, 108, 110, 112, 31, 114
Offset: 1

Views

Author

Eric Angelini and Carole Dubois, Jun 04 2021

Keywords

Comments

An even term turns the pencil 0 degrees to the right, then advances 1 unit; an odd term turns the pencil 90 degrees to the right, then advances 1 unit.

Examples

			The pencil points towards the East before the start. The 0 doesn't change its orientation and a 1-unit line directed towards the East is traced. As 1 is odd, the pencil turns 90 degrees towards the South and a 1-unit line is traced. As 3 is odd, the pencil turns 90 degrees towards the West and a 1-unit line is traced. As 2 is even, the pencil doesn't change its orientation (towards the West) and a 1-unit line is traced. As 5 is odd, the pencil turns 90 degrees towards the North and a 1-unit line is traced. As 4 is even, the pencil doesn't change its orientation (towards the North) and a 1-unit line is traced. Etc.
		

Crossrefs

Cf. A344548 (same idea with digits), A174344 (an example of a clockwise square spiral).

A344548 Lexicographically earliest sequence of nonnegative terms forming a clockwise square spiral when nothing else is read except the parity of the digits (see the Comments section).

Original entry on oeis.org

0, 1, 3, 2, 5, 4, 7, 6, 8, 9, 20, 10, 22, 12, 24, 14, 26, 21, 28, 40, 16, 42, 44, 18, 46, 48, 30, 60, 62, 23, 64, 66, 68, 32, 80, 82, 84, 34, 86, 88, 201, 200, 202, 203, 204, 206, 205, 208, 220, 222, 36, 224, 226, 207, 228, 240, 242, 25, 244, 246, 248, 27, 260, 262, 264, 209, 266, 268, 280, 221, 282, 284
Offset: 1

Views

Author

Eric Angelini and Carole Dubois, Jun 04 2021

Keywords

Comments

An even digit turns the pencil 0 degrees to the right, then advances 1 unit; an odd digit turns the pencil 90 degrees to the right, then advances 1 unit.

Examples

			The pencil points towards the East before the start. The 0 doesn't change its orientation and a 1-unit line directed towards the East is traced. As 1 is odd, the pencil turns 90 degrees towards the South and a 1-unit line is traced. As 3 is odd, the pencil turns 90 degrees towards the West and a 1-unit line is traced. As 2 is even, the pencil doesn't change its orientation (towards the West) and a 1-unit line is traced. As 5 is odd, the pencil turns 90 degrees towards the North and a 1-unit line is traced. As 4 is even, the pencil doesn't change its orientation (towards the North) and a 1-unit line is traced. Etc.
When it comes to a(11) = 20, the pencil reads 2 (even), doesn't change its orientation and advances 1 square, then reads 0 (even), doesn't change its orientation and advances 1 square again.
When it comes to a(12) = 10, the pencil reads 1 (odd), turns to the right and advances 1 square, then reads 0 (even), doesn't change its orientation and advances 1 square. Etc.
		

Crossrefs

Cf. A344547 (same idea with terms), A174344 (an example of a clockwise square spiral).

A351043 Lexicographically earliest non-extendable Racetrack trajectory (using von Neumann neighborhood) on spiral on infinite square grid.

Original entry on oeis.org

0, 1, 9, 24, 46, 45, 21, 6, 4, 15, 33, 32, 12, 11, 10, 8, 7, 5, 16, 36, 63, 97, 96, 60, 13, 27, 50, 80, 119, 165, 164, 116, 75, 41, 68, 66, 64, 99, 141, 140, 138, 93, 55, 86, 84, 49, 79, 78, 76, 43, 69, 104, 102, 100, 143, 193, 192, 190, 137, 57, 54, 52, 25
Offset: 0

Views

Author

Pontus von Brömssen, Jan 30 2022

Keywords

Comments

The car starts at square 0 and thereafter moves, according to the rules of Racetrack with von Neumann neighborhood (see A351042), to the lowest numbered unvisited square. The spiral numbering is described in A316328. After 146 steps, the car cannot move to any unvisited square, so the sequence is finite with 147 terms.
The position of the car after n steps is (A174344(a(n)+1), A274923(a(n)+1)). - Pontus von Brömssen, Jan 30 2025

Crossrefs

Previous Showing 31-40 of 81 results. Next