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.

User: Andrew Smith

Andrew Smith's wiki page.

Andrew Smith has authored 10 sequences.

A352731 On a diagonally numbered square grid, with labels starting at 1, this is the number of the last cell that a (1,n) leaper reaches before getting trapped when moving to the lowest available unvisited square, or -1 if it never gets trapped.

Original entry on oeis.org

-1, 1378, -1, 595, 66, 36, 153, 758, 1185, 78, 1732, 171, 2510, 2094, 1407, 253, 630, 210, 780, 2385, 1326, 300, 1225, 990, 2800, 406, 3267, 4333, 4124, 528, 4309, 741, 5951, 666, 2701, 903, 30418, 820, 3321, 1081, 4186, 990, 8299, 2775, 4560, 1176, 4753, 39951, 5778
Offset: 1

Author

Andrew Smith, Mar 30 2022

Keywords

Comments

A (1,2) leaper is a chess knight. (1,1) and (1,3) leapers both never get trapped. This is understandable for the (1,1) leaper but not so much for the (1,3) which does get trapped on the spirally numbered board (see A323471). Once the (1,3) leaper reaches 39 it then performs the same set of 4 moves repeatedly, meaning that it never gets trapped.

Crossrefs

Programs

  • Python
    # reformatted by R. J. Mathar, 2023-03-29
    class A352731():
        def _init_(self,n) :
            self.n = n
            self.KM=[(n, 1), (1, n), (-1, n), (-n, 1), (-n, -1), (-1, -n), (1, -n), (n, -1)]
        @staticmethod
        def _idx(loc):
            i, j = loc
            return (i+j-1)*(i+j-2)//2 + j
        def _next_move(self,loc, visited):
            i, j = loc
            moves = [(i+io, j+jo) for io, jo in self.KM if i+io>0 and j+jo>0]
            available = [m for m in moves if m not in visited]
            return min(available, default=None, key=lambda x: A352731._idx(x))
        def _aseq(self):
            locs = [[], []]
            loc, s, turn, alst = [(1, 1), (1, 1)], {(1, 1)}, 0, [1]
            m = self._next_move(loc[turn], s)
            while m != None:
                loc[turn], s, turn, alst = m, s|{m}, 0 , alst + [A352731._idx(m)]
                locs[turn] += [loc[turn]]
                m = self._next_move(loc[turn], s)
                if len(s)%100000 == 0:
                    print(self.n,'{steps} moves in'.format(steps = len(s)))
            return alst
        def at(self,n) :
            if n == 1 or n == 3:
                return -1
            else:
                return self._aseq()[-1]
    for n in range(1,40):
        a352731 = A352731(n)
        print(a352731.at(n))

A352730 On a diagonally numbered square grid, with labels starting at 1, this is the number of steps that a (1,n) leaper makes before getting trapped when moving to the lowest available unvisited square, or -1 if it never gets trapped.

Original entry on oeis.org

-1, 2402, -1, 1552, 287, 388, 417, 1593, 639, 1136, 1785, 3090, 2299, 2341, 1833, 4052, 2237, 3012, 3069, 6843, 5543, 3000, 5161, 11722, 6895, 3578, 8047, 19739, 9671, 4156, 8391, 21424, 15129, 4734, 8609, 32690, 19895, 5312, 10019, 42710, 21195, 5890, 12309, 53764, 34489, 6468, 19527, 55911, 23475
Offset: 1

Author

Andrew Smith, Mar 30 2022

Keywords

Comments

A (1,2) leaper is a chess knight. (1,1) and (1,3) leapers both never get trapped. This is understandable for the (1,1) leaper but not so much for the (1,3) which does get trapped on the spirally numbered board (see A323469). Once the (1,3) leaper reaches 39 it then performs the same set of 4 moves repeatedly, meaning that it never gets trapped.

Crossrefs

