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-20 of 50 results. Next

A273138 Row number in which n appears for the first time in the infinite Sudoku-type array A269526.

Original entry on oeis.org

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

Views

Author

Omar E. Pol, Jul 02 2016

Keywords

Comments

It appears that in the square array A269526 the numbers generally appear for the first time in or near the first few rows.

Examples

			Diagram with the first 18 positive integers located in the position where they appear for first time in the square array A269526:
1, 3, -, 6, -, -, 10, 11, 13, -,  -, 18,
2, 4, 5, -, 8, -,  -, 12, 14, 16, -,
-, -, -, -, 9, -,  -,  -, 15, 17,
-, -, -, -, -, -,  -,  -,  -,
-, 7, -, -, -, -,  -,  -,
-, -, -, -, -, -,  -,
-, -, -, -, -, -,
-, -, -, -, -,
-, -, -, -,
-, -, -,
-, -,
-,
...
a(9) = 3 because in the square array A269526 the number 9 appears for the first time in the third row.
a(n) <= 6, for n = 1..80.
		

Crossrefs

First three rows in the square array A269526 are A274315, A274316, A274317.

A274617 Fourth column of A269526.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Jul 01 2016

Keywords

Crossrefs

Cf. A269526. Subtracting 1 gives A274619.

A274791 Fourth row of infinite Sudoku-type array A269526.

Original entry on oeis.org

4, 2, 3, 5, 1, 8, 9, 7, 16, 6, 18, 17, 11, 10, 23, 22, 14, 12, 13, 15, 26, 32, 30, 19, 37, 35, 36, 42, 38, 40, 27, 44, 20, 21, 50, 47, 46, 51, 52, 49, 48, 53, 24, 55, 54, 59, 61, 25, 58, 64, 70, 28, 62, 31, 29, 72, 69, 74, 68, 78, 84, 33, 34, 85, 90, 88, 93, 91, 94, 86, 98, 96, 39, 99, 101, 103, 41, 107
Offset: 1

Views

Author

Omar E. Pol, Jul 06 2016

Keywords

Crossrefs

First 20 terms taken from the Example section of A269526.

Programs

  • PARI
    See Links section.

A279049 A 3-dimensional variant of A269526 "Infinite Sudoku": expansion (read first by layer, then by row) of square pyramid P(n,j,k). (See A269526 and "Comments" below for definition).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 1, 2, 7, 8, 4, 3, 2, 7, 3, 5, 6, 7, 9, 10, 3, 1, 1, 6, 5, 2, 5, 4, 1, 6, 4, 7, 8, 5, 6, 2, 11, 9, 10, 3, 12, 8, 13, 4, 5, 3, 2, 10, 7, 1, 8, 6, 11, 3, 2, 8, 10, 1, 4, 7, 5, 6, 3, 2, 11, 9, 8, 4, 1, 12, 8, 13, 6, 7, 5, 14, 9, 11, 3, 1, 4, 15, 5, 6, 7, 2, 7, 8, 1, 10, 4
Offset: 1

Views

Author

Bob Selcoe, Dec 04 2016

Keywords

Comments

Comments: Construct a square pyramid so the top left corners of each layer are directly underneath each other. Place a "1" in the top layer (P(1,1,1) = 1); in each successive layer starting in the top left corner (P(n,1,1)) and continuing horizontally until each successive row is complete: add the least positive integer so that no row, column or diagonal (in any horizontal or vertical direction) contains a repeated term. Here, the following definitions apply:
"row" means a horizontal line (read left to right) on a layer;
"horizontal column" means a line on a layer read vertically (downward) WITHIN a layer;
"vertical column" means a vertical line (read downward) ACROSS layers; and
"diagonal" means a diagonal line with slope 1 or -1 in any possible plane.
Conjecture: all infinite lines (i.e., all vertical columns and some multi-layer diagonals) are permutations of the natural numbers (while this has been proven for rows and columns in A269526, proofs here will require more subtle analysis).

Examples

			Example:
