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 11-17 of 17 results.

A343746 The x,y,z coordinates of the points visited by a knight on a 3D cubic lattice using the step rules given in A343678.

Original entry on oeis.org

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

Views

Author

Scott R. Shannon, Apr 27 2021

Keywords

Comments

See A343678 for the rules determining the knight's steps on the cubic lattice and for images of the resulting path.

Examples

			a(1),a(2),a(3) = 0,0,0. The knight starts at the origin on the lattice.
a(4),a(5),a(6) = 0,1,2. The 24 points the knight could step to on the first step all have only 1 visited neighbor and are all the same distance from the origin. Also they all have coordinates as arrangements of 0,+-1,+-2 thus the only way they can be separated is using rules 5 and 6 of A343678 which selects the smallest magnitudes of the x,y,z coordinates followed by the largest absolute x,y,z coordinates. This leads to the point (0,1,2) being selected.
a(7),a(8),a(9) = 0,-1,1. The other two possible points which have the same number of visited neighbors and are the same distance from the origin are (1,1,0) and (-1,1,0), but (0,-1,1) is chosen as that has the minimum x-coordinate magnitude.
a(52),a(53),a(54) = -1,-2,2. This is the first point that is chosen due to having the maximum product of the absolute values of its coordinate.
a(577),a(578),a(579) = -2,-3,-1. This is the first point that is stepped to that has two visited neighboring points.
a(1978),a(1979),a(1980) = -3,3,7. This is the first point that is stepped to that has three visited neighboring points.
		

Crossrefs

Cf. A343678 (point square distances from origin), A343747 (point x coordinates), A343748 (point y coordinates), A343749 (point z coordinates) A330189, A329520, A316667.

A343747 The x coordinates of the points visited by a knight on a 3D cubic lattice using the step rules given in A343678.

Original entry on oeis.org

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

Views

Author

Scott R. Shannon, Apr 27 2021

Keywords

Comments

See A343678 for the rules determining the knight's steps on the cubic lattice and for images of the resulting path.

Crossrefs

Cf. A343678 (point square distances from origin), A343746 (point x,y,z coordinates), A343748 (point y coordinates), A343749 (point z coordinates), A330189, A329520, A316667.

A343388 Squares visited by a knight moving on a square-spiral with numbers equal to the ordered divisors of the positive integers 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 ordered spiral number is used if the distances are equal.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 4, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 3, 1, 1, 1, 2, 2, 1, 1, 1, 2, 1, 5, 1, 1, 3, 1, 4, 1, 1, 8, 1, 3, 2, 2, 3, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1
Offset: 1

Views

Author

Scott R. Shannon, Apr 13 2021

Keywords

Comments

Many of the visited squares are numbered 1 due to the large number of such terms on the board and the knight's preference for the lowest available numbered square.
The sequence is finite. After 358 steps the square with spiral number 13, with ordered spiral number 37, is reached after which all eight adjacent squares have been visited. The visited square with the largest spiral number is 28.
See A343389 for the visited squares given as the ordered spiral numbers.

Examples

			The square-spiral is numbered with the ordered divisors of the positive integers as follows:
.
   1---7---1---6---3   .
   |               |   .
   2   3---1---2   2   11
   |   |       |   |   |
   4   1   1---1   1   1
   |   |           |   |
   8   2---4---1---5   10
   |                   |
   1---3---9---1---2---5
.
a(1) = 1, the starting square of the knight.
a(2) = 1. One square numbered 1 can be stepped to from the starting square, the square with coordinates (1,-2) relative to that square.
a(9) = 2. This is the first time a square greater than 1 is stepped to. The available squares after 7 steps are 3, 11, 10, 2, 9, 2, and 3. The 2 at coordinates (-1,-1) relative to the starting square is because it is the closest number to that square.
a(146) = 28. This is the largest numbered square that is stepped to. The available squares after the 144th step are 117, 213, 47, 70, 61, and 28, and 28 is the smallest of these.
a(359) = 13. This is the final square stepped to as no further unvisited square is available.
		

Crossrefs

A336208 Squares visited by a knight on a square-spiral numbered board and moving to the lowest available unvisited square at each step, where the step is not in the same direction as the previous step.

Original entry on oeis.org

1, 10, 3, 6, 9, 4, 7, 2, 5, 8, 11, 14, 29, 32, 15, 12, 27, 24, 49, 52, 25, 28, 13, 34, 17, 40, 21, 46, 75, 22, 19, 16, 33, 30, 53, 26, 47, 80, 51, 48, 23, 44, 41, 18, 37, 62, 99, 36, 39, 20, 43, 70, 109, 42, 45, 74, 71, 110, 113, 72, 111, 154, 73, 108
Offset: 1

Views

Author

Scott R. Shannon, Jul 12 2020

Keywords

Comments

This is a variation of A316667. The same knight move rules apply, but at each step the knight cannot move in the same direction as its previous step.
The sequence is finite. After 217 steps the square with spiral number 118 is reached after which all surrounding squares have been visited.
The first term where this sequence differs from A316667 is a(19) = 49. The previous step was from a(17) = 27 to a(18) = 24, a step 1 unit down and 2 units to the left. The minimum unvisited spiral number one knight leap away from 24 is 45, but that is also in a direction 1 unit down and 2 units to the left, so cannot be chosen. The next closest unvisited square is 49, 1 unit down and 2 units to the right.

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 of the knight.
a(2) = 10. The eight unvisited squares one knight leap away from a(1) are numbered 10,12,14,16,18,20,22,24. Of these 10 is the lowest.
a(19) = 49. The four unvisited squares one knight leap away from a(18) = 24 are numbered 45,49,77,79. Of these 45 is the lowest but that would require a step 1 unit down and 2 units left from 24, which is the same step as a(17) = 27 to a(18) = 24, so is not allowed. The next lowest available square is 49.
		

