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

A335816 Squares visited by a chess king moving on a square-spiral numbered board where the king moves to the adjacent unvisited square containing the spiral number with the fewest divisors. In case of a tie it chooses the square with the lowest spiral number.

Original entry on oeis.org

1, 2, 3, 11, 29, 13, 31, 59, 33, 61, 97, 139, 191, 251, 193, 141, 142, 143, 101, 65, 37, 17, 5, 19, 7, 23, 47, 79, 49, 25, 9, 8, 6, 4, 14, 15, 34, 35, 62, 63, 98, 99, 64, 66, 67, 103, 149, 201, 263, 331, 409, 493, 587, 586, 687, 797, 689, 589, 691, 591, 499, 593, 501
Offset: 1

Views

Author

Scott R. Shannon, Jun 25 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 an adjacent unvisited square, out of the eight adjacent neighboring squares, which contains the number with the fewest divisors. If two or more adjacent squares exist with the same fewest number of divisors then the square with the lowest spiral number is chosen. Note that if the king simply moves to the smallest available number, as the knight does in A316667, the sequence will be infinite as the king will just follow the square spiral path.
The sequence is finite. After 411 steps the square with number 760 is visited, after which all adjacent neighboring squares have been visited.
Due to the king's preference for squares with the fewest divisors it will move to a prime numbered square when possible, and the lowest prime if two or more unvisited primes are in adjacent squares. Of the 411 visited squares 134 contain prime numbers while 277 contain composites. The largest visited square is a(365) = 3061.

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 eight unvisited squares around a(1) the king can move to are numbered 2,3,4,5,6,7,8,9. Of these 2,3,5,7 have the minimum two divisors, and of those 2 is the smallest.
a(4) = 11. The six unvisited squares around a(3) = 3 the king can move to are numbered 4,11,12,13,14,15. Of these 11 and 13 have the minimum two divisors, and of those 11 is the smallest.
		

Crossrefs

A333714 Squares visited by a chess king moving on a square-spiral numbered board where the king moves to the adjacent unvisited square containing the spiral number with the most divisors. In case of a tie it chooses the square with the highest spiral number.

Original entry on oeis.org

1, 8, 24, 48, 80, 120, 168, 224, 288, 360, 440, 528, 624, 728, 840, 960, 1088, 1224, 1368, 1520, 1680, 1848, 2024, 2208, 2400, 2600, 2808, 3024, 3248, 3480, 3720, 3968, 4224, 4488, 4760, 5040, 5328, 5624, 5928, 6240, 6560, 6888, 7224, 7568, 7920, 8280, 8648, 9024, 9408, 9800, 10200, 10608
Offset: 1

Views

Author

Scott R. Shannon, Jul 02 2020

Keywords

Comments

This sequence 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 an adjacent unvisited square, out of the eight adjacent neighboring squares, which contains the number with the most divisors. If two or more adjacent squares exist with the same highest number of divisors then the square with the highest spiral number is chosen. Given both of these rules tend to force the king to squares with larger numbers, and thus move away from the central 1 starting square, it is remarkable that the king is eventually trapped. Note that if the king simply moves to the highest available number the sequence will be infinite as the king will step along the southeast diagonal from square 1 forever.
The sequence is finite. After 1113 steps the square with number 855481 is visited, after which all adjacent neighboring squares have been visited.
Due to the king's preference for squares with the most divisors it will avoid prime numbers unless no other choice exists. Of the 1113 visited squares only once does it visit a square with a prime number, at a(308) = 108223. This is due to a(307) = 106913 having square 108223 as its sole neighboring unvisited square. This is the only time in the sequence where only one unvisited adjacent neighbor is available.
As even numbers >= 6 will always contain 4 or more divisors the king will tend to visit more even numbers than odd numbers; in the 1113 visited squares 929 contain an even number while only 184 contain an odd number.
As the even numbers are diagonally adjacent in the square spiral the king's path will be dominated by diagonal steps, often taking many diagonal steps in succession - see the attached link image. In fact after the first downward step to 8 the next 110 steps are along the southeast diagonal, stepping to successively larger even numbers. This sequence is finally broken on the 112th step when the square with number 50624, with 28 divisors, is the next square in the southeast direction. However the square with number 50622, with 32 divisors, is in the southwest direction so is the next square chosen. It is not until the 166th step, to the square with number 108230, that the path takes a step to a lower number than the one it is currently on.
The largest visited square is a(1050) = 942676. The visited square with the maximum number of divisors is a(680) = 388080, which has 180 divisors. The lowest unvisited square is 2.

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) = 8. The eight unvisited squares around a(1) the king can move to are numbered 2,3,4,5,6,7,8,9. Of these 6 and 8 both have the maximum four divisors, and of those 8 is the largest.
a(3) = 24. The seven unvisited squares around a(2) = 8 the king can move to are numbered 9,2,6,7,22,23,24. Of these 24 has eight divisors, the largest number.
a(113) = 50622. The seven unvisited squares around a(112) = 49728 the king can move to are numbered 50622, 49727, 50623, 48841, 50624, 49729, 48842. Of these 50622 has thirty-two divisors, the largest number. This is the step that breaks the sequence of 110 steps to the southeast direction starting from a(2) = 8.
a(308) = 108223. This is the first and only time a prime number is visited; a(307) = 106913 has square 108223 as the sole unvisited adjacent neighbor.
a(1114) = 855481. The two unvisited squares around a(1113) = 859184 the king can move to are numbered 862894 and 855481. Of these 855481 has eight divisors, the largest number. However square 855481 is surrounded by the eight squares with numbers 859183, 855480, 851785, 859184, 851786, 859185, 855482, 851787 all of which have been previously visited, so the king is trapped.
		

