# Fill two dimensional list by meeting given conditions

Suppose you have a 2D array - a list that exits in both x and y axis - which is 4 x 4, and you need to fill the table by putting numbers in it obeying following restrictions.

1. Each cell is able to store a number that can be calculated according to its index. (Indexes start from [0,0])

If a cell's index is [i, j] it can store a number calculated as one of the following ways.

1. i x j + i - j

2. i x j + j - i

3. i ^ j

4. j ^ i

2. Each cell can carry at most multiplication of its adjacent cells. (horizonal and vertical)

3. Each cell should be colored in a way all odds are of same color and all evens are of same color and two same colored cell cannot stand side by side vertically or horizontally.

• How do you define $0^0$? – hexomino Mar 29 at 9:59
• Has a correct answer been given? If so, please don't forget to $\color{green}{\checkmark \small\text{Accept}}$ it. If not, some responses to the answerers to help steer them in the right direction would be helpful. – Rubio Apr 2 at 18:11

It turns out that this is

Impossible

Reasoning

The cell with index $$[1,1]$$ must contain the entry $$1\times 1 + 1 - 1 = 1^1 = 1$$.

Now consider the cell with index $$[0,1]$$ which is adjacent to $$[1,1]$$. This must contain either
(i) $$0 \times 1 + 0 - 1 = -1$$,
(ii) $$0 \times 1 + 1 - 0 = 1$$
(iii) $$0^1 = 0$$
(iv) $$1^0 = 1$$

Now, (i), (ii) and (iv) are odd which would break rule 3.
However if we are in case (iii) then we break rule 2, since the cell with index $$[1,1]$$ can carry, at most, multiplication of its adjacent cells, which would be $$0$$ in this case.

• Actually it may be possible due to the fact that (according to the rules) rot13(rnpu pryy VF NOYR (be PNA) pbagnva n ahzore, ohg abg arprffnevyl FUBHYQ gb qb fb. Fbzr pryyf znl pbagnva ab ahzoref ng nyy (naq fb, abg orvat terngre guna nal bgure ahzoref, yvxr AnA va cebtenzzvat)) – trolley813 Mar 29 at 10:20
• @trolley813 That's quite an interesting take. Wouldn't it contravene the sentence "...you need to fill the table by putting numbers in it obeying following restrictions." in the opening paragraph? – hexomino Mar 29 at 10:26
• maybe, but you can fill the table partially. I'm now writing my "solution". – trolley813 Mar 29 at 10:31

My "solution" (a lateral thinking answer)

__0 NaN 1 NaN
NaN 1 NaN 1
__1 NaN 4 NaN
NaN 1 NaN 9

Explanation

NaN meaning not-a-number (according to the rules, a cell does not has to contain a number, but rather can do so). All other rules are obviously complied (if a cell contains a number, it is of the 4 permitted ones; NaNs (and their products) are never greater than any number; you should color all "odd" cells blue, "evens" green and NaNs grey, since the latter are neither even nor odd).