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

 Just ones and nines (Posted on 2008-12-03)
See the example below. Using only 1īs and 9īs, the 3x3 grid is filled so the 6 three-digit numbers so formed (in the 3 rows and 3 columns) are in the ascending order shown by the numbers around the grid:
```      3   1   6
+---+---+---+
2 | 1 | 1 | 9 |
+---+---+---+
5 | 9 | 1 | 9 |
+---+---+---+
4 | 9 | 1 | 1 |
+---+---+---+```
That is, the 1st is in the 2nd column (111), the 2nd is in the 1st row (119), the 3rd is in the 1st column (199), and so on.

Do the same with these three 4x4 grids.
```      3   7   6   4         3   2   8   5         2   4   5   6
+---+---+---+---+     +---+---+---+---+     +---+---+---+---+
5 |   |   |   |   |   1 |   |   |   |   |   1 |   |   |   |   |
+---+---+---+---+     +---+---+---+---+     +---+---+---+---+
2 |   |   |   |   |   7 |   |   |   |   |   7 |   |   |   |   |
+---+---+---+---+     +---+---+---+---+     +---+---+---+---+
8 |   |   |   |   |   6 |   |   |   |   |   3 |   |   |   |   |
+---+---+---+---+     +---+---+---+---+     +---+---+---+---+
1 |   |   |   |   |   4 |   |   |   |   |   8 |   |   |   |   |
+---+---+---+---+     +---+---+---+---+     +---+---+---+---+```

 See The Solution Submitted by pcbouhid No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solution | Comment 1 of 2
`1991     1199     11991119     9991     99199911     9191     19911111     1999     9991`

from

DECLARE SUB choose (r!, c!)
CLEAR , , 25000
DIM SHARED g(4, 4), n(8), p(8), cta, ctb, ctc

choose 1, 1
PRINT cta, ctb, ctc

END

SUB choose (r, c)

FOR i = 1 TO 9 STEP 8
g(r, c) = i
IF r = 4 AND c = 4 THEN
n(1) = g(1, 1) * 1000 + g(1, 2) * 100 + g(1, 3) * 10 + g(1, 4): p(1) = 1
n(2) = g(2, 1) * 1000 + g(2, 2) * 100 + g(2, 3) * 10 + g(2, 4): p(2) = 2
n(3) = g(3, 1) * 1000 + g(3, 2) * 100 + g(3, 3) * 10 + g(3, 4): p(3) = 3
n(4) = g(4, 1) * 1000 + g(4, 2) * 100 + g(4, 3) * 10 + g(4, 4): p(4) = 4
n(5) = g(1, 1) * 1000 + g(2, 1) * 100 + g(3, 1) * 10 + g(4, 1): p(5) = 5
n(6) = g(1, 2) * 1000 + g(2, 2) * 100 + g(3, 2) * 10 + g(4, 2): p(6) = 6
n(7) = g(1, 3) * 1000 + g(2, 3) * 100 + g(3, 3) * 10 + g(4, 3): p(7) = 7
n(8) = g(1, 4) * 1000 + g(2, 4) * 100 + g(3, 4) * 10 + g(4, 4): p(8) = 8
n1 = n(1): n2 = n(2): n3 = n(3): n4 = n(4)
DO
done = 1
FOR k = 1 TO 7
IF n(k) > n(k + 1) THEN SWAP n(k), n(k + 1): SWAP p(k), p(k + 1): done = 0
NEXT
LOOP UNTIL done
good = 1
FOR k = 1 TO 7
IF n(k) = n(k + 1) THEN good = 0: EXIT FOR
NEXT
IF good THEN
s\$ = ""
FOR k = 1 TO 8
s\$ = s\$ + LTRIM\$(STR\$(p(k)))
NEXT
IF s\$ = "42581763" THEN
PRINT "A"
PRINT n1: PRINT n2: PRINT n3: PRINT n4
PRINT
cta = cta + 1
END IF
IF s\$ = "16548327" THEN
PRINT "B"
PRINT n1: PRINT n2: PRINT n3: PRINT n4
PRINT
ctb = ctb + 1
END IF
IF s\$ = "15367824" THEN
PRINT "C"
PRINT n1: PRINT n2: PRINT n3: PRINT n4
PRINT
ctc = ctc + 1
END IF
END IF
ELSE
col = c + 1
row = r
IF col > 4 THEN col = 1: row = row + 1
choose row, col
END IF
NEXT i
END SUB

 Posted by Charlie on 2008-12-03 18:20:24

 Search: Search body:
Forums (0)