Programs

  • Python
    n = 2
    KM = [(n, 1), (1, n), (-1, n), (-n, 1), (-n, -1), (-1, -n), (1, -n), (n, -1)]
    def idx(loc):
        i, j = loc
        return (i + j - 1) * (i + j - 2) // 2 + j
    def next_move(loc, visited):
        i, j = loc
        moves = [(i + io, j + jo) for io, jo in KM if i + io > 0 and j + jo > 0]
        available = [m for m in moves if m not in visited]
        return min(available, default=None, key=lambda x: idx(x))
    def aseq():
        locs = [[], []]
        loc, s, turn, alst = [(1, 1), (1, 1)], {(1, 1)}, 0, [1]
        m = next_move(loc[turn], s)
        while m != None:
            loc[turn], s, turn, alst = m, s | {m}, 0, alst + [idx(m)]
            locs[turn] += [loc[turn]]
            m = next_move(loc[turn], s)
            if len(s) % 10000 == 0:
                print('{steps} moves in'.format(steps = len(s)))
        return alst
    print(aseq())

A342948 Squares visited by either knight when a white knight and a black knight are moving on a diagonally numbered board, always to the lowest available unvisited square; white moves first.

Original entry on oeis.org

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

Author

Andrew Smith, Mar 30 2021

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 .
.
Both knights start on square 1, white moves to the lowest unvisited square (8), black then moves to the lowest unvisited square (9) and so on...
This sequence is finite, on the 583rd move or the white knight's 292nd step, square 406 is visited, after which black wins and the game is over.

Crossrefs

Programs

  • Python
    KM=[(2, 1), (1, 2), (-1, 2), (-2, 1), (-2, -1), (-1, -2), (1, -2), (2, -1)]
    def idx(loc): i, j = loc; return (i+j-1)*(i+j-2)//2 + j
    def next_move(loc, visited):
      i, j = loc; moves = [(i+io, j+jo) for io, jo in KM if i+io>0 and j+jo>0]
      available = [m for m in moves if m not in visited]
      return min(available, default=None, key=lambda x: idx(x))
    def aseq():
      loc, s, turn, alst = [(1, 1), (1, 1)], {(1, 1)}, 0, [1]
      m = next_move(loc[turn], s)
      while m != None:
        loc[turn], s, turn, alst = m, s|{m}, 1 - turn, alst + [idx(m)]
        m = next_move(loc[turn], s)
      return alst
    A342948_lst = aseq() # Michael S. Branicky, Mar 30 2021

A342947 Squares visited by the black knight when a white knight and a black knight are moving on a diagonally numbered board, always to the lowest available unvisited square; white moves first.

Original entry on oeis.org

1, 9, 4, 3, 13, 7, 5, 10, 26, 18, 11, 30, 37, 48, 22, 31, 38, 46, 58, 49, 41, 52, 27, 33, 40, 51, 60, 70, 57, 67, 81, 93, 106, 123, 79, 68, 82, 71, 61, 74, 64, 36, 65, 78, 118, 77, 88, 100, 85, 97, 110, 124, 139, 155, 172, 193, 138, 154, 212, 232, 256, 191, 213
Offset: 1

Author

Andrew Smith, Mar 30 2021

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 .
.
Both knights start on square 1, white moves to the lowest unvisited square (8), black then moves to the lowest unvisited square (9) and so on...
This sequence is finite, on the black knight's 5503rd step, square 3828 is visited, after which there are no unvisited squares within one knight move.

Crossrefs

Programs

A342946 Squares visited by the white knight when a white knight and a black knight are moving on a diagonally numbered board, always to the lowest available unvisited square; white moves first.

Original entry on oeis.org

1, 8, 6, 2, 12, 16, 24, 19, 15, 34, 14, 21, 43, 20, 25, 17, 39, 29, 23, 32, 42, 35, 45, 53, 28, 54, 63, 73, 84, 50, 59, 47, 56, 69, 80, 92, 108, 95, 83, 72, 62, 75, 44, 55, 89, 101, 86, 98, 111, 125, 140, 94, 107, 121, 173, 156, 137, 122, 174, 157, 141, 126
Offset: 1

Author

Andrew Smith, Mar 30 2021

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 .
.
Both knights start on square 1, white moves to the lowest unvisited square (8), black then moves to the lowest unvisited square (9) and so on...
This sequence is finite, on the white knight's 292nd step, square 406 is visited, after which there are no unvisited squares within one knight move.

