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

 1 To 15 in a 3x5 Array (Posted on 2004-12-09)

Place the numbers 1 through 15 in a 3 by 5 array so that each column has the same sum and each row has the same sum.

 See The Solution Submitted by Erik O. Rating: 3.0000 (3 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 Bug fixed and solutions multiply | Comment 8 of 11 |
(In reply to re: All the solutions--computer solution by Hugo)

The program was originally written attempting to have all the columns, not just the first, in ascending sequence until I realized that this would not get all possible solutions.  I removed the restriction within choosing the columns, but did not up the possible values for the top row, and so that was unnecessarily restricted.

With that bug fixed, there are now 39 fundamentally distinct solutions, and I'm sure (I hope) you'll find Michael's and your solution, when rows/columns arranged so the 1 is at the top left and the top row and left column are in sequence:

` 1             2             9             13            15  11            14            5             4             6  12            8             10            7             3 `
` 1             2             9             13            15  11            14            5             7             3  12            8             10            4             6 `
` 1             2             10            13            14  11            15            5             3             6  12            7             9             8             4 `
` 1             2             11            12            14  8             9             10            7             6  15            13            3             5             4 `
` 1             2             11            12            14  8             13            10            5             4  15            9             3             7             6 `
` 1             2             11            12            14  10            7             8             9             6  13            15            5             3             4 `
` 1             2             11            12            14  10            15            8             3             4  13            7             5             9             6 `
` 1             3             7             14            15  10            12            6             8             4  13            9             11            2             5 `
` 1             3             7             14            15  10            12            11            2             5  13            9             6             8             4 `
` 1             3             8             13            15  9             11            12            6             2  14            10            4             5             7 `
` 1             3             9             13            14  11            15            5             7             2  12            6             10            4             8 `
` 1             3             10            11            15  9             8             12            6             5  14            13            2             7             4 `
` 1             3             10            11            15  9             8             12            7             4  14            13            2             6             5 `
` 1             3             11            12            13  8             7             9             10            6  15            14            4             2             5 `
` 1             3             11            12            13  9             6             8             10            7  14            15            5             2             4 `
` 1             4             8             12            15  9             7             11            10            3  14            13            5             2             6 `
` 1             4             8             12            15  9             13            5             10            3  14            7             11            2             6 `
` 1             4             8             12            15  10            14            5             9             2  13            6             11            3             7 `
` 1             4             8             12            15  10            14            11            3             2  13            6             5             9             7 `
` 1             4             9             11            15  10            6             12            5             7  13            14            3             8             2 `
` 1             4             10            12            13  8             14            11            5             2  15            6             3             7             9 `
` 1             5             6             13            15  11            10            4             8             7  12            9             14            3             2 `
` 1             5             6             13            15  11            10            14            3             2  12            9             4             8             7 `
` 1             5             7             12            15  9             11            4             10            6  14            8             13            2             3 `
` 1             5             9             11            14  8             12            13            3             4  15            7             2             10            6 `
` 1             5             9             11            14  10            4             12            6             8  13            15            3             7             2 `
` 1             5             10            11            13  9             4             12            7             8  14            15            2             6             3 `
` 1             5             10            11            13  9             15            2             6             8  14            4             12            7             3 `
` 1             6             8             10            15  9             11            3             12            5  14            7             13            2             4 `
` 1             6             8             10            15  9             11            13            2             5  14            7             3             12            4 `
` 1             6             8             10            15  11            4             13            5             7  12            14            3             9             2 `
` 1             6             8             10            15  11            14            3             5             7  12            4             13            9             2 `
` 1             6             8             12            13  9             3             11            10            7  14            15            5             2             4 `
` 1             6             9             10            14  8             13            4             12            3  15            5             11            2             7 `
` 1             7             8             9             15  10            11            2             12            5  13            6             14            3             4 `
` 1             7             8             9             15  11            4             14            5             6  12            13            2             10            3 `
` 1             7             8             10            14  11            15            3             5             6  12            2             13            9             4 `
` 1             7             9             10            13  8             3             11            12            6  15            14            4             2             5 `
` 1             7             9             10            13  8             14            11            2             5  15            3             4             12            6 `

The revised program differs only in a few items at the beginning (bolded):

DIM numb(15)
CLS
OPEN "1-15i3x5.txt" FOR OUTPUT AS #2

FOR b1 = 2 TO 12
numb(b1) = 1

FOR c1 = b1 + 1 TO 13
IF numb(c1) = 0 THEN
numb(c1) = 1

FOR d1 = c1 + 1 TO 14
IF numb(d1) = 0 THEN
numb(d1) = 1

e1 = 40 - 1 - b1 - c1 - d1
IF e1 > d1 AND e1 <= 15 THEN
IF numb(e1) = 0 THEN
numb(e1) = 1

 Posted by Charlie on 2004-12-09 19:15:13

 Search: Search body:
Forums (0)