Layers start P(1,1,1):
Layer 1:          1
                  -----
Layer 2:          2  3
                  4  5
                  --------
Layer 3:          6  1  2
                  7  8  4
                  3  2  7
                  -----------
Layer 4:          3  5  6  7
                  9 10  3  1
                  1  6  5  2
                  5  4  1  6
                  -----------
Layer 4, Row 2, Column 1 = P(4,2,1) = 9.
P(4,3,3) = 5 because all coefficients < 5 have appeared in at least one row, column or diagonal to P(4,3,3): P(4,2,4) and P(4,3,1) = 1; P(2,1,1) and P(3,3,2) = 2; P(4,1,1) and P(4,2,3) = 3; and P(3,2,3) = 4.
Expanding successive layers (read by rows):
1
2, 3, 4, 5
6, 1, 2, 7, 8, 4, 3, 2, 7
3, 5, 6, 7, 9, 10, 3, 1, 1, 6, 5, 2, 5, 4, 1, 6
4, 7, 8, 5, 6, 2, 11, 9, 10, 3, 12, 8, 13, 4, 5, 3, 2, 10, 7, 1, 8, 6, 11, 3, 2
		

Crossrefs

Cf. A269526.
Cf. A000330 (square pyramidal numbers).

A273139 Where records occur in A269526.

Original entry on oeis.org

1, 2, 3, 5, 9, 10, 17, 20, 26, 28, 36, 44, 45, 54, 64, 65, 76, 78, 103, 105, 134, 135, 168, 171, 189, 190, 230, 252, 253, 275, 298, 299, 323, 324, 325, 376, 377, 378, 405, 406, 463, 493, 494, 627, 628, 629, 630, 736, 737, 738, 740, 741, 779, 859, 899, 902, 944, 946, 1033, 1035, 1171, 1176, 1223, 1225
Offset: 1

Views

Author

Omar E. Pol, Jul 02 2016

Keywords

Crossrefs

A279477 A 3-dimensional variant of A269526 "Infinite Sudoku": expansion (read first by layer, then by row) of "Type 1" tetrahedron P(n,j,k). (See A269526 and Comments section below for definition.)

Original entry on oeis.org

1, 2, 3, 4, 5, 1, 6, 2, 5, 3, 3, 4, 7, 8, 9, 1, 6, 10, 2, 5, 6, 2, 5, 1, 3, 4, 4, 7, 6, 3, 5, 1, 8, 4, 2, 4, 7, 8, 6, 10, 2, 8, 9, 5, 1, 10, 2, 11, 12, 5, 9, 3, 7, 13, 1, 6, 9, 5, 1, 3, 11, 7, 1, 4, 3, 8, 6, 12, 10, 2, 3, 7, 5, 8, 6, 4, 10, 2, 6, 1, 3, 5, 7, 11
Offset: 1

Views

Author

Bob Selcoe, Dec 12 2016

Keywords

Comments

Construct a tetrahedron so rows have length j and the top left corner of each layer is directly underneath that of the previous layer (see Example section). Place a "1" in the top layer (P(1,1,1) = 1); in each successive layer starting in the top left corner (P(n,1,1)) and continuing horizontally until each successive row is complete: add the least positive integer so that no row, column or diagonal (in any horizontal or vertical direction) contains a repeated term. Here, the following definitions apply:
"row" means a horizontal line (read left to right) on a layer;
"horizontal column" means a line on a layer read vertically (downward) WITHIN a layer;
"vertical column" means a vertical line (read downward) ACROSS layers; and
"diagonal" means a diagonal line with slope 1 or -1 in any possible plane.
Conjecture: all infinite lines (i.e., all vertical columns and some multi-layer diagonals) are permutations of the natural numbers (while this has been proven for rows and columns in A269526, proofs here will require more subtle analysis).

Examples

			Layers start P(1,1,1):
Layer 1:          1
                  ----
Layer 2:          2
                  3  4
                  -------
Layer 3:          5
                  1  6
                  2  5  3
                  ----------
Layer 4:          3
                  4  7
                  8  9  1
                  6 10  2  5
                  -------------
Layer 4, Row 3, Column 2 = P(4,3,2) = 9.
P(4,2,2) = 7 because all coefficients < 7 have appeared in at least one row, column or diagonal to P(4,2,2): P(3,2,1) = 1; P(3,3,1)= 2; P(3,3,3) and P(4,1,1) = 3; P(2,2,2) and P(4,2,1) = 4; P(3,1,1) and P(3,3,2) = 5; and P(3,2,2) = 6.
Expanding successive layers (read by rows):
1
2, 3, 4
5, 1, 6, 2, 5, 3
3, 4, 7, 8, 9, 1, 6, 10, 2, 5
6, 2, 5, 1, 3, 4, 4, 7,  6, 3, 5, 1, 8, 4, 2
4, 7, 8, 6, 10, 2, 8, 9, 5, 1, 10, 2, 11, 12, 5, 9, 3, 7, 13, 1, 6
		

Crossrefs

Cf. A269526.
Cf. A279049, A279478 ("Type 2" tetrahedron).
Cf. A000217 (triangular numbers).

A279478 A 3-dimensional variant of A269526 "Infinite Sudoku": expansion (read first by layer, then by row) of "Type 2" tetrahedron P(n,j,k). (See A269526 and Comments section below for definition.)

Original entry on oeis.org

1, 2, 3, 4, 5, 1, 2, 6, 7, 3, 3, 4, 5, 6, 2, 8, 3, 1, 5, 7, 6, 7, 1, 4, 5, 9, 10, 2, 8, 4, 6, 7, 3, 2, 10, 4, 5, 6, 3, 1, 7, 1, 3, 9, 10, 2, 7, 8, 11, 1, 11, 9, 4, 5, 6, 8, 8, 2, 11, 5, 6, 3, 4, 10, 12, 4, 7, 9, 5, 2, 13, 14, 8, 12, 1, 3, 7, 9, 12, 19, 1, 4, 11, 6
Offset: 1

Views

Author

Bob Selcoe, Dec 12 2016

Keywords

Comments

Construct a tetrahedron so rows have length n-j+1, and the top left corner of each layer is directly underneath that of the previous layer (see Example section). Place a "1" in the top layer (P(1,1,1) = 1); in each successive layer starting in the top left corner (P(n,1,1)) and continuing horizontally until each successive row is complete: add the least positive integer so that no row, column or diagonal (in any horizontal or vertical direction) contains a repeated term. Here, the following definitions apply:
"row" means a horizontal line (read left to right) on a layer;
"horizontal column" means a line on a layer read vertically (downward) WITHIN a layer;
"vertical column" means a vertical line (read downward) ACROSS layers; and
"diagonal" means a diagonal line with slope 1 or -1 in any possible plane.
Conjecture: all infinite lines (i.e., all vertical columns and some multi-layer diagonals) are permutations of the natural numbers (while this has been proven for rows and columns in A269526, proofs here will require more subtle analysis).

Examples

			Layers start P(1,1,1):
Layer 1:          1
                  -----
Layer 2:          2  3
                  4
                  --------
Layer 3:          5  1  2
                  6  7
                  3
                  -----------
Layer 4:          3  4  5  6
                  2  8  3
                  1  5
                  7
                  -----------
Layer 4, Row 1, Column 3 = P(4,1,3) = 5.
P(4,1,4) = 6 because all coefficients < 6 have appeared in at least one row, column or diagonal to P(4,1,4): P(1,1,1) = 1; P(3,1,3)= 2; P(2,1,2) and P(4,1,1)  = 3; P(4,1,2) = 4; and P(4,1,3) = 5.
Expanding successive layers (read by rows):
1
2, 3, 4
5, 1, 2, 6, 7, 3
3, 4, 5, 6, 2, 8, 3,  1, 5, 7
6, 7, 1, 4, 5, 9, 10, 2, 8, 4,  6, 7, 3, 2, 10
4, 5, 6, 3, 1, 7, 1,  3, 9, 10, 2, 7, 8, 11, 1, 11, 9, 4, 5, 6, 8
		