Crossrefs

Programs

A338290 Squares visited by either knight when a white knight and a black knight are moving on a spirally numbered board, always to the lowest available unvisited square; white moves first.

Original entry on oeis.org

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

Author

Andrew Smith, Oct 20 2020

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
Both knights start on square 1, white moves to the lowest unvisited square (10), black then moves to the lowest unvisited square (12) and so on...
This sequence is finite, on the 3758th move or the black knight's 1879th step, square 4242 is visited, after which white wins and the game is over.
The sequences generated by 4 knights and 8 knights also produce new sequences not yet in the OEIS.

Crossrefs

A338289 Squares visited by the black knight when a white knight and a black knight are moving on a spirally numbered board, always to the lowest available unvisited square; white moves first.

Original entry on oeis.org

1, 12, 9, 4, 7, 18, 35, 14, 29, 32, 55, 28, 13, 34, 17, 40, 21, 46, 25, 50, 79, 26, 47, 76, 43, 70, 105, 148, 65, 98, 37, 62, 33, 30, 53, 84, 49, 52, 87, 56, 59, 92, 89, 58, 91, 130, 57, 88, 127, 174, 229, 122, 167, 82, 119, 78, 115, 160, 75, 72, 107, 150, 201, 104, 147, 144, 193, 140, 95, 136, 185, 132, 135, 184, 181
Offset: 1

Author

Andrew Smith, Oct 20 2020

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
Both knights start on square 1, white moves to the lowest unvisited square (10), black then moves to the lowest unvisited square (12) and so on...
This sequence is finite, on the black knight's 1879th step, square 4242 is visited, after which there are no unvisited squares within one knight move.
The sequences generated by 4 knights and 8 knights also produce new sequences not yet in the OEIS.

Crossrefs

A338288 Squares visited by the white knight when a white knight and a black knight are moving on a spirally numbered board, always to the lowest available unvisited square; white moves first.

Original entry on oeis.org

1, 10, 3, 6, 15, 2, 5, 8, 11, 24, 27, 48, 23, 20, 39, 16, 19, 22, 41, 44, 71, 74, 45, 42, 69, 38, 6, 66, 99, 36, 61, 94, 31, 54, 85, 124, 51, 80, 83, 120, 123, 168, 81, 118, 77, 114, 73, 108, 151, 68, 103, 64, 67, 102, 143, 146, 195, 100, 141, 96, 137, 60, 93, 90, 129, 86, 125, 172, 121, 166, 117, 162, 113, 110, 153
Offset: 1

Author

Andrew Smith, Oct 20 2020

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
Both knights start on square 1, white moves to the lowest unvisited square (10), black then moves to the lowest unvisited square (12) and so on...
This sequence is finite, on the white knight's 3999th step, square 3606 is visited, after which there are no unvisited squares within one knight move.
The sequences generated by 4 knights and 8 knights also produce new sequences not yet in the OEIS.

Crossrefs

A333637 The number of cells which contain multiple squares of a Genealodron formed from 2^n - 1 equal-sized squares (when viewed from above).

Original entry on oeis.org

0, 0, 0, 2, 7, 15, 27, 41, 57, 75, 95, 117, 141, 167, 195, 225, 257, 291, 327, 365, 405, 447, 491, 537, 585, 635, 687, 741, 797, 855, 915, 977, 1041, 1107, 1175, 1245, 1317, 1391, 1467, 1545, 1625, 1707, 1791, 1877, 1965, 2055, 2147, 2241, 2337, 2435, 2535, 2637, 2741, 2847, 2955, 3065, 3177, 3291, 3407, 3525
Offset: 1

Author

Andrew Smith, Mar 30 2020

Keywords

Comments

See A179178 for the definition of a Genealodron. In this variation, a Genealodron is a rooted binary tree constructed from squares. One edge of each square is attached to its parent and the two adjacent edges to its child trees.
The first Genealodron consists of one square.
The second Genealodron is formed by joining another equal-sized square to the left edge and to the right edge of the first so that the second Genealodron is made up of three squares.
The third Genealodron is formed by joining squares to the upper and lower edges of both the second and third square of the second Genealodron so that the third Genealodron is made up of seven squares.
This continues, with the edges to which the new squares are attached alternating between left/right and upper/lower.
From the fourth generation onwards, some squares will overlap. a(n) is the number of cells which contain overlapping squares.