Crossrefs

Cf. A333713 (choose lowest spiral number in case of tie), A335816, A316667, A330008, A329520, A326922, A328928, A328929, A033996.

A333713 Squares visited by a chess king moving on a square-spiral numbered board where the king moves to the adjacent unvisited square containing the spiral number with the most divisors. In case of a tie it chooses the square with the lowest spiral number.

Original entry on oeis.org

1, 6, 18, 40, 70, 108, 72, 42, 20, 21, 44, 45, 75, 114, 160, 216, 280, 350, 351, 352, 432, 520, 616, 720, 832, 952, 1080, 1216, 1360, 1512, 1672, 1840, 2016, 2200, 2392, 2592, 2800, 3016, 3240, 3472, 3710, 3956, 4212, 4476, 4746, 5024, 5310, 5022, 4743, 4472, 4473, 4209, 4208, 3952, 3705
Offset: 1

Views

Author

Scott R. Shannon, Jul 02 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 an adjacent unvisited square, out of the eight adjacent neighboring squares, which contains the number with the most divisors. If two or more adjacent squares exist with the same highest number of divisors then the square with the lowest spiral number is chosen. Note that if the king simply moves to the highest available number the sequence will be infinite as the king will step along the south-east diagonal from square 1 forever.
The sequence is finite. After 1784 steps the square with number 1478 is visited, after which all adjacent neighboring squares have been visited.
Due to the king's preference for squares with the most divisors it will avoid prime numbers unless no other choice exists. Of the 1784 visited squares only 27 contain prime numbers while 1757 contain composites. As even numbers >= 6 will always contain 4 or more divisors the king will tend to visit more even numbers than odd numbers; in the 1784 visited squares 1289 contain an even number while 495 contain an odd number. As the even numbers are diagonally adjacent in the square spiral the king's path will be dominated by diagonal steps, often taking numerous diagonal steps is succession - see the attached link image.
The largest visited square is a(390) = 17664. The lowest unvisited square is 2.

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) = 6. The eight unvisited squares around a(1) the king can move to are numbered 2,3,4,5,6,7,8,9. Of these 6 and 8 both have the maximum four divisors, and of those 6 is the smallest.
a(3) = 18. The seven unvisited squares around a(2) = 6 the king can move to are numbered 4,5,18,19,20,7,8. Of these 18 and 20 have the maximum six divisors, and of those 18 is the smallest.
a(603) = 821. This is the first prime number visited; a(602) = 939 has square 821 as the sole unvisited adjacent neighbor.
		

Crossrefs

Cf. A333714 (choose highest spiral number in case of tie), A335816, A316667, A330008, A329520, A326922, A328928, A328929.

