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-10 of 94 results. Next

A316337 Numbers missing from A316667.

Original entry on oeis.org

961, 962, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1219, 1220, 1221, 1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231, 1360, 1361, 1362, 1363, 1364, 1365, 1366, 1367, 1368, 1369, 1370, 1371, 1372, 1373, 1374, 1375, 1377, 1443, 1444, 1445, 1446, 1447, 1509, 1510, 1511, 1512, 1513, 1514, 1515
Offset: 1

Views

Author

N. J. A. Sloane, Jul 14 2018

Keywords

Comments

A316667 is finite, so this sequence is infinite.
See A316667 for further information.

Crossrefs

A002061 Central polygonal numbers: a(n) = n^2 - n + 1.

Original entry on oeis.org

1, 1, 3, 7, 13, 21, 31, 43, 57, 73, 91, 111, 133, 157, 183, 211, 241, 273, 307, 343, 381, 421, 463, 507, 553, 601, 651, 703, 757, 813, 871, 931, 993, 1057, 1123, 1191, 1261, 1333, 1407, 1483, 1561, 1641, 1723, 1807, 1893, 1981, 2071, 2163, 2257, 2353, 2451, 2551, 2653
Offset: 0

Views

Author

Keywords

Comments

These are Hogben's central polygonal numbers denoted by the symbol
...2....
....P...
...2.n..
(P with three attachments).
Also the maximal number of 1's that an n X n invertible {0,1} matrix can have. (See Halmos for proof.) - Felix Goldberg (felixg(AT)tx.technion.ac.il), Jul 07 2001
Maximal number of interior regions formed by n intersecting circles, for n >= 1. - Amarnath Murthy, Jul 07 2001
The terms are the smallest of n consecutive odd numbers whose sum is n^3: 1, 3 + 5 = 8 = 2^3, 7 + 9 + 11 = 27 = 3^3, etc. - Amarnath Murthy, May 19 2001
(n*a(n+1)+1)/(n^2+1) is the smallest integer of the form (n*k+1)/(n^2+1). - Benoit Cloitre, May 02 2002
For n >= 3, a(n) is also the number of cycles in the wheel graph W(n) of order n. - Sharon Sela (sharonsela(AT)hotmail.com), May 17 2002
Let b(k) be defined as follows: b(1) = 1 and b(k+1) > b(k) is the smallest integer such that Sum_{i=b(k)..b(k+1)} 1/sqrt(i) > 2; then b(n) = a(n) for n > 0. - Benoit Cloitre, Aug 23 2002
Drop the first three terms. Then n*a(n) + 1 = (n+1)^3. E.g., 7*1 + 1 = 8 = 2^3, 13*2 + 1 = 27 = 3^3, 21*3 + 1 = 64 = 4^3, etc. - Amarnath Murthy, Oct 20 2002
Arithmetic mean of next 2n - 1 numbers. - Amarnath Murthy, Feb 16 2004
The n-th term of an arithmetic progression with first term 1 and common difference n: a(1) = 1 -> 1, 2, 3, 4, 5, ...; a(2) = 3 -> 1, 3, ...; a(3) = 7 -> 1, 4, 7, ...; a(4) = 13 -> 1, 5, 9, 13, ... - Amarnath Murthy, Mar 25 2004
Number of walks of length 3 between any two distinct vertices of the complete graph K_{n+1} (n >= 1). Example: a(2) = 3 because in the complete graph ABC we have the following walks of length 3 between A and B: ABAB, ACAB and ABCB. - Emeric Deutsch, Apr 01 2004
Narayana transform of [1, 2, 0, 0, 0, ...] = [1, 3, 7, 13, 21, ...]. Let M = the infinite lower triangular matrix of A001263 and let V = the Vector [1, 2, 0, 0, 0, ...]. Then A002061 starting (1, 3, 7, ...) = M * V. - Gary W. Adamson, Apr 25 2006
The sequence 3, 7, 13, 21, 31, 43, 57, 73, 91, 111, ... is the trajectory of 3 under repeated application of the map n -> n + 2 * square excess of n, cf. A094765.
Also n^3 mod (n^2+1). - Zak Seidov, Aug 31 2006
Also, omitting the first 1, the main diagonal of A081344. - Zak Seidov, Oct 05 2006
Ignoring the first ones, these are rectangular parallelepipeds with integer dimensions that have integer interior diagonals. Using Pythagoras: sqrt(a^2 + b^2 + c^2) = d, an integer; then this sequence: sqrt(n^2 + (n+1)^2 + (n(n+1))^2) = 2T_n + 1 is the first and most simple example. Problem: Are there any integer diagonals which do not satisfy the following general formula? sqrt((k*n)^2 + (k*(n+(2*m+1)))^2 + (k*(n*(n+(2*m+1)) + 4*T_m))^2) = k*d where m >= 0, k >= 1, and T is a triangular number. - Marco Matosic, Nov 10 2006
Numbers n such that a(n) is prime are listed in A055494. Prime a(n) are listed in A002383. All terms are odd. Prime factors of a(n) are listed in A007645. 3 divides a(3*k-1), 7 divides a(7*k-4) and a(7*k-2), 7^2 divides a(7^2*k-18) and a(7^2*k+19), 7^3 divides a(7^3*k-18) and a(7^3*k+19), 7^4 divides a(7^4*k+1048) and a(7^4*k-1047), 7^5 divides a(7^5*k+1354) and a(7^5*k-1353), 13 divides a(13*k-9) and a(13*k-3), 13^2 divides a(13^2*k+23) and a(13^2*k-22), 13^3 divides a(13^3*k+1037) and a(13^3*k-1036). - Alexander Adamchuk, Jan 25 2007
Complement of A135668. - Kieren MacMillan, Dec 16 2007
From William A. Tedeschi, Feb 29 2008: (Start)
Numbers (sorted) on the main diagonal of a 2n X 2n spiral. For example, when n=2:
.
7---8---9--10
| |
6 1---2 11
| | |
5---4---3 12
|
16--15--14--13
.
Cf. A137928. (End)
a(n) = AlexanderPolynomial[n] defined as Det[Transpose[S]-n S] where S is Seifert matrix {{-1, 1}, {0, -1}}. - Artur Jasinski, Mar 31 2008
Starting (1, 3, 7, 13, 21, ...) = binomial transform of [1, 2, 2, 0, 0, 0]; example: a(4) = 13 = (1, 3, 3, 1) dot (1, 2, 2, 0) = (1 + 6 + 6 + 0). - Gary W. Adamson, May 10 2008
Starting (1, 3, 7, 13, ...) = triangle A158821 * [1, 2, 3, ...]. - Gary W. Adamson, Mar 28 2009
Starting with offset 1 = triangle A128229 * [1,2,3,...]. - Gary W. Adamson, Mar 26 2009
a(n) = k such that floor((1/2)*(1 + sqrt(4*k-3))) + k = (n^2+1), that is A000037(a(n)) = A002522(n) = n^2 + 1, for n >= 1. - Jaroslav Krizek, Jun 21 2009
For n > 0: a(n) = A170950(A002522(n-1)), A170950(a(n)) = A174114(n), A170949(a(n)) = A002522(n-1). - Reinhard Zumkeller, Mar 08 2010
From Emeric Deutsch, Sep 23 2010: (Start)
a(n) is also the Wiener index of the fan graph F(n). The fan graph F(n) is defined as the graph obtained by joining each node of an n-node path graph with an additional node. The Wiener index of a connected graph is the sum of the distances between all unordered pairs of vertices in the graph. The Wiener polynomial of the graph F(n) is (1/2)t[(n-1)(n-2)t + 2(2n-1)]. Example: a(2)=3 because the corresponding fan graph is a cycle on 3 nodes (a triangle), having distances 1, 1, and 1.
(End)
For all elements k = n^2 - n + 1 of the sequence, sqrt(4*(k-1)+1) is an integer because 4*(k-1) + 1 = (2*n-1)^2 is a perfect square. Building the intersection of this sequence with A000225, k may in addition be of the form k = 2^x - 1, which happens only for k = 1, 3, 7, 31, and 8191. [Proof: Still 4*(k-1)+1 = 2^(x+2) - 7 must be a perfect square, which has the finite number of solutions provided by A060728: x = 1, 2, 3, 5, or 13.] In other words, the sequence A038198 defines all elements of the form 2^x - 1 in this sequence. For example k = 31 = 6*6 - 6 + 1; sqrt((31-1)*4+1) = sqrt(121) = 11 = A038198(4). - Alzhekeyev Ascar M, Jun 01 2011
a(n) such that A002522(n-1) * A002522(n) = A002522(a(n)) where A002522(n) = n^2 + 1. - Michel Lagneau, Feb 10 2012
Left edge of the triangle in A214661: a(n) = A214661(n, 1), for n > 0. - Reinhard Zumkeller, Jul 25 2012
a(n) = A215630(n, 1), for n > 0; a(n) = A215631(n-1, 1), for n > 1. - Reinhard Zumkeller, Nov 11 2012
Sum_{n > 0} arccot(a(n)) = Pi/2. - Franz Vrabec, Dec 02 2012
If you draw a triangle with one side of unit length and one side of length n, with an angle of Pi/3 radians between them, then the length of the third side of the triangle will be the square root of a(n). - Elliott Line, Jan 24 2013
a(n+1) is the number j such that j^2 = j + m + sqrt(j*m), with corresponding number m given by A100019(n). Also: sqrt(j*m) = A027444(n) = n * a(n+1). - Richard R. Forberg, Sep 03 2013
Let p(x) the interpolating polynomial of degree n-1 passing through the n points (n,n) and (1,1), (2,1), ..., (n-1,1). Then p(n+1) = a(n). - Giovanni Resta, Feb 09 2014
The number of square roots >= sqrt(n) and < n+1 (n >= 0) gives essentially the same sequence, 1, 3, 7, 13, 21, 31, 43, 57, 73, 91, 111, 133, 157, 183, 211, ... . - Michael G. Kaarhus, May 21 2014
For n > 1: a(n) is the maximum total number of queens that can coexist without attacking each other on an [n+1] X [n+1] chessboard. Specifically, this will be a lone queen of one color placed in any position on the perimeter of the board, facing an opponent's "army" of size a(n)-1 == A002378(n-1). - Bob Selcoe, Feb 07 2015
a(n+1) is, for n >= 1, the number of points as well as the number of lines of a finite projective plane of order n (cf. Hughes and Piper, 1973, Theorem 3.5., pp. 79-80). For n = 3, a(4) = 13, see the 'Finite example' in the Wikipedia link, section 2.3, for the point-line matrix. - Wolfdieter Lang, Nov 20 2015
Denominators of the solution to the generalization of the Feynman triangle problem. If each vertex of a triangle is joined to the point (1/p) along the opposite side (measured say clockwise), then the area of the inner triangle formed by these lines is equal to (p - 2)^2/(p^2 - p + 1) times the area of the original triangle, p > 2. For example, when p = 3, the ratio of the areas is 1/7. The numerators of the ratio of the areas is given by A000290 with an offset of 2. [Cook & Wood, 2004.] - Joe Marasco, Feb 20 2017
n^2 equal triangular tiles with side lengths 1 X 1 X 1 may be put together to form an n X n X n triangle. For n>=2 a(n-1) is the number of different 2 X 2 X 2 triangles being contained. - Heinrich Ludwig, Mar 13 2017
For n >= 0, the continued fraction [n, n+1, n+2] = (n^3 + 3n^2 + 4n + 2)/(n^2 + 3n + 3) = A034262(n+1)/a(n+2) = n + (n+2)/a(n+2); e.g., [2, 3, 4] = A034262(3)/a(4) = 30/13 = 2 + 4/13. - Rick L. Shepherd, Apr 06 2017
Starting with b(1) = 1 and not allowing the digit 0, let b(n) = smallest nonnegative integer not yet in the sequence such that the last digit of b(n-1) plus the first digit of b(n) is equal to k for k = 1, ..., 9. This defines 9 finite sequences, each of length equal to a(k), k = 1, ..., 9. (See A289283-A289287 for the cases k = 5..9.) For k = 10, the sequence is infinite (A289288). For example, for k = 4, b(n) = 1,3,11,31,32,2,21,33,12,22,23,13,14. These terms can be ordered in the following array of size k*(k-1)+1:
1 2 3
21 22 23
31 32 33
11 12 13 14
.
The sequence ends with the term 1k, which lies outside the rectangular array and gives the term +1 (see link).- Enrique Navarrete, Jul 02 2017
The central polygonal numbers are the delimiters (in parenthesis below) when you write the natural numbers in groups of odd size 2*n+1 starting with the group {2} of size 1: (1) 2 (3) 4,5,6 (7) 8,9,10,11,12 (13) 14,15,16,17,18,19,20 (21) 22,23,24,25,26,27,28,29,30 (31) 32,33,34,35,36,37,38,39,40,41,42 (43) ... - Enrique Navarrete, Jul 11 2017
Also the number of (non-null) connected induced subgraphs in the n-cycle graph. - Eric W. Weisstein, Aug 09 2017
Since (n+1)^2 - (n+1) + 1 = n^2 + n + 1 then from 7 onwards these are also exactly the numbers that are represented as 111 in all number bases: 111(2)=7, 111(3)=13, ... - Ron Knott, Nov 14 2017
Number of binary 2 X (n-1) matrices such that each row and column has at most one 1. - Dmitry Kamenetsky, Jan 20 2018
Observed to be the squares visited by bishop moves on a spirally numbered board and moving to the lowest available unvisited square at each step, beginning at the second term (cf. A316667). It should be noted that the bishop will only travel to squares along the first diagonal of the spiral. - Benjamin Knight, Jan 30 2019
From Ed Pegg Jr, May 16 2019: (Start)
Bound for n-subset coverings. Values in A138077 covered by difference sets.
C(7,3,2), {1,2,4}
C(13,4,2), {0,1,3,9}
C(21,5,2), {3,6,7,12,14}
C(31,6,2), {1,5,11,24,25,27}
C(43,7,2), existence unresolved
C(57,8,2), {0,1,6,15,22,26,45,55}
Next unresolved cases are C(111,11,2) and C(157,13,2). (End)
"In the range we explored carefully, the optimal packings were substantially irregular only for n of the form n = k(k+1)+1, k = 3, 4, 5, 6, 7, i.e., for n = 13, 21, 31, 43, and 57." (cited from Lubachevsky, Graham link, Introduction). - Rainer Rosenthal, May 27 2020
From Bernard Schott, Dec 31 2020: (Start)
For n >= 1, a(n) is the number of solutions x in the interval 1 <= x <= n of the equation x^2 - [x^2] = (x - [x])^2, where [x] = floor(x). For n = 3, the a(3) = 7 solutions in the interval [1, 3] are 1, 3/2, 2, 9/4, 5/2, 11/4 and 3.
This sequence is the answer to the 4th problem proposed during the 20th British Mathematical Olympiad in 1984 (see link B.M.O 1984. and Gardiner reference). (End)
Called "Hogben numbers" after the British zoologist, statistician and writer Lancelot Thomas Hogben (1895-1975). - Amiram Eldar, Jun 24 2021
Minimum Wiener index of 2-degenerate graphs with n+1 vertices (n>0). A maximal 2-degenerate graph can be constructed from a 2-clique by iteratively adding a new 2-leaf (vertex of degree 2) adjacent to two existing vertices. The extremal graphs are maximal 2-degenerate graphs with diameter at most 2. - Allan Bickle, Oct 14 2022
a(n) is the number of parking functions of size n avoiding the patterns 123, 213, and 312. - Lara Pudwell, Apr 10 2023
Repeated iteration of a(k) starting with k=2 produces Sylvester's sequence, i.e., A000058(n) = a^n(2), where a^n is the n-th iterate of a(k). - Curtis Bechtel, Apr 04 2024
a(n) is the maximum number of triangles that can be traversed by starting from a triangle and moving to adjacent triangles via an edge, without revisiting any triangle, in an n X n X n equilateral triangular grid made up of n^2 unit equilateral triangles. - Kiran Ananthpur Bacche, Jan 16 2025