Crossrefs

Formula

Conjecture: for n>=6, a(n) = n^2 - n - 15. - Vaclav Kotesovec, Apr 07 2020
Conjectures from Colin Barker, Apr 07 2020: (Start)
G.f.: x^4*(1 + x^2)*(2 + x - 2*x^2) / (1 - x)^3.
a(n) = 3*a(n-1) - 3*a(n-2) + a(n-3) for n>8.
(End)

A297103 The number of equal-sized squares in the highest stack of squares contained in successive Genealodrons formed from 2^n - 1 equal-sized squares.

Original entry on oeis.org

1, 1, 1, 2, 5, 7, 10, 20, 41, 67, 110, 220, 441, 767, 1335, 2670, 5341, 9587, 17211, 34422, 68845, 126011, 230655, 461310, 922621, 1711595, 3175311, 6350622, 12701245, 23796515, 44584536, 89169072, 178338145
Offset: 1

Author

Andrew Smith, Dec 25 2017

Keywords

Comments

The first Genealodron consists of one square.
The second Genealodron is formed by joining another equal-sized square to the left edge and to the right edge of the first so that the second Genealodron is made up of three squares.
The third Genealodron is formed by joining squares to the upper and lower edges of both the second and third square of the second Genealodron so that the third Genealodron is made up of seven squares.
The fourth Genealodron is formed by joining squares to the left and right edges of the fourth, fifth, sixth and seventh squares of the third Genealodron so that the fourth Genealodron has fifteen squares. The fourth Genealodron has the first overlaps, so although it contains 15 squares only 13 are seen when it is viewed from above.
The fifth Genealodron is formed by adding 16 more squares to the upper and lower edges of the last eight squares added to the fourth Genealodron so the fifth Genealodron has 31 squares, only 21 of which are seen when it is viewed from above because of the increasing number of overlaps.
The sixth Genealodron is formed by adding 32 more squares to the left and right edge of the last 16 squares added to the fifth Genealodron. So the sixth Genealodron has 63 squares only 31 of which are visible.
This continues, and the edges on which the new squares are added keep alternating between left and right and then upper and lower.
Gradually within the Genealodron, spirals are building counterclockwise and clockwise. The sequence that the Genealodron built with squares generates is different from the one built with equilateral triangles, because when a square is added, the spiral then turns through 90 degrees rather than just 60 degrees.

Crossrefs

Programs

  • MATLAB
    %I solved the problem by representing each Genealodron as a matrix
    n=input('how many terms?');
    %preallocation of length of output (length n)
    vec=zeros(1,n);
    %below I initialize the first 3 terms which are easily done with pen and paper
    vec(1)=1;
    vec(2)=1;
    vec(3)=1;
    %imat is the intermediate matrix to go from 3rd to 4th matrix.
    imat=[1,0,1;0,0,0;1,0,1];
    %mat is the 3rd matrix
    mat=[1,0,1;1,1,1;1,0,1];
    %loop
    for i=4:n
        %when i is even
        if mod(i,2)==0
            imat2=[zeros(i-1,2),imat];
            imat3=[imat,zeros(i-1,2)];
            %superposing two variations of previous intermediate matrix to get next one
            imat=imat2+imat3;
            %making mat same size as imat
            mat=[zeros(i-1,1),mat,zeros(i-1,1)];
            %calculating new matrix (=old matrix+intermediate)
            mat=mat+imat;
        %similarly when i is odd
        else
           imat2=[zeros(2,i);imat];
           imat3=[imat;zeros(2,i)];
           imat=imat2+imat3;
           mat=[zeros(1,i);mat;zeros(1,i)];
           mat=mat+imat;
        end
        %working out the maximum value of new matrix and allocating it to a position in the output vector
        vec(i)=max(max(mat));
    end
    format long g
    disp(vec)