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 28 results. Next

A275898 Read the infinite chessboard underlying A065188 by successive antidiagonals and record when the queens are encountered. Here the rows and columns are indexed starting at 1 (as in A065188).

Original entry on oeis.org

1, 8, 14, 24, 33, 97, 115, 143, 164, 184, 198, 262, 291, 447, 485, 582, 609, 796, 846, 920, 973, 1019, 1053, 1195, 1256, 1465, 1562, 1734, 1808, 1915, 1993, 2105, 2321, 2388, 2584, 2956, 3052, 3290, 3353, 3603, 3709, 3972, 4040, 4314, 4430, 4523, 4597, 5089, 5317, 5606, 5845, 6174, 6372
Offset: 1

Views

Author

N. J. A. Sloane, Aug 23 2016, following a suggestion from David A. Corneth

Keywords

Examples

			The second queen appears in the fourth antidiagonal at position 8 (calling the top left square square 1):
Qxxx
xxxQ
xQxx
xxxx
so a(2) = 8.
		

Crossrefs

A065185 The delta sequence p(i)-i for the "Greedy Queens" permutation A065188. Each queen at file n is situated at rank n+a(n).

Original entry on oeis.org

0, 1, 2, -2, -1, 3, 4, 5, 6, -4, -3, 7, -6, 8, -5, 9, 10, 11, 12, -8, -7, 13, 14, 15, 16, -10, -9, 17, -12, 18, -11, 19, 20, -13, 21, 22, 23, -15, 24, -16, 25, -14, -17, 26, 27, 28, 29, 30, -19, -18, 31, 32, 33, -21, 34, -22, 35, -20, -23, 36, 37, 38, 39, -24, 40, 41, -25, 42, -26, 43, -27, 44, 45, 46, -29, 47, -30, -28, 48
Offset: 1

Views

Author

Antti Karttunen, Oct 19 2001

Keywords

Programs

  • Maple
    [seq(A065188[n]-n,n=1..196)];

A294428 Terms of A065188 that are below the main diagonal.

Original entry on oeis.org

2, 4, 6, 8, 7, 10, 12, 14, 16, 18, 17, 20, 21, 23, 24, 28, 26, 30, 32, 33, 34, 38, 36, 40, 42, 43, 44, 46, 47, 50, 49, 52, 54, 55, 57, 59, 61, 62, 65, 64, 67, 68, 69, 71, 75, 73, 77, 79, 81, 80, 83, 85, 87, 88, 91, 90, 93, 95, 94, 97, 99, 101, 103, 104
Offset: 1

Views

Author

N. J. A. Sloane, Nov 06 2017, based on an email from Don Knuth, Oct 31 2017

Keywords

Comments

This gives another way to view A199134. In fact, a(n) = A065188(A199134(n)).

Crossrefs

A294427 Terms of A065188 that are on or above the main diagonal.

Original entry on oeis.org

1, 3, 5, 9, 11, 13, 15, 19, 22, 25, 27, 29, 31, 35, 37, 39, 41, 45, 48, 51, 53, 56, 58, 60, 63, 66, 70, 72, 74, 76, 78, 82, 84, 86, 89, 92, 96, 98, 100, 102, 105, 107, 110, 113, 116, 118, 120, 123, 127, 130, 132, 134, 136, 140, 142, 144, 148, 150, 152, 155
Offset: 1

Views

Author

N. J. A. Sloane, Nov 06 2017, based on an email from Don Knuth, Oct 31 2017

Keywords

Comments

This gives another way to view A275884. In fact, a(n) = A065188(A275884(n)).

Crossrefs

A269526 Square array T(n,k) (n>=1, k>=1) read by antidiagonals upwards in which each term is the least positive integer satisfying the condition that no row, column, diagonal, or antidiagonal contains a repeated term.

Original entry on oeis.org

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

Views

Author

Alec Jones, Apr 07 2016

Keywords

Comments