Examples

			G.f. = 1 + x + 3*x^2 + 7*x^3 + 13*x^4 + 21*x^5 + 31*x^6 + 43*x^7 + ...
		

References

  • Archimedeans Problems Drive, Eureka, 22 (1959), 15.
  • Steve Dinh, The Hard Mathematical Olympiad Problems And Their Solutions, AuthorHouse, 2011, Problem 1 of the British Mathematical Olympiad 2007, page 160.
  • Anthony Gardiner, The Mathematical Olympiad Handbook: An Introduction to Problem Solving, Oxford University Press, 1997, reprinted 2011, Problem 4 pp. 64 and 173 (1984).
  • Paul R. Halmos, Linear Algebra Problem Book, MAA, 1995, pp. 75-6, 242-4.
  • Ross Honsberger, Ingenuity in Mathematics, Random House, 1970, p. 87.
  • Daniel R. Hughes and Frederick Charles Piper, Projective Planes, Springer, 1973.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Sequences on the four axes of the square spiral: Starting at 0: A001107, A033991, A007742, A033954; starting at 1: A054552, A054556, A054567, A033951.
Sequences on the four diagonals of the square spiral: Starting at 0: A002939 = 2*A000384, A016742 = 4*A000290, A002943 = 2*A014105, A033996 = 8*A000217; starting at 1: A054554, A053755, A054569, A016754.
Sequences obtained by reading alternate terms on the X and Y axes and the two main diagonals of the square spiral: Starting at 0: A035608, A156859, A002378 = 2*A000217, A137932 = 4*A002620; starting at 1: A317186, A267682, A002061, A080335.
Cf. A010000 (minimum Weiner index of 3-degenerate graphs).

