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: Johan Westin

Johan Westin's wiki page.

Johan Westin has authored 4 sequences.

A356359 Square array T(m,n) read by antidiagonals: T(m,n) = number of ways a knight can reach (0, 0) from (m, n) on an infinite chessboard while always decreasing its Manhattan distance from the origin, for nonnegative m, n.

Original entry on oeis.org

1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 2, 2, 0, 2, 2, 4, 2, 4, 4, 2, 4, 4, 6, 9, 6, 9, 6, 4, 12, 17, 14, 17, 17, 14, 17, 12, 34, 35, 35, 40, 36, 40, 35, 35, 34, 70, 74, 84, 86, 90, 90, 86, 84, 74, 70, 148, 170, 185, 195, 205, 206, 205, 195, 185, 170, 148
Offset: 0

Author

Johan Westin, Nov 10 2022

Keywords

Comments

The sequence has eight-fold symmetry, since T(m,n) = T(n,m) and T(m,n) = T(|m|, |n|).

Examples

			There are no knight's moves from (0, 1) which decrease the Manhattan distance, so T(0, 1) = 0.
From (1, 3) you can reach the origin by (-1, 2) -> (0, 0) or (2, 1) -> (0, 0), hence T(1, 3) = 2.
From (2, 3) the possible routes are:
  (0, 4) -> (-1, 2) -> (0, 0)
  (0, 4) -> (1, 2) -> (0, 0)
  (3, 1) -> (1, 2) -> (0, 0)
  (3, 1) -> (2, -1) -> (0, 0)
Hence T(2, 3) = 4.
Array begins:
      m=0    1    2     3     4      5      6      7       8       9      10
     +---------------------------------------------------------------------------
  n=0|  1,   0,   0,    0,    2,     4,     4,    12,     34,     70,    148, ...
    1|  0,   0,   1,    2,    2,     6,    17,    35,     74,    170,    389, ...
    2|  0,   1,   0,    4,    9,    14,    35,    84,    185,    412,    929, ...
    3|  0,   2,   4,    6,   17,    40,    86,   195,    445,   1013,   2284, ...
    4|  2,   2,   9,   17,   36,    90,   205,   466,   1058,   2406,   5491, ...
    5|  4,   6,  14,   40,   90,   206,   476,  1097,   2525,   5761,  13140, ...
    6|  4,  17,  35,   86,  205,   476,  1112,  2566,   5914,  13648,  31273, ...
    7| 12,  35,  84,  195,  466,  1097,  2566,  6002,  13884,  32115,  74129, ...
    8| 34,  74, 185,  445, 1058,  2525,  5914, 13884,  32428,  75304, 174436, ...
    9| 70, 170, 412, 1013, 2406,  5761, 13648, 32115,  75304, 176026, 409435, ...
   10|148, 389, 929, 2284, 5491, 13140, 31273, 74129, 174436, 409435, 957106, ...
		

Crossrefs

Programs

  • Python
    from functools import cache # requires Python 3.9
    KNIGHT_MOVES = ((1, 2), (2, 1), (-1, 2), (-2, 1),
                    (1, -2), (2, -1), (-1, -2), (-2, -1))
    def manhattan(x, y):
        return abs(x) + abs(y)
    @cache
    def A356359(m, n):
        if (m, n) == (0, 0):
            return 1
        value = 0
        for move in KNIGHT_MOVES:
            new_m, new_n = m + move[0], n + move[1]
            if manhattan(new_m, new_n) < manhattan(m, n):
                value += A356359(new_m, new_n)
        return value

Formula

T(m, n) = T(m-2, n+1) + T(m-2, n-1) + T(m-1, n-2) + T(m+1, n-2) for m, n >= 2.
T(1, n) = T(-1, n-1) + T(0, n-2) + T(2, n-2).
T(0, n) = 2*T(1, n-2).

A346163 Numbers k such that there exist equal sums of k and 2k consecutive positive squares.

Original entry on oeis.org

1, 17, 23, 25, 49, 55, 71, 73, 79, 89, 95, 103, 113, 127, 143, 161, 167, 175, 185, 191, 193, 199, 215, 217, 233, 239, 241, 265, 271, 287, 289, 305, 361, 377, 391, 409, 415, 431, 433, 457, 473, 481, 505, 511, 521, 535, 545, 553, 569, 593, 599, 617, 631, 647
Offset: 1

Author

Johan Westin, Jul 08 2021

Keywords

Comments

a(n) is congruent to 1 or 5 (mod 6).
a(n) is not congruent to 3, 4 or 5 (mod 8) or to 7, 11, 16 or 20 (mod 27), see Alder and Alfred.
k is in the sequence if the quadratic Diophantine equation 6*(k*x^2 - 2*k*y^2 + k*(k-1)*x + 2*k*(1-2*k)*y) - 14*k^3 + 9*k^2 - k = 0 has solutions x, y in the positive integers.

