

A352426


Maximal number of nonattacking whitesquare queens on an n X n chessboard.


3



0, 1, 1, 2, 4, 4, 4, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13, 13, 14, 15, 16, 17, 18, 18, 19, 20, 21, 21, 22, 23, 24, 25, 26, 26, 27, 28, 29, 29, 30, 31, 32, 33, 33, 34, 35, 36, 36, 37, 38, 39, 40, 40, 41, 42, 43, 44, 44, 45, 46, 47, 48, 48, 49, 50, 51, 51, 52, 53
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,4


COMMENTS

Equivalently the maximal number of nonattacking blacksquare queens on an inverted n X n chessboard, that is a board with the a1 square white, the a2 and b1 squares black, etc.


LINKS



FORMULA



PROG

(Python)
def fill(rows, queens, leftattack, notdownattack, rightattack, color):
global c
available = ~leftattack & notdownattack & ~rightattack & color
if rows==1:
if available==0:
c[queens] = c.get(queens, 0) + 1
else:
c[queens+1] = c.get(queens+1, 0) + bin(available).count('1')
return
while available:
attack = available & available
fill(rows1, queens+1, (leftattackattack)<<1, notdownattack&~attack, (rightattackattack)>>1, ~color)
available &= available  1
fill(rows1, queens, leftattack<<1, notdownattack, rightattack>>1, ~color)
print(' n a(n) count')
for n in range(1, 32):
c=dict()
fill(n, 0, 0, (1<<n)1, 0, 0x2AAAAAAA)
c[0] = 0; m = max(c.keys())
print('%(argument)2d %(value)4d %(count)8d' % {"argument" : n, "value" : m, "count" : c[m]})


CROSSREFS



KEYWORD

nonn,more


AUTHOR



EXTENSIONS



STATUS

approved



