There are three solutions if n<7:
For n greater than or equal to 7, a solution is:
0 | 1 | 2 | ... | n-4 | n-3 | n-2 | n-1 |
n-4 | 2 | 1 | 0 | 1 | 0 | 0 | 0 |
Easy to check why, but the how is a bit tough. First, we define the numbers in the bottom row as a(k) where k is the number in the same column above it:
0 | 1 | 2 | ... | n-3 | n-2 | n-1 |
a(0) | a(1) | a(2) | ... | a(n-3) | a(n-2) | a(n-1) |
Now, all the a(k) must add up to n because you only have n numbers in the bottom row (and each of the a(k) is the no. of times k appears on the bottom row). So a(0) + a(1) + a(2) + ... + a(n-2) + a(n-1) = n
Again, because a(k) is the no. of times k appears in the bottom row, you can calculate its sum as the sum of k*a(k) for all k. Therefore, 0*a(0) + 1*a(1) + 2*a(2) + ... + (n-2)*a(n-2) + (n-1)*a(n-1) = n
If you put in the value of n from first equation in second and take all the terms to left side, you get:
(-1)*a(0) + 0*a(1) + 1*a(2) + ... + (n-3)*a(n-2) + (n-2)*a(n-1) = 0
or, 1*a(2) + ... + (n-3)*a(n-2) + (n-2)*a(n-1) = a(0)
Now, let a(0) = X for a solution to the problem. Then a(X) > 0. If a(X) > 1, then (X-1)*a(X) > 2(X-1) > X for all X>2 (and we can prove that X>2 by using the fact that n<7, which can be used to prove that a(n-1), a(n-2) and a(n-3) are all 0).
So, if a(X) = 1, then 1*a(2) + ... + (X-2)*a(X-1) + (X-1)*a(X) + (X)*a(X+1) + ... + (n-3)*a(n-2) + (n-2)*a(n-1) = a(0) leads to:
1*a(2) + ... + (X-2)*a(X-1) + X - 1 + (X)*a(X+1) + ... + (n-3)*a(n-2) + (n-2)*a(n-1) = X
or, 1*a(2) + ... + (X-2)*a(X-1) + (X)*a(X+1) + ... + (n-3)*a(n-2) + (n-2)*a(n-1) = 1
So if any a(k)>0 for k>2 and k=/=X, the left hand side becomes greater than one. So, a(k) = 0 for all k > 2 and k=/=X
or, 1*a(2) + 0 = 1
or, a(2) = 1
Now since a(2) = 1, a(1) > 0. So a(0) is the number of numbers from 3 to n-1, minus 1.
So, X = n-1 - 3 + 1 - 1 = n-4
And so the solution I found before is legit, and it is a unique solution ^^