Crossrefs

Cf. A269526.
Cf. A279049, A279477 ("Type 1" tetrahedron).
Cf. A000217 (triangular numbers).

A274640 Counterclockwise square spiral constructed by greedy algorithm, so that each row, column, and diagonal contains distinct numbers.

Original entry on oeis.org

1, 2, 3, 4, 2, 3, 4, 5, 6, 1, 4, 6, 2, 1, 6, 5, 3, 1, 5, 2, 6, 1, 2, 4, 5, 3, 7, 8, 5, 4, 9, 7, 8, 3, 10, 11, 4, 7, 8, 6, 3, 9, 5, 7, 8, 9, 10, 11, 12, 6, 8, 9, 11, 10, 12, 13, 7, 6, 10, 9, 12, 13, 14, 15, 8, 2, 9, 12, 7, 10, 11, 13, 14, 10, 9, 6, 13, 5, 3, 15, 16, 7, 1, 10, 13, 12, 14, 11, 15, 3, 8, 5, 1, 12, 11, 14, 7, 4, 2, 16, 9, 17, 1, 8, 11
Offset: 0

Views

Author

Zak Seidov and Kerry Mitchell, Jun 30 2016

Keywords

Comments

Presumably every row, column, and diagonal is a permutation of the natural numbers, but is there a proof? - N. J. A. Sloane, Jul 10 2016
The n-th cell in the spiral has coordinates x = A174344(n+1), y = A274923(n+1). - N. J. A. Sloane, Jul 11 2016
From Robert G. Wilson v, Dec 25 2016: (Start) [Memo: all these numbers need to decreased by 1, since the offset here is 0. See A324481. - N. J. A. Sloane, Jul 23 2017. Furthermore, the numbers don't seem correct, even after subtracting 1. - N. J. A. Sloane, Jul 04 2019]
Index of first appearance of k = 1,2,3,...: 1, 2, 3, 7, 8, 15, 17, 25, 35, 41, 47, 61, 62, 89, 98, 99, 121, 129, 130, 143, 197, 208, 225, 239, 271, ..., .
1 appears at: 1, 4, 12, 19, 22, 33, 42, 68, 79, 120, 179, 194, 302, 311, 445, 489, 511, 558, 630, 708, 847, 877, 907, ..., .
2 appears at: 2, 5, 9, 16, 48, 52, 70, 73, 88, 95, 110, 146, 280, 291, 309, 327, 488, 605, 656, 681, 735, 778, 1000, ..., .
3 appears at: 3, 6, 10, 23, 29, 36, 56, 76, 97, 105, 153, 168, 184, 252, 338, 437, 457, 670, 818, 906, 953, 967, ..., . (End).

Examples

			The spiral begins:
.
   9--16---2---4---7--14--11--12---1---5---8
   |                                       |
  17   8--15--14--13--12---9--10---6---7   3
   |   |                               |   |
   1   2   4--11--10---3---8---7---9  13  15
   |   |   |                       |   |   |
   8   9   7   3---5---6---1---2   4  12  11
   |   |   |   |               |   |   |   |
  11  12   8   1   2---4---3   6   5  10  14
   |   |   |   |   |       |   |   |   |   |
  15   7   6   5   3   1---2   4   8  11  12
   |   |   |   |   |           |   |   |   |
  14  10   3   2   4---5---6---1   7   9  13
   |   |   |   |                   |   |   |
   7  11   9   6---1---2---4---5---3   8  10
   |   |   |                           |   |
   4  13   5---7---8---9--10--11--12---6   1
   |   |                                   |
  12  14--10---9---6--13---5---3--15--16---7
   |
  10--15---1--12--16---8--14--13--11--18--17
.
The 8 spokes (A274924-A274931) begin:
  E:  1, 2, 4,  8, 11, 12, 16,  9, 19, 24, 22, ...
  NE: 1, 3, 2,  9,  7,  8, 12, 15, 13, 17, 20, ...
  N:  1, 4, 6,  3, 12, 14, 15, 18, 20, 26, 25, ...
  NW: 1, 2, 3,  4,  8,  9,  7, 11, 14, 10, 22, ...
  W:  1, 3, 5,  6,  7, 15, 10, 17, 13, 25, 14, ...
  SW: 1, 4, 6,  5, 14, 10, 11, 23, 16, 18, 21, ...
  S:  1, 5, 2,  9, 13,  8,  7, 11, 10, 17, 19, ...
  SE: 1, 6, 5, 12, 16, 17, 21, 24, 27, 13, 15, ...
		

Crossrefs

Cf. A274641 (the same spiral, but starting with 0 not 1), A174344, A274923.
The 8 spokes are A274924-A274931.
The East-West axis is A275877 (see also A324680), the North-South axis is A276036.
Positions of 1's and 2's give A273059 and A275116.
In the same spirit as the infinite Sudoku array A269526.
Cf. A324481 (position of first n).
Cf. A274821 (the same construction on a hexagonal tiling).

Programs

  • Maple
    #  Maple program from Alois P. Heinz, Jul 12 2016:
    fx:= proc(n) option remember; `if`(n=1, 0, (k->
           fx(n-1)+sin(k*Pi/2))(floor(sqrt(4*(n-2)+1)) mod 4))
         end:
    fy:= proc(n) option remember; `if`(n=1, 0, (k->
           fy(n-1)-cos(k*Pi/2))(floor(sqrt(4*(n-2)+1)) mod 4))
         end:
    b:= proc() 0 end:
    a:= proc(n) local x,y,s,i,t,m;
          x, y:= fx(n+1), fy(n+1);
          if b(x, y) > 0 then b(x, y)
        else s:={};
        for i do t:=b(x+i,y+i); if t>0 then s:=s union {t} else break fi od;
        for i do t:=b(x-i,y-i); if t>0 then s:=s union {t} else break fi od;
        for i do t:=b(x+i,y-i); if t>0 then s:=s union {t} else break fi od;
        for i do t:=b(x-i,y+i); if t>0 then s:=s union {t} else break fi od;
        for i do t:=b(x+i,y  ); if t>0 then s:=s union {t} else break fi od;
        for i do t:=b(x-i,y  ); if t>0 then s:=s union {t} else break fi od;
        for i do t:=b(x  ,y+i); if t>0 then s:=s union {t} else break fi od;
        for i do t:=b(x  ,y-i); if t>0 then s:=s union {t} else break fi od;
             for m while m in s do od;
             b(x,y):= m
          fi
        end:
    seq(a(n), n=0..1000);
  • Mathematica
    fx[n_] := fx[n] = If[n == 1, 0, Function[k, fx[n-1] + Sin[k*Pi/2]][Mod[Floor[Sqrt[4*(n-2)+1]], 4]]]; fy[n_] := fy[n] = If[n == 1, 0, Function[k, fy[n-1] - Cos[k*Pi/2]][Mod[Floor[Sqrt[4*(n-2)+1]], 4]]]; Clear[b]; b[, ] = 0; a[n_] := Module[{x, y, s, i, t, m}, {x, y} = {fx[n+1], fy[n+1]}; If[b[x, y] > 0, b[x, y], s = {};
    For[i=1, True, i++, t=b[x+i, y+i]; If[t>0, s=Union[s,{t}], Break[]]];
    For[i=1, True, i++, t=b[x-i, y-i]; If[t>0, s=Union[s,{t}], Break[]]];
    For[i=1, True, i++, t=b[x+i, y-i]; If[t>0, s=Union[s,{t}], Break[]]];
    For[i=1, True, i++, t=b[x-i, y+i]; If[t>0, s=Union[s,{t}], Break[]]];
    For[i=1, True, i++, t=b[x+i, y  ]; If[t>0, s=Union[s,{t}], Break[]]];
    For[i=1, True, i++, t=b[x-i, y  ]; If[t>0, s=Union[s,{t}], Break[]]];
    For[i=1, True, i++, t=b[x  , y+i]; If[t>0, s=Union[s,{t}], Break[]]];
    For[i=1, True, i++, t=b[x  , y-i]; If[t>0, s=Union[s,{t}], Break[]]];
    m = 1; While[MemberQ[s, m], m++]; b[x, y] = m]]; Table[a[n], {n, 0, 1000}] (* Jean-François Alcover, Nov 14 2016, after Alois P. Heinz *)
  • Python
    class Lines: # manage lines in direction d = dx + dy*1j
        def _init_(self, d):
            self.lines={}; self.t = d.real/d.imag if d.imag else None
        def _call_(self, pos): # Return the line through pos in direction d
            index = pos.imag if self.t is None else pos.real - pos.imag*self.t
            if index not in self.lines: self.lines[index] = Values()
            return self.lines[index]
    class Values(set): # the set of used numbers on a given line
        def next(self, n): # return least k >= n not on this line
            return min(m+1 for m in self if m+1 >= n and m+1 not in self
                       ) if n in self else n
    def A274640(): # generator of the sequence, see below for possible usage
        lines = [Lines(d) for d in (1, 1+1j, 1j, 1-1j)]; pos = 0
        for side in range(9**9):
            for _ in range(side//2 + 1):
                n = 1; lines_here = [L(pos) for L in lines]
                while any(n < (n := L.next(n)) for L in lines_here): pass
                yield n; any(L.add(n) for L in lines_here); pos += 1j**side
    [a for a,A274640(),range(99))%5D%20%23%20_M.%20F.%20Hasler"> in zip(A274640(),range(99))] # _M. F. Hasler, Feb 01 2025

Extensions

Corrected and extended by Alois P. Heinz, Jul 12 2016

A065188 "Greedy Queens" permutation of the positive integers.

Original entry on oeis.org

1, 3, 5, 2, 4, 9, 11, 13, 15, 6, 8, 19, 7, 22, 10, 25, 27, 29, 31, 12, 14, 35, 37, 39, 41, 16, 18, 45, 17, 48, 20, 51, 53, 21, 56, 58, 60, 23, 63, 24, 66, 28, 26, 70, 72, 74, 76, 78, 30, 32, 82, 84, 86, 33, 89, 34, 92, 38, 36, 96, 98, 100, 102, 40, 105, 107, 42, 110, 43, 113
Offset: 1

Views

Author

Antti Karttunen, Oct 19 2001

Keywords

Comments

This permutation is produced by a simple greedy algorithm: starting from the top left corner, walk along each successive antidiagonal of an infinite chessboard and place a queen in the first available position where it is not threatened by any of the existing queens. In other words, this permutation satisfies the condition that p(i+d) <> p(i)+-d for all i and d >= 1.
p(n) = k means that a queen appears in column n in row k. - N. J. A. Sloane, Aug 18 2016
That this is a permutation follows from the proof in A269526 that every row and every column in that array is a permutation of the positive integers. In particular, every row and every column contains a 1 (which translates to a queen in the present sequence). - N. J. A. Sloane, Dec 10 2017
The graph of this sequence shows two straight lines of respective slope equal to the Golden Ratio A001622, Phi = 1+phi = (sqrt(5)+1)/2 and phi = 1/Phi = (sqrt(5)-1)/2. - M. F. Hasler, Jan 13 2018
One has a(42) = 28 and a(43) = 26. Such irregularities make it difficult to get an explicit formula. They would not occur if the squares on the antidiagonals had been checked for possible positions starting from the opposite end, so as to ensure that the subsequences corresponding to the points on either line would both be increasing. Then one would have that a(n-1) is either round(n*phi)+1 or round(n/phi)+1. (The +-1's could all be avoided if the origin were taken as a(0) = 0 instead of a(1) = 1.) Presently most values are such that either round(n*phi) or round(n/phi) does not differ by more than 1 from a(n-1)-1, except for very few exceptions of the above form (a(42) being the first of these). - M. F. Hasler, Jan 15 2018
Equivalently, a(n) is the least positive integer not occurring earlier and so that |a(n)-a(k)| <> |n-k| for all k < n; i.e., fill the first quadrant column by column with lowest possible peaceful queens. - M. F. Hasler, Jan 11 2022

Examples

			The top left corner of the board is:
  +------------------------
  | Q x x x x x x x x x ...
  | x x x Q x x x x x x ...
  | x Q x x x x x x x x ...
  | x x x x Q x x x x x ...
  | x x Q x x x x x x x ...
  | x x x x x x x x x Q ...
  | x x x x x x x x x x ...
  | x x x x x x x x x x ...
  | x x x x x Q x x x x ...
  | ...
which illustrates p(1)=1, p(2)=3, p(3)=5, p(4)=2, etc. - _N. J. A. Sloane_, Aug 18 2016, corrected Aug 21 2016
		

Crossrefs

A065185 gives the associated p(i)-i delta sequence. A065186 gives the corresponding permutation for "promoted rooks" used in Shogi, A065257 gives "Quintal Queens" permutation.
A065189 gives inverse permutation.
See A199134, A275884, A275890, A275891, A275892 for information about the split of points below and above the diagonal.
Cf. A269526.
If we subtract 1 and change the offset to 0 we get A275895, A275896, A275893, A275894.
Tracking at which squares along the successive antidiagonals the queens appear gives A275897 and A275898.
Antidiagonal and diagonal indices give A276324 and A276325.

Programs

  • Maple
    SquareThreatened := proc(a,i,j,upto_n,senw,nesw) local k; for k from 1 to i do if a[k,j] > 0 then RETURN(1); fi; od; for k from 1 to j do if a[i,k] > 0 then RETURN(1); fi; od; if 1 = i and 1 = j then RETURN(0); fi; for k from 1 to `if`((-1 = senw),min(i,j)-1,senw) do if a[i-k,j-k] > 0 then RETURN(1); fi; od; for k from 1 to `if`((-1 = nesw),i-1,nesw) do if a[i-k,j+k] > 0 then RETURN(1); fi; od; for k from 1 to `if`((-1 = nesw),j-1,nesw) do if a[i+k,j-k] > 0 then RETURN(1); fi; od; RETURN(0); end;
    GreedyNonThreateningPermutation := proc(upto_n,senw,nesw) local a,i,j; a := array(1..upto_n,1..upto_n); for i from 1 to upto_n do for j from 1 to upto_n do a[i,j] := 0; od; od; for j from 1 to upto_n do for i from 1 to j do if 0 = SquareThreatened(a,i,(j-i+1),upto_n,senw,nesw) then a[i,j-i+1] := 1; fi; od; od; RETURN(eval(a)); end;
    PM2PL := proc(a,upto_n) local b,i,j; b := []; for i from 1 to upto_n do for j from 1 to upto_n do if a[i,j] > 0 then break; fi; od; b := [op(b),`if`((j > upto_n),0,j)]; od; RETURN(b); end;
    GreedyQueens := upto_n -> PM2PL(GreedyNonThreateningPermutation(upto_n,-1,-1),upto_n);GreedyQueens(256);
    # From Alois P. Heinz, Aug 19 2016: (Start)
    max_diagonal:= 3 * 100: # make this about 3*max number of terms
    h:= proc() true end:   # horizontal line free?
    v:= proc() true end:   # vertical   line free?
    u:= proc() true end:   # up     diagonal free?
    d:= proc() true end:   # down   diagonal free?
    a:= proc() 0 end:      # for A065188
    b:= proc() 0 end:      # for A065189
    for t from 2 to max_diagonal do
       if u(t) then
          for j to t-1 do
            i:= t-j;
            if v(j) and h(i) and d(i-j) then
              v(j),h(i),d(i-j),u(i+j):= false$4;
              a(j):= i;
              b(i):= j;
              break
            fi
          od
       fi
    od:
    seq(a(n), n=1..100); # this is A065188
    seq(b(n), n=1..100); # this is A065189 # (End)
  • Mathematica
    Fold[Function[{a, n}, Append[a, 2 + LengthWhile[Differences@ Union@ Apply[Join, MapIndexed[Select[#2 + #1 {-1, 0, 1}, # > 0 &] & @@ {n - First@ #2, #1} &, a]], # == 1 &]]], {1}, Range[2, 70]] (* Michael De Vlieger, Jan 14 2018 *)
  • PARI
    A065188_first(N, a=List(), u=[0])={for(n=1,N, for(x=u[1]+1,oo, setsearch(u,x) && next; for(i=1,n-1, abs(x-a[i])==n-i && next(2)); u=setunion(u,[x]); while(#u>1 && u[2]==u[1]+1, u=u[^1]); listput(a,x); break));a} \\ M. F. Hasler, Jan 11 2022

Formula

It would be nice to have a formula! - N. J. A. Sloane, Jun 30 2016
a(n) = A275895(n-1)-1. - M. F. Hasler, Jan 11 2022

A274820 Spiral constructed on the nodes of the infinite triangular net in which each term is the least nonnegative integer such that no diagonal contains a repeated term.

Original entry on oeis.org

0, 1, 2, 1, 2, 1, 2, 0, 3, 0, 4, 3, 5, 3, 4, 5, 3, 4, 6, 5, 6, 7, 4, 6, 5, 7, 6, 3, 0, 6, 5, 7, 0, 6, 7, 5, 4, 8, 1, 3, 6, 8, 1, 9, 7, 8, 2, 4, 9, 8, 2, 10, 11, 8, 9, 10, 12, 3, 8, 9, 7, 10, 9, 2, 4, 8, 5, 10, 2, 11, 9, 11, 0, 10, 7, 8, 6, 0, 9, 7, 10, 12, 7, 1, 4, 8, 5, 11, 1, 10, 12, 9, 5, 11, 10, 13, 12, 11, 13, 14
Offset: 0

Views

Author

Omar E. Pol, Jul 09 2016

Keywords

Comments

Also spiral constructed on the infinite hexagonal grid in which each term is the least nonnegative integer such that no diagonal of successive adjacent cells contains a repeated term. Every number is located in the center of a hexagonal cell. Every cell is also the center of three diagonals of successive adjacent cells.
Presumably every line of cells with slope a multiple of 60 degrees (not necessarily passing through the central cell) is a permutation of the nonnegative numbers. See A296343-A296348 for the spokes through the central cell. - N. J. A. Sloane, Dec 12 2017

Examples

			Illustration of initial terms as a spiral:
.
.                   9 - 4 - 2 - 8 - 7
.                  /                 \
.                 8   3 - 6 - 7 - 5   9
.                /   /             \   \
.               2   0   5 - 3 - 4   6   1
.              /   /   /         \   \   \
.            10   6   3   1 - 2   0   4   8
.            /   /   /   /     \   \   \   \
.          11   5   4   2   0 - 1   3   7   6
.            \   \   \   \         /   /   /
.             8   7   5   1 - 2 - 0   6   3
.              \   \   \             /   /
.               9   0   3 - 4 - 6 - 5   1
.                \   \                 /
.                10   6 - 7 - 5 - 4 - 8
.                  \
.                  12 - 3 - 8 - 9 - 7
.
		

Crossrefs

Cf. A001477, A269526, A274528 (square array), A274641 (spiral on the square grid), A274650 (right triangle), A274821, A274920, A274921, A275606, A275610, A296339.
A296342 says when n first appears.
See A296343-A296348 for the spokes.

Programs

  • PARI
    See Links section.

Formula

a(n) = A274821(n) - 1.
Previous Showing 11-20 of 50 results. Next