Programs

  • GAP
    List([0..50], n->n^2-n+1); # Muniru A Asiru, May 27 2018
  • Haskell
    a002061 n = n * (n - 1) + 1  -- Reinhard Zumkeller, Dec 18 2013
    
  • Magma
    [ n^2 - n + 1 : n in [0..50] ]; // Wesley Ivan Hurt, Jun 12 2014
    
  • Maple
    A002061 := proc(n)
        numtheory[cyclotomic](6,n) ;
    end proc:
    seq(A002061(n), n=0..20); # R. J. Mathar, Feb 07 2014
  • Mathematica
    FoldList[#1 + #2 &, 1, 2 Range[0, 50]] (* Robert G. Wilson v, Feb 02 2011 *)
    LinearRecurrence[{3, -3, 1}, {1, 1, 3}, 60] (* Harvey P. Dale, May 25 2011 *)
    Table[n^2 - n + 1, {n, 0, 50}] (* Wesley Ivan Hurt, Jun 12 2014 *)
    CoefficientList[Series[(1 - 2x + 3x^2)/(1 - x)^3, {x, 0, 52}], x] (* Robert G. Wilson v, Feb 18 2018 *)
    Cyclotomic[6, Range[0, 100]] (* Paolo Xausa, Feb 09 2024 *)
  • Maxima
    makelist(n^2 - n + 1,n,0,55); /* Martin Ettl, Oct 16 2012 */
    
  • PARI
    a(n) = n^2 - n + 1
    

Formula

G.f.: (1 - 2*x + 3*x^2)/(1-x)^3. - Simon Plouffe in his 1992 dissertation
a(n) = -(n-5)*a(n-1) + (n-2)*a(n-2).
a(n) = Phi_6(n) = Phi_3(n-1), where Phi_k is the k-th cyclotomic polynomial.
a(1-n) = a(n). - Michael Somos, Sep 04 2006
a(n) = a(n-1) + 2*(n-1) = 2*a(n-1) - a(n-2) + 2 = 1+A002378(n-1) = 2*A000124(n-1) - 1. - Henry Bottomley, Oct 02 2000 [Corrected by N. J. A. Sloane, Jul 18 2010]
a(n) = A000217(n) + A000217(n-2) (sum of two triangular numbers).
From Paul Barry, Mar 13 2003: (Start)
x*(1+x^2)/(1-x)^3 is g.f. for 0, 1, 3, 7, 13, ...
a(n) = 2*C(n, 2) + C(n-1, 0).
E.g.f.: (1+x^2)*exp(x). (End)
a(n) = ceiling((n-1/2)^2). - Benoit Cloitre, Apr 16 2003. [Hence the terms are about midway between successive squares and so (except for 1) are not squares. - N. J. A. Sloane, Nov 01 2005]
a(n) = 1 + Sum_{j=0..n-1} (2*j). - Xavier Acloque, Oct 08 2003
a(n) = floor(t(n^2)/t(n)), where t(n) = A000217(n). - Jon Perry, Feb 14 2004
a(n) = leftmost term in M^(n-1) * [1 1 1], where M = the 3 X 3 matrix [1 1 1 / 0 1 2 / 0 0 1]. E.g., a(6) = 31 since M^5 * [1 1 1] = [31 11 1]. - Gary W. Adamson, Nov 11 2004
a(n+1) = n^2 + n + 1. a(n+1)*a(n) = (n^6-1)/(n^2-1) = n^4 + n^2 + 1 = a(n^2+1) (a product of two consecutive numbers from this sequence belongs to this sequence). (a(n+1) + a(n))/2 = n^2 + 1. (a(n+1) - a(n))/2 = n. a((a(n+1) + a(n))/2) = a(n+1)*a(n). - Alexander Adamchuk, Apr 13 2006
a(n+1) is the numerator of ((n + 1)! + (n - 1)!)/ n!. - Artur Jasinski, Jan 09 2007
a(n) = A132111(n-1, 1), for n > 1. - Reinhard Zumkeller, Aug 10 2007
a(n) = Det[Transpose[{{-1, 1}, {0, -1}}] - n {{-1, 1}, {0, -1}}]. - Artur Jasinski, Mar 31 2008
a(n) = 3*a(n-1) - 3*a(n-2) + a(n-3), n >= 3. - Jaume Oliver Lafont, Dec 02 2008
a(n) = A176271(n,1) for n > 0. - Reinhard Zumkeller, Apr 13 2010
a(n) == 3 (mod n+1). - Bruno Berselli, Jun 03 2010
a(n) = (n-1)^2 + (n-1) + 1 = 111 read in base n-1 (for n > 2). - Jason Kimberley, Oct 18 2011
a(n) = A228643(n, 1), for n > 0. - Reinhard Zumkeller, Aug 29 2013
a(n) = sqrt(A058031(n)). - Richard R. Forberg, Sep 03 2013
G.f.: 1 / (1 - x / (1 - 2*x / (1 + x / (1 - 2*x / (1 + x))))). - Michael Somos, Apr 03 2014
a(n) = A243201(n - 1) / A003215(n - 1), n > 0. - Mathew Englander, Jun 03 2014
For n >= 2, a(n) = ceiling(4/(Sum_{k = A000217(n-1)..A000217(n) - 1}, 1/k)). - Richard R. Forberg, Aug 17 2014
A256188(a(n)) = 1. - Reinhard Zumkeller, Mar 26 2015
Sum_{n>=0} 1/a(n) = 1 + Pi*tanh(Pi*sqrt(3)/2)/sqrt(3) = 2.79814728056269018... . - Vaclav Kotesovec, Apr 10 2016
a(n) = A101321(2,n-1). - R. J. Mathar, Jul 28 2016
a(n) = A000217(n-1) + A000124(n-1), n > 0. - Torlach Rush, Aug 06 2018
Sum_{n>=1} arctan(1/a(n)) = Pi/2. - Amiram Eldar, Nov 01 2020
Sum_{n=1..M} arctan(1/a(n)) = arctan(M). - Lee A. Newberg, May 08 2024
From Amiram Eldar, Jan 20 2021: (Start)
Product_{n>=1} (1 + 1/a(n)) = cosh(sqrt(7)*Pi/2)*sech(sqrt(3)*Pi/2).
Product_{n>=2} (1 - 1/a(n)) = Pi*sech(sqrt(3)*Pi/2). (End)
For n > 1, sqrt(a(n)+sqrt(a(n)-sqrt(a(n)+sqrt(a(n)- ...)))) = n. - Diego Rattaggi, Apr 17 2021
a(n) = (1 + (n-1)^4 + n^4) / (1 + (n-1)^2 + n^2) [see link B.M.O. 2007 and Steve Dinh reference]. - Bernard Schott, Dec 27 2021

Extensions

Partially edited by Joerg Arndt, Mar 11 2010
Partially edited by Bruno Berselli, Dec 19 2013

A316328 Lexicographically earliest knight's path on spiral on infinite chessboard.

Original entry on oeis.org

0, 9, 2, 5, 8, 3, 6, 1, 4, 7, 10, 13, 28, 31, 14, 11, 26, 23, 44, 19, 22, 43, 40, 17, 34, 37, 18, 15, 32, 29, 52, 25, 46, 21, 42, 69, 20, 39, 16, 33, 12, 27, 24, 45, 74, 41, 68, 103, 36, 61, 94, 57, 54, 85, 50, 47, 76, 113, 72, 107, 150, 67, 102, 63, 66, 35
Offset: 0

Views

Author

N. J. A. Sloane, Jul 13 2018

Keywords

Comments

On a doubly-infinite chessboard, number all the cells in a counterclockwise spiral starting at a central cell labeled 0. Start with a knight at cell 0, and thereafter always move the knight to the smallest unvisited cell. Sequence gives succession of squares visited.
Sequence ends if knight is unable to move.
Inspired by A316588 and, like that sequence, has only finitely many terms; see A316667 for details.
See A326924 for a variant where the knight prefers squares closest to the origin, and gets trapped only after 22325 moves. - M. F. Hasler, Oct 21 2019
See A323809 for an infinite extension of this sequence, obtained by allowing the knight to go back in case it was trapped. See A328908 for a variant of length > 10^6, using the taxicab distance, and A328909 for a variant using the sup norm. - M. F. Hasler, Nov 04 2019

Examples

			The board is spirally numbered, starting with 0 at (0,0), as follows:
.
  16--15--14--13--12   :
   |               |   :
  17   4---3---2  11  28
   |   |       |   |   |
  18   5   0---1  10  27
   |   |           |   |
  19   6---7---8---9  26
   |                   |
  20--21--22--23--24--25
.
Coordinates of a point are given in A174344, A274923 and A296030 (but these have offset 1: they list coordinates of the n-th point on the spiral, so the coordinates of first point, 0 at the origin, have index n = 1, etc).
Starting at the origin, a(0) = 0, the knight jumps to the square with the lowest number at the eight available positions, (+-2, +-1) or (+-1, +-2), which is a(1) = 9 at (2, -1).
From there, the available square with the lowest number is a(2) = 2 at (1, 1): square 0 at the origin is not available since already occupied earlier. Similarly, the knight will not be allowed to go on squares a(1) = 9 or a(2) = 2 ever after.
		

Crossrefs

Cf. A316667 (same with offset 1 and values +1), A316338 (numbers not in this sequence).
Cf. A323809 (infinite extension of this sequence).
Cf. A316588 (variant with diagonally numbered board, coordinates x, y >= 0).
Cf. A326924 and A326922 (variant: choose square closest to the origin), A328908 and A328928 (variant using taxicab distance); A328909 and A328929 (variant using sup norm).
Cf. A326916 and A326918, A326413, A328698 (squares are filled with digits of the infinite word 0,1,...9,1,0,1,1,...).
Cf. A174344, A274923, A296030 (coordinates of a given square).

Programs

  • PARI
    {local( K=[[(-1)^(i\2)<<(i>4),(-1)^i<<(i<5)]|i<-[1..8]], nxt(p, x=coords(p))=vecsort(apply(K->t(x+K), K))[1], 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), 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]), U=[], t(x, p=pos(x[1],x[2]))=if(p<=U[1]||setsearch(U, p), oo, p)); my(A=List(0)); 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 the last term: ", #A-1); A316328(n)=A[n+1];}