Crossrefs

A343385 The ordered square spiral numbers visited by the knight in A343356.

Original entry on oeis.org

1, 10, 29, 2, 5, 40, 7, 4, 11, 26, 83, 174, 123, 84, 27, 12, 15, 18, 35, 64, 97, 36, 65, 142, 63, 66, 149, 102, 143, 146, 103, 100, 141, 62, 33, 58, 55, 28, 87, 178, 131, 92, 31, 54, 13, 60, 139, 248, 191, 316, 247, 136, 91, 182, 185, 132, 237, 300, 371, 450, 295, 228, 173, 82, 49, 78, 45, 74
Offset: 1

Views

Author

Scott R. Shannon, Apr 13 2021

Keywords

Comments

This is the ordered square-spiral numbers visited by a knight on a square spiral as numbered in A343356. See that sequence for further details.

Crossrefs

A343389 The ordered square-spiral numbers visited by the knight in A343388.

Original entry on oeis.org

1, 24, 11, 4, 9, 6, 15, 2, 7, 46, 21, 72, 75, 42, 19, 38, 105, 202, 151, 104, 147, 262, 199, 102, 67, 36, 61, 32, 3, 28, 51, 124, 85, 128, 53, 30, 59, 96, 141, 250, 189, 316, 251, 392, 315, 474, 563, 660, 769, 1006, 767, 658, 879, 762, 555, 462, 553, 756, 873, 998, 761, 556, 381, 460, 305
Offset: 1

Views

Author

Scott R. Shannon, Apr 13 2021

Keywords

Comments

This is the ordered square-spiral numbers visited by a knight on a square spiral as numbered in A343388. See that sequence for further details.

Crossrefs

A364247 Squares visited by the chess king on a spiral-numbered board, where the king moves to the square with the fewest steps to reach 1 using the 3x+1 function. In case of a tie, the king moves to the square with the smallest number.

Original entry on oeis.org

1, 2, 4, 16, 5, 6, 8, 24, 10, 26, 48, 80, 120, 168, 122, 170, 226, 227, 228, 172, 173, 174, 232, 176, 128, 88, 56, 90, 92, 136, 93, 58, 32, 13, 3, 12, 11, 28, 52, 84, 85, 53, 29, 30, 31, 57, 89, 130, 180, 181, 131, 132, 133, 184, 244, 186, 245, 312, 246, 314
Offset: 1

Views

Author

Wagner Martins, Jul 15 2023

Keywords

Comments

The king moves to the square with the fewest steps to reach 1 using the 3x+1 function. The function works as follows: start with the number, and if it is even, divide it by 2. Otherwise, multiply it by 3 and add 1, and repeat the process until you reach 1. If there are two squares with the same number of steps, the king picks the square with the smaller number.
The sequence contains 511 terms; the king gets stuck because all the adjacent squares are already taken.
The last square visited is numbered a(511) = 6619.
The highest-numbered square reached is a(327) = 12853.

Examples

			The spiral board:
  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 initial square.
a(2) = 2 because 2 has the fewest steps to reach 1 applying the function {n/2 if n is even, 3n + 1 if n is odd} repeatedly.
		

Crossrefs

Programs

  • Python
    class Spiral:
        def _init_(self):
            self.spiral = [[1]]
        def increment(self, increment_size):
            if increment_size == 0:  # Recursion stop condition
                return
            size = len(self.spiral)
            count = size ** 2 + 1
            if size % 2 != 0:
                self.spiral.insert(0, [])
                for i in reversed(range(0, size + 1)):
                    self.spiral[i].append(count)
                    count += 1
                for _ in range(size):
                    self.spiral[0].insert(0, count)
                    count += 1
            else:
                self.spiral.append([])
                for i in range(0, size + 1):
                    self.spiral[i].insert(0, count)
                    count += 1
                for _ in range(size):
                    self.spiral[-1].append(count)
                    count += 1
            self.increment(increment_size - 1)
        def find_position(self, target):
            for i, row in enumerate(self.spiral):
                for j, element in enumerate(row):
                    if element == target:
                        return (i, j)
        def find_king_neighbours(self, target):
            i, j = self.find_position(target)
            neighbours_position = (
                (i - 1, j - 1), (i - 1, j), (i - 1, j + 1),
                (i, j - 1), (i, j + 1),
                (i + 1, j - 1), (i + 1, j), (i + 1, j + 1)
            )
            return [self.spiral[i][j] for i, j in neighbours_position]
    def steps(x):
        count = 0
        while x != 1:
            if x % 2 == 0:
                x //= 2
            else:
                x = 3 * x + 1
            count += 1
        return count
    def min_steps(lst):
        """Find the value with the minimal amount of steps with the 3x+1 function (the smallest in case of tie)"""
        if len(lst) == 0:
            raise ValueError("Empty list")
        min_steps_seen, min_seed = float("inf"), float("inf")
        for n in lst:
            step = steps(n)
            if step < min_steps_seen or step == min_steps_seen and n < min_seed:
                min_steps_seen = step
                min_seed = n
        return min_seed
    spiral = Spiral()
    sequence = [1]
    count = 1
    print(count, 1)
    while True:
        count += 1
        spiral.increment(2)
        neighbours = spiral.find_king_neighbours(sequence[-1])
        neighbours = [n for n in neighbours if n not in sequence]
        try:
            next_square = min_steps(neighbours)
        except ValueError:
            print("End of the sequence.")
            break
        sequence.append(next_square)
        print(count, sequence[-1])
Previous Showing 11-17 of 17 results.