# number of ways putting m nonadjacent balls in a n*n*n chess board

I'm trying to solve a problem by using combinatorics. The problem goes like this:

I want to place $m$ balls in a $n\times n\times n$ chessboard. No two balls should be adjacent. Thus, no two of them should be the nearest neighbor (each location in the chessboard has six nearest neighbors).

For example: if a ball is placed at (1,1,1), there must be no ball at (0,1,1), (1,0,1), (1,2,1), (2,1,1), (1,1,0), (1,1,2).

For the ball at the corner location, like (0,0,0), there must be no ball at (0,0,1), (0,1,0) and (1,0,0).

How many different ways to put these $m$ balls? Is this problem solvable in general? Is it possible to write down a generating series for such problem?

• If two rooks are at (0,0,0) and (0,1,1) are they attacking? Or do they need to differ by 1 in only one coordinate to attack? [Also suggest not calling them rooks] – coffeemath May 7 '18 at 2:22
• No, they are not, if a rook is placed at (0,0,0), only rooks on (0,1,0), (1,0,0),(0,0,1) can attack it. – Lonitch May 7 '18 at 2:25
• Sorry for the confusion, I have changed them to "balls" and added an example @coffeemath – Lonitch May 7 '18 at 2:49
• The problem is rephrased, sorry for the confusion @darij grinberg – Lonitch May 7 '18 at 2:51
• Now that it's been clarified, I think it's a good question (will upvote) Note that positions on a side or at a corner have less than 6 nearest neighbors. – coffeemath May 7 '18 at 9:53