posted by .

The squares of a 3×3 grid are filled with non-negative integers such that the sum of each row and the sum of each column is 7. How many different ways can the squares be filled? The numbers in each grid square does not need to be distinct. Rotations and reflections are distinct arrangements.

Here's a lower bound solution. You may want to investigate other possibilities.

The number 7 can be partitioned into 3 ascending non-negative integers in 8 ways, namely:
007#
016
025
034
115#
124
133#
233#

There are 3 permutations of partitions (indicated #) with non-distinct digits and 6 permutations of those with distinct digits for a total of
4*3+4*6=36 permutations of non-negative integers whose sum is 7.

Each of these permutations can make a 3x3 grid as follows by putting a permutation as the first line, then rotate the digits to the left:

124
241
412

We can also make another grid by rotating them to the right, as follows:

124
412
241

This doubles the number of grids for a total of
36*2=72 grids.

1 2 4
0 5 2
6 0 1

Hint: you need these:
(1) a,b,c,d are non-negative integers
(2) 7−a−b≥0⇔a+b≤7
(3) 7−c−d≥0⇔c+d≤7
(4) 7−a−c≥0⇔a+c≤7
(5) 7−b−d≥0⇔b+d≤7
(6) a+b+c+d−7≥0⇔a+b+c+d≥7
Try to count how many satisfies these conditions (: