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.

A375925 Squares visited by a king moving on a walled, spirally numbered board, where a wall must be jumped on each move, always to the lowest available unvisited square.

Original entry on oeis.org

1, 4, 14, 3, 11, 2, 8, 22, 7, 19, 5, 15, 33, 13, 29, 12, 28, 10, 24, 9, 23, 45, 21, 41, 20, 6, 18, 38, 17, 35, 16, 34, 60, 32, 58, 31, 55, 30, 54, 86, 52, 26, 48, 25, 47, 77, 46, 76, 44, 74, 43, 71, 42, 70, 40, 68, 39, 67, 37, 63, 36, 62, 96, 61, 95, 59, 93
Offset: 1

Views

Author

Sameer Khan, Sep 03 2024

Keywords

Comments

The board is numbered with the following walled, 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
.
The walls mark the boundary of the spiral.
A line drawn from the center of the starting square of a king move to the center of the ending square must pass through a wall. The king jumps over that wall. Some moves would just touch a wall without passing through the wall (e.g. 1 to 3). Such moves are not permissible.
The rules imply that the king cannot move from a square labeled k in the spiral to a square labeled k +- 1 or k +- 2.
Comment from M. F. Hasler, May 08 2025 (Start)
The sequence appears to be a permutation of the positive integers. The path drawn by Kevin Ryde shows the quasi-periodic structure of the trajectory and may lead to a formal proof.
However, it would be more natural to start the path at the origin, at a square labeled n = 0 (to which the king never moves). Then the sequence would conjecurally be a permutation of the nonnegative integers. This also leads to a more natural numbering for the squares in terms of the x,y coordinates - compare the Python function "square_number()". See A383185. (End) [Comment edited by N. J. A. Sloane, May 14 2025 following discussion with Kevin Ryde.]

Examples

			For n = 2, a(2) = 4 because moving to 2 or 3 does not pass through a wall.
		

Crossrefs

Cf. A033638, A316667 (trapped knight), A336038 (trapped king).
Cf. A383185 (zero-indexed variant), A316328 (knight's path).

Programs

  • Python
    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 A375925(n):
        if not hasattr(A:=A375925, 'terms'): A.terms=[1]; A.pos=0
        while len(A.terms) < n:
            s,d = min((s,d) for d in (1, 1+1j, 1j, 1j-1, -1, -1-1j, -1j, 1-1j) if
                abs((s:=1+square_number(A.pos+d))-A.terms[-1]) > 2 and s not in A.terms)
            A.terms.append(s); A.pos += d
        return A.terms[n-1] # M. F. Hasler, May 07 2025

Formula

a(n) = A383185(n-1)+1. - M. F. Hasler, May 12 2025

Extensions

Entry revised by N. J. A. Sloane, May 12 2025