Formula

a(n) = A316667(n+1) - 1.

Extensions

Terms from a(17) on computed by Daniël Karssen, Jul 10 2018
Examples added and crossrefs edited by M. F. Hasler, Nov 04 2019

A316588 Squares visited by knight moves on a diagonally numbered board and moving to the lowest available unvisited square at each step.

Original entry on oeis.org

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

Views

Author

Daniël Karssen, Jul 07 2018

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 .
.
This sequence is finite: At step 2402, square 1378 is visited, after which there are no unvisited squares within one knight move.

Crossrefs

A326922 Squares visited by a knight moving on a board with squares labeled with their squared distance from the origin and where the knight moves to the smallest labeled unvisited square; the smallest spiral number ordering is used if the distances are equal.

Original entry on oeis.org

0, 5, 2, 1, 2, 1, 2, 1, 2, 1, 4, 5, 10, 13, 4, 5, 10, 5, 10, 5, 4, 13, 10, 5, 10, 13, 4, 5, 10, 13, 16, 13, 10, 5, 16, 13, 20, 9, 8, 9, 8, 9, 8, 9, 8, 17, 18, 17, 26, 25, 20, 25, 10, 13, 16, 29, 18, 17, 26, 25, 20, 25, 20, 13, 16, 29, 18, 17, 26, 25, 20, 25, 40, 41, 34, 37, 50, 29, 18, 17, 26, 25, 20, 25, 20, 25, 26, 37, 34, 25, 26, 17, 34, 25, 26, 17, 34, 25, 20, 37
Offset: 0