An infinite Sudoku-type array.
In the definition, "diagonal" means a diagonal line of slope -1, and "antidiagonal" means a diagonal line of slope +1.
Theorem C (Bob Selcoe, Jul 01 2016): Every column is a permutation of the natural numbers.
Proof: Fix k, and suppose j is the smallest number missing from that column. For this to happen, every entry T(n,k) for sufficiently large n in that column must see a j in the NW diagonal through that cell or in the row to the W of that cell. But there are at most k-1 copies of j in the columns to the left of the k-th column, and if n is very large the entry T(n,k) will be unaffected by those j's, and so T(n,k) would then be set to j, a contradiction. QED
Theorem R (Rob Pratt, Bob Selcoe, N. J. A. Sloane, Jul 02 2016): Every row is a permutation of the natural numbers.
Proof: Fix n, and suppose j is the smallest number missing from that row. For this to happen, every entry T(n,k) for sufficiently large k in that row must see a j in the column to the N, or in the NW diagonal through that cell or in the SW diagonal through that cell.
Rows 1 through n-1 contain at most n-1 copies of j, and their influence on the entries in the n-th row only extend out to the entry T(n,k_0), say. We take k to be much larger than k_0 and consider the entry T(n,k). We will show that for large enough k it can (and therefore must) be equal to j, which is a contradiction.
Consider the triangle bounded by row n, column 1, and the SW antidiagonal through cell (n,k). Replace every copy of j in this triangle by a queen and think of these cells as a triangular chessboard. These are non-attacking queens, by definition of the sequence, and by the result in A274616 there can be at most 2*k/3 + 1 such queens. However, there are k-k_0 cells in row n that have to be attacked, and for large k this is impossible since k-k_0 > 2*k/3+1. If a cell (n,k) is not attacked by a queen, then T(n,k) can take the value j. QED
Presumably every diagonal is also a permutation of the natural numbers, but the proof does not seem so straightforward. Of course the antidiagonals are not permutations of the natural numbers, since they are finite in length. - N. J. A. Sloane, Jul 02 2016
For an interpretation of this array in terms of Sprague-Grundy values, see A274528.
From Don Reble, Jun 30 2016: (Start)
Let b(n) be the position in column n where 1 appears, i.e., such that T(b(n),n) = 1. Then b(n) is A065188, which is Antti Karttunen's "Greedy Queens" permutation.
Let b'(n) be the position in row n where 1 appears, i.e., such that T(n,b'(n)) = 1. Then b'(n) is A065189, the inverse "Greedy Queens" permutation. (End)
The same sequence arises if we construct a triangle, by reading from left to right in each row, always choosing the smallest positive number which does not produce a duplicate number in any row or diagonal. - N. J. A. Sloane, Jul 02 2016
It appears that the numbers generally appear for the first time in or near the first few rows. - Omar E. Pol, Jul 03 2016
The last comment in the FORMULA section seems wrong: It seems that columns 4, 5, 6, 7, 8, 9, ...(?) all have first differences which become 16-periodic from, respectively, term 8, 17, 52, 91, 92, 131, ... on, rather than having period 4^(k-1) from term k on. - M. F. Hasler, Sep 26 2022

Examples

			The array is constructed along its antidiagonals, in the following way:
  a(1)  a(3)  a(6)  a(10)
  a(2)  a(5)  a(9)
  a(4)  a(8)
  a(7)