A335844 Squares visited by a knight moving on a square-spiral numbered board where the knight moves to the unvisited square containing the spiral number with the fewest divisors. In case of a tie it chooses the square with the lowest spiral number.

Original entry on oeis.org

1, 10, 3, 6, 17, 4, 7, 2, 5, 8, 11, 14, 29, 86, 27, 12, 31, 94, 61, 16, 19, 22, 41, 106, 67, 18, 37, 62, 139, 98, 191, 142, 97, 34, 13, 58, 89, 178, 127, 52, 83, 26, 47, 118, 163, 76, 23, 20, 43, 70, 109, 74, 71, 44, 73, 158, 113, 214, 157, 274, 271, 212, 277, 346, 211
Offset: 1

Views

Author

Scott R. Shannon, Jun 26 2020

Keywords

Comments

This sequences gives the numbers of the squares visited by a knight moving on a square-spiral numbered board, as described in A316667, where at each step the knight goes to the neighbor one knight-leap away which contains the number with the fewest divisors. If two or more neighbors exist with the same fewest number of divisors then the square with the lowest spiral number is chosen.
The sequence is finite. After 528 steps the square with number 33 is visited, after which all neighboring squares have been visited.
Due to the knight's preference for squares with the fewest divisors the knight will leap to a prime numbered square when possible, and the lowest prime if two or more unvisited primes are within one knight-leap. Therefore this sequence matches A330008 for the first 13 terms, but on the 13th step the square with number 86 is chosen as no primes are available and 86 has only four divisors, while A330008 chooses 32, the smallest available number, but which has six divisors.
Of the 528 visited squares 198 contain prime numbers while 330 contain composites. The largest visited square is a(410) = 3656.

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 knight.
a(2) = 10. The eight unvisited squares the knight can leap to from a(1) are numbered 10,12,14,16,18,20,22,24. Of these 10,14,22 have the minimum four divisors, and of those 10 is the smallest.
		

Crossrefs

A336092 Squares visited by a chess king moving on a square-spiral numbered board where the king moves to the adjacent unvisited square containing the spiral number with the fewest divisors. In case of a tie it chooses the square with the largest spiral number.

Original entry on oeis.org

1, 7, 23, 47, 79, 49, 25, 9, 11, 29, 53, 87, 127, 177, 233, 299, 373, 454, 543, 641, 746, 859, 979, 1109, 1247, 1393, 1249, 1111, 983, 863, 751, 647, 753, 866, 865, 985, 1115, 1253, 1399, 1553, 1714, 1883, 2059, 2243, 2437, 2638, 2846, 3063, 3287, 3061, 2843, 2633, 2841, 3057, 3281, 3513, 3755
Offset: 1

Views

Author

Scott R. Shannon, Jul 08 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 an adjacent unvisited square, out of the eight adjacent neighboring squares, which contains the number with the fewest divisors. If two or more adjacent squares exist with the same fewest number of divisors then the square with the largest spiral number is chosen. Note that if the king simply moves to the largest available number the sequence will be infinite as the king will step along the south-east diagonal from square 1 forever.
The sequence is finite. After 21276 steps the square with spiral number 281747427 is visited, after which all adjacent neighboring squares have been visited. The end square is extremely far from the starting square, approximately 8860 units away, as the king is drawn generally outward due to its preference for the largest numbered square when the divisor counts are tied - see the link image. This end square spiral number is currently the largest for any square spiral single-visit trapped knight or trapped king path in the OEIS.
Due to the king's preference for squares with the fewest divisors it will move to a prime numbered square when possible, and the lowest prime if two or more unvisited primes are in adjacent squares. Of the 21276 visited squares 4363 contain prime numbers while 16913 contain composites. The largest visited square is a(21208) = 282486458.

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) = 7. The eight unvisited squares around a(1) the king can move to are numbered 2,3,4,5,6,7,8,9. Of these 2,3,5,7 have the minimum two divisors, and of those 7 is the largest.
a(3) = 23. The seven unvisited squares around a(2) the king can move to are numbered 6,8,19,20,21,22,23. Of these 19 and 23 have the minimum two divisors, and of those 23 is the largest.
		

Crossrefs

Cf. A335816 (choose lowest number in case of tie), A333713, A333714, A316667, A330008, A329520, A326922.

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])
Showing 1-6 of 6 results.