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

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

A358278 Squares visited by a knight moving on a square-spiral numbered board where the knight moves to the smallest numbered unvisited square and where the square is on a different square ring of numbers than the current square.

Original entry on oeis.org

1, 10, 3, 16, 33, 4, 11, 8, 19, 38, 5, 14, 29, 2, 13, 28, 9, 12, 27, 24, 7, 18, 35, 60, 15, 6, 17, 34, 59, 30, 53, 26, 79, 46, 21, 40, 67, 36, 61, 32, 55, 86, 51, 48, 23, 44, 71, 20, 39, 66, 99, 62, 37, 68, 41, 22, 43, 70, 105, 148, 65, 98, 139, 94, 31, 54, 85, 50, 25, 52, 49, 78, 45, 74
Offset: 1

Views

Author

Scott R. Shannon and Eric Angelini, Nov 08 2022

Keywords

Comments

This sequence is finite: after 1455 squares have been visited the square with number 1345 is reached after which all eight neighboring squares the knight could move to have already been visited. See the linked image. The largest visited square is a(1374) = 1996 while the smallest unvisited square is 1024.

Examples

			The board is numbered using a square spiral. The square rings of numbers are shown below:
.
    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
                         |
   -44--45--46--47--48--49
.
a(4) = 16 as after the knight moves to the square containing a(3) = 3 the available unvisited squares are 6, 8, 16, 28, 30, 32, 34. Of these 6 and 8 are the smallest but both of them lie on the first square ring of numbers, the same as the current number 3. Of the remaining squares the smallest unvisited square is 16. This is the first term to differ from A316667.
		

Crossrefs

A362027 Squares visited by a knight moving on a square-spiral numbered board where the knight moves to a previously unvisited square with a number as close as possible to the number of the current square. If two such squares exist the smaller numbered square is chosen.

Original entry on oeis.org

1, 10, 3, 6, 9, 12, 15, 18, 7, 4, 11, 8, 5, 2, 13, 28, 25, 46, 21, 40, 17, 34, 59, 56, 29, 32, 55, 58, 33, 30, 53, 26, 47, 22, 19, 16, 37, 62, 95, 136, 91, 130, 87, 52, 49, 24, 27, 48, 51, 80, 83, 120, 123, 84, 81, 118, 77, 44, 41, 68, 103, 100, 63, 66, 39, 36, 61, 94, 57, 88, 127, 174, 229, 170
Offset: 1

Views

Author

Scott R. Shannon, Apr 05 2023

Keywords

Comments

This sequence is finite: after 130 squares have been visited the square with number 50 is reached after which all eight neighboring squares the knight could move to have already been visited. See the linked image. The largest visited square is a(117) = 247 while the smallest unvisited square is 20.

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(6) = 12 as after the knight moves to the square containing 9 the available unvisited squares are 4, 12, 22, 26, 28, 46, 48. Of these 12, where |12 - 9| = 3, is the closest number to 9. This is the first term to differ from A316667.
		

Crossrefs

A377015 Squares visited by a knight moving on a square-spiral numbered board where the knight moves to a square which has been previously visited the fewest number of times. If two or more such squares exist the smallest numbered square is chosen.

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, 39, 66, 63, 96, 59, 56, 87, 52, 49, 78, 115, 74, 71, 106, 149, 102, 99, 140, 61, 94, 31, 54, 85, 50
Offset: 1

Views

Author

Scott R. Shannon, Nov 09 2024

Keywords

Comments

Unlike similar sequences, e.g. A316667, A362027, A326922, in this variation the knight is never trapped as it can always move to the square which has been previously visited the fewest times, or if two or more surrounding squares exist with the same smallest previous visit count, then it can move to the smallest numbered square of these options.
The first 2016 terms are the same as A316667. In that sequence the path now ends, but here, as the knight is now surrounded by eight squares that have all been visited once, it now chooses the smallest numbered available square, 1733 in this case. This eventually leads it back toward the origin where it revisits the 1 starting square at a(2039). From here it once again chooses the surrounding square with the fewest previous visits, so it begins a new path, but it will avoid the path it previously took back to the origin since those squares will have two previous visits.
The above pattern repeats, causing the knight to go on various excursions of generally increasing length before it revisits the origin - see A377928 for the indices where a(n) = 1. The knight eventually tours paths of increasing complexity, in general moving along distorted loops which are defined by the previous visit count, with straight path lines between these loops. See the attached images.
Interestingly some of the paths between origin visits are identical; for example the path between the 2nd and 3rd visits to the origin is the same as that between the 32nd and 33rd visits. Likewise those between the 5th-6th and 23rd-24th, and 37th-38th and 40th-41st are the same.

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 default starting square.
a(2) = 10 as all eight surrounding available squares, 10, 12, 14, 16, 18, 20, 22, 24 have zero previous visits, so it chooses the smallest number of those, namely 10.
a(3) = 3 as there are seven available squares that have zero previous visits, and of those 3 is the smallest number. Note the 1 square is not considered as that has one previous visit which is more than the other seven squares.
a(2017) = 1733 as all eight surrounding available squares have been visit once, so it chooses the smallest number of those, namely 1733. This is the first term to differ from A316667.
		

Crossrefs

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]]

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

Original entry on oeis.org

1, 10, 3, 8, 5, 2, 7, 4, 9, 22, 19, 16, 33, 58, 13, 28, 25, 46, 21, 40, 17, 6, 23, 20, 39, 70, 43, 76, 47, 26, 11, 14, 29, 32, 15, 62, 37, 18, 35, 38, 63, 34, 59, 30, 53, 12, 31, 54, 85, 124, 51, 80, 83, 52, 49, 24, 77, 48, 119, 50, 27, 86, 55, 128, 89, 92
Offset: 1

Views

Author

Jodi Spitz, Mar 09 2023

Keywords

Comments

Many of these sequences (see cross-references) are finite. I've worked this out by hand, but I suspect this sequence is also finite.
The sequence is finite with 156 terms. - Rémy Sigrist, Mar 12 2023

Examples

			The spiral board begins:
   .---.---.--33--32--31
                       |
  17--16--15--14--13  30
   |               |   |
  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(9) = 9 and a(10) = 22. For a knight on square 9, the smallest unused square which is both coprime to and a knight's move away from 9 is 22.
		

Crossrefs

Programs

  • PARI
    See Links section.

Extensions

Data corrected by Rémy Sigrist, Mar 12 2023

A377928 The indices k where A377015(k) = 1.

Original entry on oeis.org

1, 2039, 2703, 30083, 32155, 32437, 86925, 292101, 339137, 430611, 669371, 670563, 727051, 1161819, 1534325, 1541819, 1543011, 2027935, 2718001, 3266661, 3273829, 3730467, 4805861, 4806143, 5534871, 6371063, 7834735, 8926025, 9293575, 9664815, 12629449, 13645059, 13645723, 16510691, 19947389, 19952425, 22519739, 22520381, 24820941, 26657853, 26658495
Offset: 1

Views

Author

Scott R. Shannon, Nov 11 2024

Keywords

Comments

These are the indices where a knight moving on a square spiral revisits the origin using the path rules given in A377015. 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-19 of 19 results.