This answer is to confirm the above results by a backtracking algorithm that can easily be generalized e.g. to the $n$-queens problem. The principle is extremely simple: place rooks on the board one after another as long as there are no conflicts.
Here is the Perl code:
#! /usr/bin/perl -w
#
use warnings;
no warnings 'recursion';
sub search {
my ($n, $black_or_white, $rptr, $count) = @_;
my $current = scalar(@$rptr);
if($current == $n){
$$count++;
for(my $row = 0; $row < $n; $row++){
for(my $col = 0; $col < $n; $col++){
if($rptr->[$col] == $row){
printf " * ";
}
else{
printf " . ";
}
}
printf "\n";
}
printf "\n";
return;
}
my $par = ($black_or_white eq 'black' ? 1 : 0);
for(my $row = ($par+$current)%2; $row < $n; $row += 2){
my $accept = 'yes';
for(my $pos = 0; $pos < $current; $pos++){
if($rptr->[$pos] == $row){
$accept = undef;
last;
}
}
if(defined($accept)){
push @$rptr, $row;
search($n, $black_or_white, $rptr, $count);
pop @$rptr;
}
}
1;
}
MAIN: {
my $n = shift || 4;
if($n<1 || $n !~ /^\d+$/){
print STDERR "integer argument please\n";
exit -1;
}
my @rooks = ();
my $total = 0;
search($n, 'white', \@rooks, \$total);
printf "%d solutions found (%d x %d, white)\n\n",
$total, $n, $n;
$total = 0;
search($n, 'black', \@rooks, \$total);
printf "%d solutions found (%d x %d, black)\n\n",
$total, $n, $n;
exit 0;
}
We can use this to produce a table of values, which confirms the results from the other users.
#! /usr/bin/perl -w
#
my $mx = shift || 12;
for(my $n=1; $n<=$mx; $n++){
my $cmd = "./rooks.pl $n | grep solutions";
system $cmd;
printf "\n";
}
This produces the following table:
1 solutions found (1 x 1, white)
0 solutions found (1 x 1, black)
1 solutions found (2 x 2, white)
1 solutions found (2 x 2, black)
2 solutions found (3 x 3, white)
0 solutions found (3 x 3, black)
4 solutions found (4 x 4, white)
4 solutions found (4 x 4, black)
12 solutions found (5 x 5, white)
0 solutions found (5 x 5, black)
36 solutions found (6 x 6, white)
36 solutions found (6 x 6, black)
144 solutions found (7 x 7, white)
0 solutions found (7 x 7, black)
576 solutions found (8 x 8, white)
576 solutions found (8 x 8, black)
2880 solutions found (9 x 9, white)
0 solutions found (9 x 9, black)
14400 solutions found (10 x 10, white)
14400 solutions found (10 x 10, black)
86400 solutions found (11 x 11, white)
0 solutions found (11 x 11, black)
518400 solutions found (12 x 12, white)
518400 solutions found (12 x 12, black)
We can confirm the pattern for odd values (white), which seems to be
$$((n-1)/2)!*((n-1)/2+1)!.$$