Views

Author

Scott R. Shannon, Oct 21 2019

Keywords

Comments

This sequence uses the squared distance from the origin to label the squares. At each step the knight goes to an unvisited square with the smallest label; if there are two or more squares with the same label it then chooses the square with the smallest number if the board was numbered as a spiral, i.e., the smallest spiral numbered square as in A316667.
The sequence is finite. After 22325 steps a square with label 6885 (spiral number = 25984) is visited, after which all neighboring squares have been visited.
If one looks at the spiral number for the visited squares in this sequence one finds it is the same as A316667 for the first 34 steps. On the 35th step this sequence goes to a square with spiral number 77, which is 4 units from the origin, while A316667 goes to square 43, which is sqrt(18) (> 4) units from the origin.
Sequence A326924 gives the number of the square visited at the n-th move, which is at distance^2 a(n) from the origin, cf. formula. - M. F. Hasler, Oct 22 2019

Examples

			The squares are labeled using their squared distance from the origin:
.
    +----+----+----+----+----+----+----+
    | 18 | 13 | 10 |  9 | 10 | 13 | 18 |
    +----+----+----+----+----+----+----+
    | 13 |  8 |  5 |  4 |  5 |  8 | 13 |
    +----+----+----+----+----+----+----+
    | 10 |  5 |  2 |  1 |  2 |  5 | 10 |
    +----+----+----+----+----+----+----+
    |  9 |  4 |  1 |  0 |  1 |  4 |  9 |
    +----+----+----+----+----+----+----+
    | 10 |  5 |  2 |  1 |  2 |  5 | 10 |
    +----+----+----+----+----+----+----+
    | 13 |  8 |  5 |  4 |  5 |  8 | 13 |
    +----+----+----+----+----+----+----+
    | 18 | 13 | 10 |  9 | 10 | 13 | 18 |
    +----+----+----+----+----+----+----+
