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
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.
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
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
First 20 terms taken from the Example section of
A269526.
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
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
Cf.
A000330 (square pyramidal numbers).
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
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
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
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
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
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
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, ...
- Alois P. Heinz, Table of n, a(n) for n = 0..20000
- F. Michel Dekking, Jeffrey Shallit, and N. J. A. Sloane, Queens in exile: non-attacking queens on infinite chess boards, Electronic J. Combin., 27:1 (2020), #P1.52.
- Alois P. Heinz, Distribution of a(n) for n <= 4010000
- Kerry Mitchell, Color-coded version of spiral, (1): the colors represent the values, from black (small) to white (large) (jpg file, low resolution)
- Kerry Mitchell, Color-coded version of spiral, (1a): the colors represent the values, from black (small) to white (large) (tiff file, much higher resolution)
- Kerry Mitchell, Color-coded version of spiral, (2): values <= 100 are black and those > 100 are white.
- Zak Seidov, Distribution of a(n) for first 20001 terms
In the same spirit as the infinite Sudoku array
A269526.
Cf.
A274821 (the same construction on a hexagonal tiling).
-
# 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);
-
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 *)
-
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
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
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
- Alois P. Heinz, Table of n, a(n) for n = 1..10000
- F. Michel Dekking, Jeffrey Shallit, and N. J. A. Sloane, Queens in exile: non-attacking queens on infinite chess boards, Electronic J. Combin., 27:1 (2020), #P1.52.
- Matteo Fischetti and Domenico Salvagnin, Chasing First Queens by Integer Programming, 2018.
- Matteo Fischetti and Domenico Salvagnin, Finding First and Most-Beautiful Queens by Integer Programming, arXiv:1907.08246 [cs.DS], 2019.
- N. J. A. Sloane, Scatterplot of first 100 terms
- N. J. A. Sloane, Table of n, a(n) for n = 1..50000 [Obtained using the Maple program of _Alois P. Heinz_]
- Index entries for sequences that are permutations of the natural numbers
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.
Tracking at which squares along the successive antidiagonals the queens appear gives
A275897 and
A275898.
-
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)
-
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 *)
-
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
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
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
.
- Rémy Sigrist, Table of n, a(n) for n = 0..120400
- F. Michel Dekking, Jeffrey Shallit, and N. J. A. Sloane, Queens in exile: non-attacking queens on infinite chess boards, Electronic J. Combin., 27:1 (2020), #P1.52.
- Rémy Sigrist, PARI program for A274820
- Rémy Sigrist, Colored illustration of the first 200 windings of the spiral (where the color is a function of a(n))
- N. J. A. Sloane, Illustration of initial terms drawn as a spiral on the hexagonal grid (the starting cell is marked in black).
Cf.
A001477,
A269526,
A274528 (square array),
A274641 (spiral on the square grid),
A274650 (right triangle),
A274821,
A274920,
A274921,
A275606,
A275610,
A296339.
Comments