The Monk might have placed dogs in the kennels in two thousand nine
hundred and twenty-six different ways, so that there should be ten dogs
on every side. The number of dogs might vary from twenty to forty, and
as long as the Monk kept his animals within these limits the thing was
always possible.
The general solution to this puzzle is difficult. I find that for _n_
dogs on every side of the square, the number of different ways is (_n_^4
+ 10_n_^3 + 38_n_^2 + 62_n_ + 33) / 48, where _n_ is odd, and ((_n_^4 +
10_n_^3 + 38_n_^2 + 68_n_) / 48) + 1, where _n_ is even, if we count only
those arrangements that are fundamentally different. But if we count all
reversals and reflections as different, as the Monk himself did, then _n_
dogs (odd or even) may be placed in ((_n_^4 + 6_n_^3 + 14_n_^2 + 15_n_) /
6) + 1 ways. In order that there may be _n_ dogs on every side, the
number must not be less than 2_n_ nor greater than 4_n_, but it may be
any number within these limits.
An extension of the principle involved in this puzzle is given in No. 42,
"The Riddle of the Pilgrims." See also "The Eight Villas" and "A
Dormitory Puzzle" in _A. in M._