We first show by induction that n=2k is a cool number. The base case of n=2 is trivial as there is no such d.
For induction, assume that 2k is a cool number. We construct a numbering of a 2k+1×2k+1 board that satisfies the conditions.
Take the 2k+1×2k+1 board and divide it into four 2k×2k sub-boards. By assumption, there is some numbering P of a 2k×2k board that satisfies the required condition; we write down the numbering P in each sub-board. Next, add 22k to every number in the second sub-board, add 2×22k to every number in the third sub-board, and add 3×22k to every number in the fourth sub-board. Then the numbers in the cells of the 2k+1×2k+1 board are the numbers 1 to 22(k+1).
Now locate 22k from the first sub-board, and swap it with 22k+2k−1 from the second sub-board. Locate 3×22k from the third sub-board, and swap it with 3×22k+2k−1 from the fourth sub-board.
We claim that this numbering of the 2k+1×2k+1 board satisfies the required conditions. For any d=2i where i<k, consider any 2i×2i sub-board. The sum of its cells modulo 2i is not changed in the addition step or the swapping step, so the sum is congruent modulo 2i to the sum of the corresponding 2i×2i sub-board in P, which is nonzero, as required.
In the case of d=2k, we can directly evaluate the sum of the (b+1)th sub-board for b∈{0,1,2,3}. The sum is given by
22k−1(1+22k)+b24k+(−1)b2k−1≡2k−1(mod2k)
Therefore all sub-boards satisfy the required conditions and so 2k+1 is a cool number, completing the induction.
It remains to show that no other even number is a cool number. Let n=2sm where s is a positive integer and m is an odd integer greater than 1. For the sake of contradiction, suppose that there is a numbering of the n×n board satisfying the required conditions.
Claim. In the 2i-division of the board, where 1⩽i⩽s, the sum of numbers in each 2i×2i sub-board is congruent to 2i−1 modulo 2i.
Proof. We prove the claim by induction on i. The base case of i=1 holds as the sum of numbers in each 2×2 sub-board must be odd. Next, suppose the claim is true for 2i. In the 2i+1-division, each 2i+1×2i+1 sub-board is made up of four 2i×2i sub-boards, each with a sum congruent to 2i−1 modulo 2i. Hence the sum of each 2i+1×2i+1 sub-board is a multiple of 2i. It cannot be a multiple of 2i+1 because of the conditions, which means it must be congruent to 2i modulo 2i+1. This proves the claim.
Back to the problem, since m is odd, summing up the m2 sums of 2s×2s sub-boards gives
2s−1m2≡2s−1(mod2s)
However, the sum of the numbers from 1 to n2 is
2n2(n2+1)=22s−1m2(22sm2+1)≡0(mod2s)
This is a contradiction. Therefore n is not a cool number.