Examples

			a(1): 5^2 = 3^2 + 4^2. Here the left-hand side has k = 1 term, and the right-hand side has 2k = 2 terms. Hence k = 1 is in the sequence.
a(2): 29^2 + 30^2 + ... + 44^2 + 45^2 = 8^2 + 9^2 + ... + 40^2 + 41^2 = 23681. Here the left and right sums have k = 17 and 2k = 34 terms, respectively. Hence k = 17 is in the sequence.
		

Crossrefs

Programs

  • Python
    import sympy # Version 1.8
    xx, yy = sympy.symbols("x y")
    def pyramidal(n):
        return n*(n+1)*(2*n+1)/6 # A000330(n)
    def expanded_diophantine(k,n):
        left_hand_side =  pyramidal(xx+n-1) - pyramidal(xx-1)
        right_hand_side =  pyramidal(yy+n+k-1) - pyramidal(yy-1)
        return sympy.expand(right_hand_side-left_hand_side)
    def has_solutions(k,n):
        return len(sympy.solvers.diophantine(expanded_diophantine(k,n))) != 0
    def k_in_a346163(k):
        return has_solutions(k,k)

A343962 Number of self-avoiding walks that escape an n X n square lattice starting at a given corner.

Original entry on oeis.org

4, 14, 106, 2142, 124150, 21231450, 10794801654, 16397345136778, 74754715306888786, 1026191624073867290710, 42506394853041064742716162, 5320474615969510569494723118086, 2014671515857822813610223858063766522
Offset: 1

Author

Johan Westin, May 05 2021

Keywords

Comments

A self-avoiding walk on a square lattice allows horizontal and vertical movement one step at a time, where no space is visited more than once.
The n X n square can be seen as a subset of a larger lattice which surrounds it. Visiting any space on this larger lattice that is not part of the square constitutes escaping the square.
There are two ways to escape the square while standing at a corner, and both are counted separately.
a(n) is always even due to symmetry along a diagonal.

Examples

			For n=1, every direction will immediately result in escaping the board, so a(1) = 4.
For n=2, there are two ways to escape from the starting corner. Otherwise, any of the three remaining corners can be escaped from in two ways, and each corner can be reached from two different directions (clockwise and counterclockwise). Therefore a(2) = 2 + 3*2*2 = 14.
		

Crossrefs

Cf. A341269.

Extensions

a(7)-a(13) from Andrew Howroyd, May 05 2021

A255011 Number of polygons formed by connecting all the 4n points on the perimeter of an n X n square by straight lines; a(0) = 0 by convention.

Original entry on oeis.org

0, 4, 56, 340, 1120, 3264, 6264, 13968, 22904, 38748, 58256, 95656, 120960, 192636, 246824, 323560, 425408, 587964, 682296, 932996, 1061232, 1327524, 1634488, 2049704, 2227672, 2806036, 3275800, 3810088, 4307520, 5298768, 5577096, 6958848, 7586496, 8672520, 9901352
Offset: 0

Author

Johan Westin, Feb 12 2015

Keywords

Comments

There are n+1 points on each side of the square, but that counts the four corners twice, so there are a total of 4n points on the perimeter. - N. J. A. Sloane, Jan 23 2020
a(n) is always divisible by 4, by symmetry. If n is odd, a(n) is divisible by 8.
From Michael De Vlieger, Feb 19-20 2015: (Start)
For n > 0, the vertices of the bounding square generate diametrical bisectors that cross at the center. Thus each diagram has fourfold symmetry.
For n > 0, an orthogonal n X n grid is produced by corresponding horizontal and vertical points on opposite sides.
Terms {1, 3, 9} are not congruent to 0 (mod 8).
Number of edges: {0, 8, 92, 596, 1936, 6020, 11088, 26260, 42144, 72296, 107832, ...}. See A331448. (End)

Examples

			For n = 3, the perimeter of the square contains 12 points:
  * * * *
  *     *
  *     *
  * * * *
Connect each point to every other point with a straight line inside the square. Then count the polygons (or regions) that have formed. There are 340 polygons, so a(3) = 340.
For n = 1, the full picture is:
  *-*
  |X|
  *-*
The lines form four triangular regions, so a(1) = 4.
For n = 0, the square can be regarded as consisting of a single point, producing no lines or polygons, and so a(0) = 0.
		

Crossrefs

Cf. A092098 (triangular analog), A331448 (edges), A331449 (points), A334699 (k-gons).
For the circular analog see A006533, A007678.

Formula

No formula is presently known. - N. J. A. Sloane, Feb 04 2020

Extensions

a(11)-a(29) from Hiroaki Yamanouchi, Feb 23 2015
Offset changed by N. J. A. Sloane, Jan 23 2020