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-6 of 6 results.

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)]:

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)]:

A275897 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 0 (as in A275895).

Original entry on oeis.org

0, 7, 13, 23, 32, 96, 114, 142, 163, 183, 197, 261, 290, 446, 484, 581, 608, 795, 845, 919, 972, 1018, 1052, 1194, 1255, 1464, 1561, 1733, 1807, 1914, 1992, 2104, 2320, 2387, 2583, 2955, 3051, 3289, 3352, 3602, 3708, 3971, 4039, 4313, 4429, 4522, 4596, 5088, 5316, 5605, 5844, 6173, 6371
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 7 (calling the top left square square 0):
Qxxx
xxxQ
xQxx
xxxx
so a(2) = 7.
		

Crossrefs

Programs

  • Maple
    # Let b8 be a list of the terms of A065188.
    ts:=[];
    for n from 1 to 130 do
    ta:=b8[n];
    tb:=n-1+(ta+n-2)*(ta+n-1)/2;
    ts:=[op(ts),tb]; od:
    tt:=sort(ts); # A275897
    tu:=map(x->x+1,tt); # A275898
  • Mathematica
    b8 = Cases[Import["https://oeis.org/A065188/b065188.txt", "Table"], {, }][[All, 2]];
    ts = {};
    For[n = 1, n <= 130, n++, ta = b8[[n]]; tb = n - 1 + (ta + n - 2)*(ta + n - 1)/2; ts = Append[ts, tb]];
    Sort[ts] (* Jean-François Alcover, Feb 27 2020, from Maple *)

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

A275896 a(n) = A065189(n+1)-1.

Original entry on oeis.org

0, 3, 1, 4, 2, 9, 12, 10, 5, 14, 6, 19, 7, 20, 8, 25, 28, 26, 11, 30, 33, 13, 37, 39, 15, 42, 16, 41, 17, 48, 18, 49, 53, 55, 21, 58, 22, 57, 23, 63, 24, 66, 68, 70, 27, 74, 76, 29, 79, 77, 31, 84, 32, 85, 89, 34, 90, 35, 94, 36, 98, 100, 38, 103, 101, 40, 107, 110, 112, 43, 115, 44, 119, 45, 116, 46
Offset: 0

Views

Author

N. J. A. Sloane, Aug 23 2016

Keywords

Comments

All of A065188, 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.

Crossrefs

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

Showing 1-6 of 6 results.