All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
From Minus One to Plus One (Posted on 2007-06-13) Difficulty: 3 of 5
 +---+---+---+---+
 |   |   |   |   |
 +---+---+---+---+
 |   |   |   |   |
 +---+---+---+---+
 |   |   |   |   |
 +---+---+---+---+
 |   |   |   |   |
 +---+---+---+---+

In each cell of the above matrix, place 1, -1 or 0 in such a way that each row and column has a different total.

The solution I have posted is not unique.

Can you make one more larger matrix with the same conditions?

The inspiration for this puzzle came from Anand Rao at Puzzleteasers.

See The Solution Submitted by Josie Faulkner    
Rating: 4.4000 (5 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 3 of 6 |
There are 8 totals from among 9 possible sums. To avoid trivial variations, I decided to seek only those solutions where the left-out sum was negative or zero.  As it turns out,  +4 or -4 must be missing. That's obvious in the case one's would be a column and the other a row, as a column with all +1's can't exist at the same time as a row with all -1's or vice versa.

As the order of rows and columns is a trivial variation, and whether a given set is a set of rows or a set of columns, I decided to show only those where the top row is all 1's leading to 4 as the total.  The rows are in descending order of total and the columns are in ascending order of total.

With those provisos, there are four fundamental solutions. Variations can be achieved by reordering the rows, columns or both, or interchanging rows with columns or taking the negative of each number. That makes the trivial variations equal 24*24*2*2 = 2304 times the 4 presented here for a total of 9216.

 1  1  1  1    4 
-1  0  1  1    1
-1 -1  1  1    0
-1 -1 -1  0   -3

-2 -1  2  3

 1  1  1  1    4
-1  1  1  1    2
-1 -1  0  1   -1
-1 -1 -1  0   -3
-2  0  1  3 

 1  1  1  1    4
 0  1  1  1    3
-1 -1 -1  1   -2
-1 -1  0 -1   -3
-1  0  1  2 

 1  1  1  1    4
 0  1  1  1    3
-1 -1  0  0   -2
-1 -1 -1  0   -3
-1  0  1  2 

OPEN "m1-to-p1.txt" FOR OUTPUT AS #2

FOR a = 1 TO 1
FOR b = 1 TO 1
FOR c = 1 TO 1
FOR d = 1 TO 1
FOR e = -1 TO 1
FOR f = -1 TO 1
FOR g = -1 TO 1
FOR h = -1 TO 1
FOR i = -1 TO 1
FOR j = -1 TO 1
FOR k = -1 TO 1
FOR l = -1 TO 1
FOR m = -1 TO 1
FOR n = -1 TO 1
FOR o = -1 TO 1
FOR p = -1 TO 1

REDIM taken(-4 TO 4)
good = 1
c1 = a + e + i + m: taken(c1) = 1
c2 = b + f + j + n: IF taken(c2) THEN good = 0:  ELSE taken(c2) = 1
c3 = c + g + k + o: IF taken(c3) THEN good = 0:  ELSE taken(c3) = 1
c4 = d + h + l + p: IF taken(c4) THEN good = 0:  ELSE taken(c4) = 1

r1 = a + b + c + d: IF taken(r1) THEN good = 0:  ELSE taken(r1) = 1
r2 = e + f + g + h: IF taken(r2) THEN good = 0:  ELSE taken(r2) = 1
r3 = i + j + k + l: IF taken(r3) THEN good = 0:  ELSE taken(r3) = 1
r4 = m + n + o + p: IF taken(r4) THEN good = 0:  ELSE taken(r4) = 1
IF good THEN
  IF taken(-4) = 0 OR taken(-3) = 0 OR taken(-2) = 0 OR taken(-1) = 0 OR taken(0) = 0 THEN
   IF r2 > r3 AND r3 > r4 AND c1 < c2 AND c2 < c3 AND c3 < c4 THEN
        ct = ct + 1
        PRINT a; b; c; d, a + b + c + d
        PRINT e; f; g; h, e + f + g + h
        PRINT i; j; k; l, i + j + k + l
        PRINT m; n; o; p, m + n + o + p
        PRINT a + e + i + m; b + f + j + n; c + g + k + o; d + h + l + p, , ct
        PRINT
        PRINT #2, a; b; c; d, a + b + c + d
        PRINT #2, e; f; g; h, e + f + g + h
        PRINT #2, i; j; k; l, i + j + k + l
        PRINT #2, m; n; o; p, m + n + o + p
        PRINT #2, a + e + i + m; b + f + j + n; c + g + k + o; d + h + l + p
        PRINT #2,
   END IF
  END IF
END IF


NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
CLOSE



  Posted by Charlie on 2007-06-13 16:13:57
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information