.
If the knight has a choice of two or more squares with the same label (same squared distance from the origin), then the square with the minimum spiral number, as shown in A316667, is chosen.
		

Crossrefs

Cf. A174344, A274923, A296030 (coordinates of the square number n).

Programs

Formula

a(n) = A174344(A326924(n))^2 + A274923(A326924(n))^2. - M. F. Hasler, Oct 22 2019

A328928 Squares visited by a knight moving on a taxicab geometry numbered board where the knight moves to the smallest numbered unvisited square; the minimum distance from the origin is used if the square numbers are equal; the smallest spiral number ordering is used if the distances are equal.

Original entry on oeis.org

0, 3, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 4, 5, 2, 3, 4, 3, 4, 3, 2, 5, 4, 3, 4, 5, 2, 3, 4, 5, 4, 5, 4, 3, 4, 5, 6, 3, 4, 3, 4, 3, 4, 3, 4, 5, 6, 5, 6, 7, 6, 5, 4, 5, 4, 7, 6, 5, 6, 7, 6, 5, 6, 5, 4, 7, 6, 5, 6, 7, 6, 5, 8, 7, 6, 7, 6, 5, 6, 7, 6, 5, 6, 5, 6, 7, 8, 7, 8, 7, 6, 7, 8, 7, 6, 7, 8, 7, 6
Offset: 0

Views

Author

Scott R. Shannon, Oct 31 2019

Keywords

Comments

This sequence uses the taxicab geometry distance from the 0-squared origin to enumerate each square on the board. At each step the knight goes to an unvisited square with the smallest square number. If the knight has a choice of two or more squares with the same number it then chooses the square which is the closest to the 0-squared origin. If two or more squares are found which also have the same distance to the origin, then the square which was first drawn in a square spiral numbering is chosen, i.e., the smallest spiral numbered square as in A316667.
The sequence is finite. After 1092366 steps a square with the number 728 (standard spiral number = 1165673) is visited, after which all neighboring squares have been visited.
See A328908(n) for the position on the spiral (cf. A316328) of the square visited at move n. - M. F. Hasler, Nov 04 2019

Examples

			The squares are labeled using their taxicab geometry distance from the origin:
.
    +----+----+----+----+----+----+----+
    |  6 |  5 |  4 |  3 |  4 |  5 |  6 |
    +----+----+----+----+----+----+----+
    |  5 |  4 |  3 |  2 |  3 |  4 |  5 |
    +----+----+----+----+----+----+----+
    |  4 |  3 |  2 |  1 |  2 |  3 |  4 |
    +----+----+----+----+----+----+----+
    |  3 |  2 |  1 |  0 |  1 |  2 |  3 |
    +----+----+----+----+----+----+----+
    |  4 |  3 |  2 |  1 |  2 |  3 |  4 |
    +----+----+----+----+----+----+----+
    |  5 |  4 |  3 |  2 |  3 |  4 |  5 |
    +----+----+----+----+----+----+----+
    |  6 |  5 |  4 |  3 |  4 |  5 |  6 |
    +----+----+----+----+----+----+----+