See the link from Peter Kagey for an animated example.
The beginning of the square array is:
   1,  3,  2,  6,  4,  5, 10, 11, 13,  8, 14, 18,  7, 20, 19,  9, 12, ...
   2,  4,  5,  1,  8,  3,  6, 12, 14, 16,  7, 15, 17,  9, 22, 21, 11, ...
   3,  1,  6,  2,  9,  7,  5,  4, 15, 17, 12, 19, 18, 21,  8, 10, 23, ...
   4,  2,  3,  5,  1,  8,  9,  7, 16,  6, 18, 17, 11, 10, 23, 22, 14, ...
   5,  7,  1,  4,  2,  6,  3, 15,  9, 10, 13,  8, 20, 14, 12, 11, 17, ...
   6,  8,  9,  7,  5, 10,  4, 16,  2,  1,  3, 11, 22, 15, 24, 13, 27, ...
   7,  5,  4,  3,  6, 14,  8,  9, 11, 18,  2, 21,  1, 16, 10, 12, 20, ...
   8,  6,  7,  9, 11,  4, 13,  3, 12, 15,  1, 10,  2,  5, 26, 14, 18, ...
   9, 11,  8, 10,  3,  1, 14,  6,  7, 13,  4, 12, 24, 18,  2,  5, 19, ...
  10, 12, 13, 11, 16,  2, 17,  5, 20,  9,  8, 14,  4,  6,  1,  7,  3, ...
  11,  9, 14, 12, 10, 15,  1,  8, 21,  7, 16, 20,  5,  3, 18, 17, 32, ...
  12, 10, 11,  8,  7,  9,  2, 13,  5, 23, 25, 26, 14, 17, 16, 15, 33, ...
...
  - _N. J. A. Sloane_, Jun 29 2016
		

Crossrefs

First 4 rows are A274315, A274316, A274317, A274791.
Main diagonal is A274318.
Column 1 is A000027, column 2 is A256008(n) = A004443(n-1)+1 = 1 + (nimsum of n-1 and 2), column 3 is A274614 (or equally, A274615 + 1), and column 4 is A274617 (or equally, A274619 + 1).
Antidiagonal sums give A274530. Other properties of antidiagonals: A274529, A275883.
Cf. A274080 (used in Haskell program), A274616.
A065188 and A065189 say where the 1's appear in successive columns and rows.
If all terms are reduced by 1 and the offset is changed to 0 we get A274528.
A274650 and A274651 are triangles in the shape of a right triangle and with a similar definition.
See A274630 for the case where both queens' and knights' moves must avoid duplicates.