.
If the knight has a choice of two or more squares with the same number which also have the same distance from the origin, then the square with the minimum square spiral number, as shown in A316667, is chosen.
		

Crossrefs

Cf. A174344, A274923, A296030 (coordinates of the n-th point on the spiral).

Programs

Formula

a(n) = |A174344(p)| + |A274923(p)| with p = A328908(n)+1. - M. F. Hasler, Nov 04 2019

A328929 Squares visited by a knight moving on a square-ringed numbered board where the knight moves to the smallest numbered unvisited square; the minimum distance from the origin is used if the square numbers are equal; the smallest spiral number ordering is used if the distances are equal.

Original entry on oeis.org

0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 2, 2, 3, 2, 3, 2, 2, 3, 3, 2, 3, 3, 2, 2, 3, 3, 4, 3, 3, 2, 3, 4, 2, 3, 2, 3, 2, 3, 2, 3, 4, 3, 4, 5, 3, 3, 4, 5, 3, 4, 5, 4, 4, 5, 6, 4, 5, 3, 4, 5, 4, 5, 6, 4, 3, 4, 5, 4, 4, 5, 4, 4, 5, 4, 3, 4, 5, 4, 4, 5, 4, 4, 5, 4, 5, 4, 4, 5, 4, 4, 5, 6, 5, 5, 6
Offset: 0

Views

Author

Scott R. Shannon, Oct 31 2019

Keywords

Comments

This sequence uses the number of the square ring of squares surrounding the 0-numbered origin to enumerate each square on the board. At each step the knight goes to an unvisited square with the smallest square number. If the knight has a choice of two or more squares with the same number it then chooses the square which is the closest to the 0-squared origin. If two or more squares are found which also have the same distance to the origin, then the square which was first drawn in a square spiral numbering is chosen, i.e., the smallest spiral numbered square as in A316667.
The sequence is finite. After 25108 steps a square with the number 73 (standard spiral number = 21041) is visited, after which all neighboring squares have been visited.

Examples

			The squares are labeled using the number of the square ring of squares surrounding the origin:
.
    +---+---+---+---+---+---+---+
    | 3 | 3 | 3 | 3 | 3 | 3 | 3 |
    +---+---+---+---+---+---+---+
    | 3 | 2 | 2 | 2 | 2 | 2 | 3 |
    +---+---+---+---+---+---+---+
    | 3 | 2 | 1 | 1 | 1 | 2 | 3 |
    +---+---+---+---+---+---+---+
    | 3 | 2 | 1 | 0 | 1 | 2 | 3 |
    +---+---+---+---+---+---+---+
    | 3 | 2 | 1 | 1 | 1 | 2 | 3 |
    +---+---+---+---+---+---+---+
    | 3 | 2 | 2 | 2 | 2 | 2 | 3 |
    +---+---+---+---+---+---+---+
    | 3 | 3 | 3 | 3 | 3 | 3 | 3 |
    +---+---+---+---+---+---+---+
.
If the knight has a choice of two or more squares with the same number which also have the same distance from the origin, then the square with the minimum square spiral number, as shown in A316667, is chosen.
		

Crossrefs

Cf. A328909 (number of the visited square, following spiral numbering).
Cf. A326922 (variant using Euclidean or L2-norm), A328928 (variant with 1-norm = taxicab distance); A326924, A328908 (corresponding trajectories, i.e., spiral number of squares).

Programs

Formula

a(n) = max(|A174344(p)|, |A274923(p)|), p = A328908(n)+1. - M. F. Hasler, Nov 04 2019

A329520 a(n) is the number of completed steps before being trapped for a knight moving on a square-spiral numbered board where the knight moves to an unvisited square with the lowest spiral number and with n or fewer visited neighbors. It only moves to squares with n+1 or more visited neighbors when no other squares are available, and if two or more such squares are present it chooses the square with the fewest visited neighbors, then the square with the lowest spiral number if still tied.

Original entry on oeis.org

1151, 225, 1866, 513316, 11171, 3935788, 23014, 2015
Offset: 1

Views

Author

Scott R. Shannon, Nov 19 2019

Keywords

Comments

This sequence gives the number of completed steps for a knight before being trapped when moving on a square-spiral numbered board and at each step choosing an unvisited square one knight-leap away which has the lowest spiral number and has n or fewer visited neighboring squares. It will only move to a square with n+1 or more neighbors when no square with n or fewer neighbors is available. If it is forced to move to such squares and two or more are available, it will choose the square with the fewest neighbors. If two or more squares with the same number of neighbors exist then it will choose the square with the smallest spiral number.
For n = 8 the path is equivalent to that given in A316667. Every square will always have eight or fewer visited neighbors, thus all unvisited squares are available to move to and the one with the smallest spiral number will always be chosen. This is A316667.
The values are surprisingly diverse, and it is not immediately obvious that the smaller values of n will even have a finite path length. It seems reasonable to assume that with the knight always choosing squares with very few visited neighbors it would be constantly moving away from the origin and thus never be trapped. But the path taken shows that, with such a restrictive choice of neighboring squares, the path leaves large areas of unvisited squares as the knight moves around the board, some of these being relatively close to the origin. At some point the knight will have an open path and move to these squares, thus move toward the origin, due to its preference to choose the squares with the smallest spiral number. It is thus drawn inward where it will then be surrounded by previous visited squares and eventually trapped. This tendency to leave large areas of unvisited squares is most easily seen in the path for n = 2, see link below, which is trapped after only 225 steps.
On the other extreme the path for n = 6, see A329519, is such that very few open areas remain near the origin, but the knight is still cautious in its choice and will not move to a square where it will likely be trapped, unless no other choices exist. This leads to the knight performing an extremely long walk before eventually finding a gap in its previous paths, moving toward the origin and finally being trapped after 3935788 steps.