Programs

  • Haskell
    import Data.List ((\\))
    a269526 n = head $ [1..] \\ map a269526 (a274080_row n)
    -- Peter Kagey, Jun 10 2016
    
  • Maple
    # The following Maple program was provided at my request by Alois P. Heinz, who said that he had not posted it himself because it stores the data in an inefficient way. - N. J. A. Sloane, Jul 01 2016
    A:= proc(n, k) option remember; local m, s;
             if n=1 and k=1 then 1
           else s:= {seq(A(i,k), i=1..n-1),
                     seq(A(n,j), j=1..k-1),
                     seq(A(n-t,k-t), t=1..min(n,k)-1),
                     seq(A(n+j,k-j), j=1..k-1)};
                for m while m in s do od; m
             fi
         end:
    [seq(seq(A(1+d-k, k), k=1..d), d=1..15)];
  • Mathematica
    A[n_, k_] := A[n, k] = If[n == 1 && k == 1, 1, s = {Table[A[i, k], {i, 1, n-1}], Table[A[n, j], {j, 1, k-1}], Table[A[n-t, k-t], {t, 1, Min[n, k] - 1}], Table[A[n+j, k-j], {j, 1, k-1}]} // Flatten; For[m = 1, True, m++, If[FreeQ[s, m], Return[m]]]];
    Table[Table[A[1+d-k, k], {k, 1, d}], {d, 1, 15}] // Flatten (* Jean-François Alcover, Jul 21 2016, translated from Maple *)
  • PARI
    {M269526=Map(); A269526=T(r,c)=c>1 && !mapisdefined(M269526, [r,c], &r) && mapput(M269526, [r,c], r=sum(k=1, #c=Set(concat([[T(r+k,c+k)|k<-[1-min(r, c)..-1]], [T(r,k)|k<-[1..c-1]], [T(k,c)|k<-[1..r-1]], [T(r+c-k,k)|k<-[1..c-1]]])), c[k]==k)+1); r} \\ M. F. Hasler, Sep 26 2022

Formula

Theorem 1: T(n,1) = n.
Proof by induction. T(1,1)=1 by definition. When calculating T(n,1), the only constraint is that it be different from all earlier entries in the first column, which are 1,2,3,...,n-1. So T(n,1)=n. QED
Theorem 2 (Based on a message from Bob Selcoe, Jun 29 2016): Write n = 4t+i with t >= 0, i=1,2,3, or 4. Then T(n,2) = 4t+3 if i=1, 4t+4 if i=2, 4t+1 if i=3, 4t+2 if i=4. This implies that the second column is the permutation A256008.
Proof: We check that the first 4 entries in column 2 are 2,5,6,3. From then on, to calculate the entry T(n,2), we need only look to the N, NW, W, and SW (we need never look to the East). After we have found the first 4t entries in the column, the column contains all the numbers from 1 to 4t. The four smallest free numbers are 4t+1, 4t+2, 4t+3, 4t+4. Entry T(4t+1,2) cannot be 4t+1 or 4t+2, but it can (and therefore must) be 4t+3. Similarly T(4t+2,2)=4t+4, T(4t+3,2)=4t+1, and T(4t+4,2)=4t+2. The column now contains all the numbers from 1 to 4t+4. Repeating this argument established the theorem. QED
Comments from Bob Selcoe, Jun 29 2016: (Start)
From Theorem 2, column 2 (i.e., terms a((j^2+j+4)/2), j>=1) is a permutation. After a(3)=3, the differences of successive terms follow the pattern a(n) = 3 [+1, -3, +1, +5], so a(5)=4, a(8)=1, a(12)=2, a(17)=7, a(23)=8, a(30)=5...
Similarly, column 3 (i.e., terms a((j^2+j+6)/2), j>=2) appears to be a permutation, but with the pattern after a(6)=2 and a(9)=5 being 5 [+1, -3, -2, +8, -5, +3, +1, +5, +1, -3, +1, -2, +8, -3, +1, +5]. (See A274614 and A274615.)
I conjecture that other similar cyclical difference patterns should hold for any column k (i.e., terms a((j^2+j+2*k)/2), j>=k-1), so that each column is a permutation.
Also, the differences in column 1 are a 1-cycle ([+1]), in column 2 a 4-cycle after the first term, and in column 3 a 16-cycle after the second term. Perhaps the cycle lengths are 4^(k-1) starting after j=k-1. (End) WARNING: These comments may be wrong - see COMMENTS section. - N. J. A. Sloane, Sep 26 2022

Extensions

Definition clarified by Omar E. Pol, Jun 29 2016

A273059 Positions of 1's in A274640: Greedy Queens on a spiral. Equivalently, positions of 0's in A274641.

Original entry on oeis.org

0, 9, 13, 17, 21, 82, 92, 102, 112, 228, 244, 260, 276, 445, 467, 489, 511, 630, 656, 682, 708, 967, 999, 1031, 1063, 1377, 1415, 1453, 1491, 1858, 1902, 1946, 1990, 2411, 2461, 2511, 2561, 3037, 3093, 3149, 3205, 3734, 3796, 3858, 3920, 4239, 4305, 4371, 4437, 5056, 5128, 5200, 5272, 5946
Offset: 0

Views

Author

Zak Seidov, Jul 14 2016

Keywords

Comments

What is the reason for the three "lines" in the graph of first differences (see link, also A275915)?
Apparently they are related to the fact that "ones" are concentrated along two main diagonals of the spiral A274640, see the graph "Spiral A274640 with ones shown".
This is the Greedy Queens construction on a spiral (cf. A065188). Follow a counterclockwise spiral starting at the origin, and place a queen iff it is not attacked by any existing queen. This same problem is described in a different but equivalent way in A140100 and A140101. See A140101 for a conjectured recurrence which underlies all these sequences. - N. J. A. Sloane, Aug 28-30, 2016

Crossrefs

Cf. A274640, A065188, A275915 (first differences).
The four spokes are A275916, A275917, A275918, A275919.
A140100 and A140101 describe this same problem in a different way.

Programs

  • Maple
    # see link above
  • Mathematica
    fx[n_] := fx[n] = If[n == 1, 0, fx[n - 1] + Sin[#*Pi/2]& @ Mod[Floor[Sqrt[ 4*(n - 2) + 1]], 4]];
    fy[n_] := fy[n] = If[n == 1, 0, fy[n - 1] - Cos[k*Pi/2]& @ Mod[Floor[Sqrt[ 4*(n - 2) + 1]], 4]];
    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]];
    Flatten[Position[a /@ Range[0, 10^4], 1]] - 1 (* Jean-François Alcover, Feb 25 2020, after Alois P. Heinz *)

Formula

A274640(a(n)) = 1 (this is simply a restatement of the definition).

Extensions

Offset changed to 0 by N. J. A. Sloane, Aug 31 2016

A275901 Following the successive antidiagonals in A275895, let the n-th queen appear in square (x(n),y(n)); sequence gives x(n).

Original entry on oeis.org

0, 1, 3, 2, 4, 5, 9, 6, 10, 12, 7, 8, 14, 11, 19, 20, 13, 15, 25, 16, 26, 28, 17, 18, 30, 33, 21, 22, 37, 23, 39, 24, 42, 41, 27, 29, 48, 49, 31, 32, 53, 55, 34, 35, 58, 57, 36, 38, 63, 40, 66, 68, 43, 70, 44, 45, 74, 46, 76, 47, 77, 79, 50, 51, 84, 52, 85, 54, 89, 90, 56, 94, 59, 60, 98, 61, 100, 62
Offset: 0

Views

Author

N. J. A. Sloane, Aug 24 2016

Keywords

Comments

See A275902 for y(n).
This is a permutation of the nonnegative numbers.
This assumes the indexing starts at 0. See A275899, A275900 if the indexing begins at 1.

Crossrefs

Programs

  • Maple
    See A275899.
    # Alternative Maple program from N. J. A. Sloane, Oct 03 2016
    # To get 10000 terms of A275902 (xx), A275901 (yy), A276783 (ss), -A276325 (dd)
    M1:=100000; M2:=22000; M3:=10000;
    xx:=Array(0..M1,0); yy:=Array(0..M1,0); ss:=Array(0..M1,0); dd:=Array(0..M1,0);
    xx[0]:=0; yy[0]:=0; ss[0]:=0; dd[0]:=0;
    for n from 1 to M2 do
    sw:=-1;
       for s from ss[n-1]+1 to M2 do
          for i from 0 to s do
             x:=s-i; y:=i;
             if not member(x,xx,'p') and
                not member(y,yy,'p') and
                not member(x-y,dd,'p') then sw:=1; break; fi;
          od:  # od i
    if sw=1 then break; fi;
       od: # od s
      if sw=-1 then lprint("error, n=",n); break; fi;
    xx[n]:=x; yy[n]:=y; ss[n]:=x+y; dd[n]:=x-y;
    od: # od n
    [seq(xx[i],i=0..M3)]:
    [seq(yy[i],i=0..M3)]:
    [seq(ss[i],i=0..M3)]:
    [seq(dd[i],i=0..M3)]:

A065186 a(1)=1, a(2)=3, a(3)=5, a(4)=2, a(5)=4; for n > 5, a(n) = a(n-5) + 5.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Oct 19 2001

Keywords

Comments

"Greedy Dragons" permutation of the natural numbers, inverse of A065187.
This permutation is produced by a simple greedy algorithm: walk along each successive antidiagonal of an infinite array and place a Shoogi dragon piece (i.e., the "promoted" rook, Ryuu, that moves like a chess rook, but can also move one square diagonally) in the first available position where it is not threatened by any dragon already placed.
I.e., this permutation satisfies the condition that p(i+1) != p(i)+-1 for all i.
Alternatively, this is obtained directly if n-1 is converted to base 5, the least significant digit is doubled (modulo 5, i.e., 0->0, 1->2, 2->4, 3->1, 4->3) and one is added back to the resulting number.
a(1) = 1, a(n) = smallest number such that no two successive terms differ by 1 and no two terms are equal. - Amarnath Murthy, May 06 2003
This is also the lexicographic first positive sequence such that the distance between any subsequent terms, |a(n+1)-a(n)|, is a prime number and no number occurs twice, with a(1) = 1: A variant of A277618, which obeys the same rules but starts with a(0) = 0; and of A277617, which is defined similarly with squares > 1 instead of primes. - M. F. Hasler, Oct 23 2016

Crossrefs

"Greedy Queens" and "Quintal Queens" permutations: A065188, A065257.
Cf. A065186.

Programs

  • Maple
    [seq(GreedyDragonsDirect(j),j=1..125)]; GreedyDragonsDirect := n -> n + ((n-1) mod 5) - 5*(floor((n-1 mod 5)/3));
    Or empirically, by using the algorithm given at A065188: GreedyDragons := upto_n -> PM2PL(GreedyNonThreateningPermutation(upto_n,1,1),upto_n);
  • Mathematica
    RecurrenceTable[{a[1] == 1, a[2] == 3, a[3] == 5, a[4] == 2, a[5] == 4, a[n] == a[n - 5] + 5}, a, {n, 80}] (* or *) LinearRecurrence[{1, 0, 0, 0, 1, -1}, {1, 3, 5, 2, 4, 6}, 80] (* Harvey P. Dale, Mar 11 2012 *)
    Flatten[Table[5n + {1, 3, 5, 2, 4}, {n, 0, 14}]] (* Alonso del Arte, Jul 25 2017 *)
  • PARI
    { for (n=1, 1000, if (n>5, a=a5 + 5; a5=a4; a4=a3; a3=a2; a2=a1; a1=a, if (n==1, a=a5=1, if (n==2, a=a4=3, if (n==3, a=a3=5, if (n==4, a=a2=2, a=a1=4))))); write("b065186.txt", n, " ", a) ) } \\ Harry J. Smith, Oct 13 2009
    
  • PARI
    n=1;v=[n];while(n<200,if(isprime(abs(n-v[#v]))&&!vecsearch(vecsort(v),n),v=concat(v,n);n=1);n++);v \\ Derek Orr, Jul 24 2017
    
  • PARI
    a(n) = n--; [1,3,5,2,4][n%5+1]+5*(n\5) \\ David A. Corneth, Jul 24 2017
    
  • PARI
    first(n) = my(v = [1,3,5,2,4]); if(n < 5, return(vector(n, i, v[i])), v = concat(v, vector(n-5))); for(i=6, n, v[i]=5 + v[i-5]); v \\ David A. Corneth, Jul 24 2017
    
  • PARI
    nxt(n) = if(n%5, n+2, n-3) \\ David A. Corneth, Jul 24 2017

Formula

a(n) = n + ((n-1) mod 5) - 5*(floor(((n-1) mod 5)/3)).
G.f.: x*(x^5 + 2*x^4 - 3*x^3 + 2*x^2 + 2*x + 1)/((x - 1)*(x^5 - 1))
a(n) = a(n-1) + a(n-5) - a(n-6), with n>6, a(1)=1, a(2)=3, a(3)=5, a(4)=2, a(5)=4, a(6)=6. - Harvey P. Dale, Mar 11 2012

A275895 "Greedy Queens" permutation of the nonnegative integers.

Original entry on oeis.org

0, 2, 4, 1, 3, 8, 10, 12, 14, 5, 7, 18, 6, 21, 9, 24, 26, 28, 30, 11, 13, 34, 36, 38, 40, 15, 17, 44, 16, 47, 19, 50, 52, 20, 55, 57, 59, 22, 62, 23, 65, 27, 25, 69, 71, 73, 75, 77, 29, 31, 81, 83, 85, 32, 88, 33, 91, 37, 35, 95, 97, 99, 101, 39, 104, 106, 41, 109, 42, 112, 43, 115, 117, 119, 45, 122
Offset: 0

Views

Author

N. J. A. Sloane, Aug 23 2016

Keywords

Comments

This permutation is produced by a simple greedy algorithm: starting from the top left corner of an infinite chessboard placed in the fourth quadrant of the plane, walk along successive antidiagonals 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.
The rows and columns are indexed starting at 0. p(n) = k means that a queen appears in column n in row k. - N. J. A. Sloane, Aug 18 2016
All of A065188 (same for positive integers), A065189, A199134, A275884 should really have started at 0 rather than 1. Then the graph of A065188, for example, would be comparable with the graph of A002251.
That this is a permutation of the nonnegative integers 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 0 (which translates to a queen in the present sequence). - N. J. A. Sloane, Dec 10 2017

Crossrefs

Cf. A065188 (same for positive integers), A065189 (it's inverse), A199134 (indices of a(n) < n), A275884 (complement), A275894 (same for "nonnegative", i.e., this sequence), A275896 (same for A065189), A002251 (Wythoff pairs).

Formula

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

A275902 Following the successive antidiagonals in A275895, let the n-th queen appear in square (x(n),y(n)); sequence gives y(n).

Original entry on oeis.org

0, 2, 1, 4, 3, 8, 5, 10, 7, 6, 12, 14, 9, 18, 11, 13, 21, 24, 15, 26, 17, 16, 28, 30, 19, 20, 34, 36, 22, 38, 23, 40, 25, 27, 44, 47, 29, 31, 50, 52, 32, 33, 55, 57, 35, 37, 59, 62, 39, 65, 41, 42, 69, 43, 71, 73, 45, 75, 46, 77, 49, 48, 81, 83, 51, 85, 53, 88, 54, 56, 91, 58, 95, 97, 60, 99, 61, 101
Offset: 0

Views

Author

N. J. A. Sloane, Aug 24 2016

Keywords

Comments

See A275901 for x(n).
This is a permutation of the nonnegative numbers.
This assumes the indexing starts at 0. See A275899, A275900 if the indexing begins at 1.

Crossrefs

Programs

  • Maple
    See A275899.
    # Alternative Maple program from N. J. A. Sloane, Oct 03 2016
    # To get 10000 terms of A275902 (xx), A275901 (yy), A276783 (ss), -A276325 (dd)
    M1:=100000; M2:=22000; M3:=10000;
    xx:=Array(0..M1,0); yy:=Array(0..M1,0); ss:=Array(0..M1,0); dd:=Array(0..M1,0);
    xx[0]:=0; yy[0]:=0; ss[0]:=0; dd[0]:=0;
    for n from 1 to M2 do
    sw:=-1;
       for s from ss[n-1]+1 to M2 do
          for i from 0 to s do
             x:=s-i; y:=i;
             if not member(x,xx,'p') and
                not member(y,yy,'p') and
                not member(x-y,dd,'p') then sw:=1; break; fi;
          od:  # od i
    if sw=1 then break; fi;
       od: # od s
      if sw=-1 then lprint("error, n=",n); break; fi;
    xx[n]:=x; yy[n]:=y; ss[n]:=x+y; dd[n]:=x-y;
    od: # od n
    [seq(xx[i],i=0..M3)]:
    [seq(yy[i],i=0..M3)]:
    [seq(ss[i],i=0..M3)]:
    [seq(dd[i],i=0..M3)]:
Previous Showing 11-20 of 28 results. Next