Examples

			a(6) = 3935788. See A329519.
a(7) = 23014. See A329518.
a(8) = 2015. See A316667.
See A316667 for the spiral board numbering.
		

Crossrefs

A328909 Knight's tour on spirally numbered infinite board, when the knight always jumps on the unvisited square closest to the origin, first according to the sup-norm, then 2-norm, then number of the square: a(n) = number of square visited at move n.

Original entry on oeis.org

0, 9, 2, 5, 8, 3, 6, 1, 4, 7, 10, 13, 28, 31, 14, 11, 26, 23, 44, 19, 22, 43, 40, 17, 34, 37, 18, 15, 32, 29, 52, 25, 46, 21, 42, 69, 20, 39, 16, 33, 12, 27, 24, 45, 74, 41, 68, 103, 38, 35, 60, 93, 30, 53, 84, 49, 78, 115, 160, 75, 116, 47, 76, 113, 72, 107, 150, 67, 36, 61, 94, 57, 54, 85, 50, 79, 82
Offset: 0

Views

Author

M. F. Hasler, Oct 31 2019

Keywords

Comments

Differs from A326924 (where only the 2-norm is considered) from a(34) = 42 on, and from A316328 (which considers only the number of the square) from a(48) = 38 on.
When the knight lands on square number a(25108) = 21040 of coordinates (73, -57), there is no unvisited square within reach. The sequence then stops, or can be extended by specifying that the knight has to go back on its path until an unvisited square comes within reach, as in A323809.
The least unvisited square at move 25108 is square number 17822 at (67,67). It is however close to the border of the visited region and the knight will visit it in the infinite extension of the sequence shortly after, at move n = 25358. Is there a square that will never be visited in that infinite extension? (Cf. comments in A323809.) - M. F. Hasler, Nov 04 2019

Examples

			The squares are numbered as in the spiral given in A174344 (upside down to get a counterclockwise spiral, but this is irrelevant here).
The knight starts at a(0) = 0 with coordinates (0, 0).
It jumps to a(1) = 9 with coordinates (2, -1): all 8 available squares (+-2, +-1) and (+-1, +-2) are at the same sup-norm and Euclidean distance from the origin, but square number 9 has the smallest number.
		

Crossrefs

Cf. A328929 for the value on the visited square, sup norm of coordinates of a(n).
Cf. A323809 ~ A316328 ~ A316667, A326924, A328908 (variants).
Cf. A174344, A274923, A296030 (coordinates of square number n).

Programs

  • PARI
    {local(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]), 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, [vecmax(abs(x)), norml2(x), p]), nxt(p, x=coords(p))=vecsort(apply(K->t(x+K), K))[1][3]); 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); A328909(n)=A[n+1];} \\ To compute the infinite extension of the sequence, set en upper limit to the for() loop and replace "break" by listput(A, A[n-1])

Formula

A328929(n) = max(|A174344(a(n))|, |A274923(a(n))|) = sup norm of the coordinates of square a(n).

A326924 Squares visited by a knight on a spirally numbered board, moving always to the unvisited square closest to the origin.

Original entry on oeis.org

0, 9, 2, 5, 8, 3, 6, 1, 4, 7, 10, 13, 28, 31, 14, 11, 26, 23, 44, 19, 22, 43, 40, 17, 34, 37, 18, 15, 32, 29, 52, 25, 46, 21, 76, 47, 50, 27, 12, 33, 16, 39, 20, 45, 24, 51, 48, 77, 114, 73, 70, 105, 38, 35, 60, 93, 30, 53, 84, 49, 78, 115, 74, 41, 68, 103, 36, 61, 94, 57, 54, 85, 124, 81
Offset: 0

Views

Author

M. F. Hasler, Oct 21 2019

Keywords

Comments

"Closest to the origin" is meant in the sense of Euclidean distance, and in case of a tie, the square coming earliest on the spiral.
Differs from the original A316328 from a(34) = 76 on. See there for more information and other related sequences.
The knight gets trapped at the 22325th move at position (x,y) = (81, -18), from which it can't reach any unvisited square.
Sequence A326922 gives the distance^2 of the square number a(n) visited at move n. - M. F. Hasler, Oct 22 2019
From M. F. Hasler, Nov 04 2019: (Start)
When a(22325) = 25983 at (81, -18) is reached, at distance sqrt(6885) from the origin, the last unvisited square has number 13924, at (-59, 59), distance sqrt(6962) from the origin. This suggests that in an infinite extension (knight moves one step back if no unvisited square is available, cf. A323809) the knight might eventually visit every square. Can this be disproved by a counterexample of a square which will never be visited in the infinite extension? (In A328908 such a counterexample exists even before the knight gets stuck.)
The ratio a(n)/n oscillates between 0.5 and less than 1.7 for all n > 3000, even < 1.5 for all n > 14000, cf. graph of the sequence. What is the superior and inferior limit of this ratio, assuming the infinite extension beyond n = 22325?
(End)

Crossrefs

Cf. A174344, A274923, A296030 (coordinate of square number n).

Programs

  • PARI
    {local(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]), 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, [norml2(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); A326924(n)=A[n+1];} \\ To compute the infinite extension, set upper bound in for() loop and replace "break" by listput(A, A[n-1])
Showing 1-10 of 94 results. Next