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

Home > Numbers
One triplet out (Posted on 2015-06-16) Difficulty: 3 of 5
Given set of fifteen integers (1 to 15) .

Erase 3 numbers so that remaining integers can be arranged as a 3 by 4 array in which the sum of the numbers in each row is a certain Sr and in each of the columns a certain Sc.

Present the triplet you have chosen and one of the possible arrangements.

D4. Bonus question:
How many distinct solutions are there?

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 2 of 3 |
DefDbl A-Z
Dim crlf$, used(15), grid(3, 4), row1tot, col1tot, solct

Private Sub Form_Load()
 Form1.Visible = True
 
 Text1.Text = ""
 crlf = Chr$(13) + Chr$(10)
 
 Open "c:VB5 projects loobleone triplet out.txt" For Output As #2

 addOn 1, 1
 
 Close
 
 Text1.Text = Text1.Text & solct & crlf & " done"
  
End Sub

Sub addOn(row, col)
  DoEvents
  For newnum = 1 To 15
   If used(newnum) = 0 Then
     If row = 1 And col = 4 Then
      Text2.Text = grid(1, 1) & Str(grid(1, 2)) & Str(grid(1, 3)) & Str(newnum)
     End If
     good = 1
     If col = 4 Then
       tot = grid(row, 1) + grid(row, 2) + grid(row, 3) + newnum
       If row > 1 Then If tot <> row1tot Then good = 0
       If row = 1 Then row1tot = tot
     End If
     If row = 3 Then
       tot = grid(1, col) + grid(2, col) + newnum
       If col > 1 Then If tot <> col1tot Then good = 0
       If col = 1 Then col1tot = tot
     End If
     If row = 1 And col > 1 And newnum < grid(row, col - 1) Then good = 0
     If col = 1 And row > 1 And newnum < grid(row - 1, col) Then good = 0
     If good Then
       grid(row, col) = newnum
       used(newnum) = 1
       If row = 3 And col = 4 Then
         For r = 1 To 3
          For c = 1 To 4
            Print #2, Mid("123456789ABCDEF", grid(r, c), 1);
          Next
          Print #2, "    "; row1tot; col1tot
         Next
         Print #2,
         solct = solct + 1
       Else
         c = col + 1
         If c > 4 Then c = 1: r = row + 1 Else r = row
         addOn r, c
       End If
       used(newnum) = 0
     End If
   End If
  Next
End Sub


finds there are 108 distinct solutions in which the columns are in order of ascending top numbers and the rows are in ascending order of leftmost number. The rows can be arranged in 3! = 6 ways, and the columns in 4! = 24 ways, so the total distinct solutions is 108 * 6 * 24 = 15,552. So you can see why it saves computation time to find only the 108.

While the arrays are given in hex below, for conciseness, the totals are of course in decimal:

12EF     32  24 
B975     32  24 
CD34     32  24 
-----------------
12EF     32  24 
BD35     32  24 
C974     32  24 
-----------------
13DF     32  24 
9A67     32  24 
EB52     32  24 
-----------------
13DF     32  24 
9B57     32  24 
EA62     32  24 
-----------------
13DF     32  24 
B795     32  24 
CE24     32  24 
-----------------
13DF     32  24 
BE25     32  24 
C794     32  24 
-----------------
14AD     28  21 
8695     28  21 
CB23     28  21 
-----------------
14AD     28  21 
9586     28  21 
BC32     28  21 
-----------------
14CF     32  24 
97A6     32  24 
ED23     32  24 
-----------------
14CF     32  24 
A697     32  24 
DE32     32  24 
-----------------
14CF     32  24 
A976     32  24 
DB53     32  24 
-----------------
14CF     32  24 
AB56     32  24 
D973     32  24 
-----------------
14DE     32  24 
8B67     32  24 
F953     32  24 
-----------------
14DE     32  24 
B597     32  24 
CF23     32  24 
-----------------
158E     28  21 
76B4     28  21 
DA23     28  21 
-----------------
15BF     32  24 
96A7     32  24 
ED32     32  24 
-----------------
15BF     32  24 
9D37     32  24 
E6A2     32  24 
-----------------
15BF     32  24 
A796     32  24 
DC43     32  24 
-----------------
15BF     32  24 
AC46     32  24 
D793     32  24 
-----------------
16AF     32  24 
95B7     32  24 
ED32     32  24 
-----------------
16AF     32  24 
97C4     32  24 
EB25     32  24 
-----------------
16AF     32  24 
9D37     32  24 
E5B2     32  24 
-----------------
16AF     32  24 
BE52     32  24 
C497     32  24 
-----------------
16BE     32  24 
8D47     32  24 
F593     32  24 
-----------------
179F     32  24 
A5B6     32  24 
DC43     32  24 
-----------------
179F     32  24 
A6C4     32  24 
DB35     32  24 
-----------------
179F     32  24 
AC46     32  24 
D5B3     32  24 
-----------------
179F     32  24 
B3D5     32  24 
CE24     32  24 
-----------------
179F     32  24 
BD53     32  24 
C4A6     32  24 
-----------------
179F     32  24 
BE25     32  24 
C3D4     32  24 
-----------------
17AE     32  24 
B498     32  24 
CD52     32  24 
-----------------
17BD     32  24 
85A9     32  24 
FC32     32  24 
-----------------
17BD     32  24 
8C39     32  24 
F5A2     32  24 
-----------------
17BD     32  24 
8CA2     32  24 
F539     32  24 
-----------------
17BD     32  24 
8E46     32  24 
F395     32  24 
-----------------
17BD     32  24 
9F35     32  24 
E2A6     32  24 
-----------------
23AD     28  21 
8E51     28  21 
B467     28  21 
-----------------
23BC     28  21 
6895     28  21 
DA14     28  21 
-----------------
23BC     28  21 
9568     28  21 
AD41     28  21 
-----------------
23CF     32  24 
97B5     32  24 
DE14     32  24 
-----------------
23CF     32  24 
9A58     32  24 
DB71     32  24 
-----------------
23DE     32  24 
79A6     32  24 
FC14     32  24 
-----------------
23DE     32  24 
7A69     32  24 
FB51     32  24 
-----------------
23DE     32  24 
7B59     32  24 
FA61     32  24 
-----------------
23DE     32  24 
A679     32  24 
CF41     32  24 
-----------------
24CE     32  24 
95B7     32  24 
DF13     32  24 
-----------------
24CE     32  24 
9F17     32  24 
D5B3     32  24 
-----------------
25AF     32  24 
9C38     32  24 
D7B1     32  24 
-----------------
25BE     32  24 
76A9     32  24 
FD31     32  24 
-----------------
25BE     32  24 
79C4     32  24 
FA16     32  24 
-----------------
25BE     32  24 
7D39     32  24 
F6A1     32  24 
-----------------
25BE     32  24 
94C7     32  24 
DF13     32  24 
-----------------
25BE     32  24 
97A6     32  24 
DC34     32  24 
-----------------
25BE     32  24 
9F17     32  24 
D4C3     32  24 
-----------------
25BE     32  24 
A697     32  24 
CD43     32  24 
-----------------
25BE     32  24 
AF61     32  24 
C479     32  24 
-----------------
25CD     32  24 
89B4     32  24 
EA17     32  24 
-----------------
269F     32  24 
87C5     32  24 
EB34     32  24 
-----------------
26AE     32  24 
75B9     32  24 
FD31     32  24 
-----------------
26AE     32  24 
7D39     32  24 
F5B1     32  24 
-----------------
26AE     32  24 
7DB1     32  24 
F539     32  24 
-----------------
28AC     32  24 
9F35     32  24 
D1B7     32  24 
-----------------
28BF     36  27 
C5A9     36  27 
DE63     36  27 
-----------------
34BE     32  24 
9F62     32  24 
C578     32  24 
-----------------
34CD     32  24 
697A     32  24 
FB51     32  24 
-----------------
34CD     32  24 
6B5A     32  24 
F971     32  24 
-----------------
34CD     32  24 
75B9     32  24 
EF12     32  24 
-----------------
34CD     32  24 
79A6     32  24 
EB25     32  24 
-----------------
34CD     32  24 
7F19     32  24 
E5B2     32  24 
-----------------
34CD     32  24 
A679     32  24 
BE52     32  24 
-----------------
359F     32  24 
76B8     32  24 
ED41     32  24 
-----------------
359F     32  24 
7D48     32  24 
E6B1     32  24 
-----------------
359F     32  24 
7DB1     32  24 
E648     32  24 
-----------------
359F     32  24 
A6E2     32  24 
BD17     32  24 
-----------------
359F     32  24 
AC28     32  24 
B7D1     32  24 
-----------------
35BD     32  24 
679A     32  24 
FC41     32  24 
-----------------
35BD     32  24 
6AC4     32  24 
F917     32  24 
-----------------
35BD     32  24 
6C4A     32  24 
F791     32  24 
-----------------
35BD     32  24 
74C9     32  24 
EF12     32  24 
-----------------
35BD     32  24 
7F19     32  24 
E4C2     32  24 
-----------------
35BD     32  24 
9F71     32  24 
C46A     32  24 
-----------------
36CF     36  27 
A8B7     36  27 
ED45     36  27 
-----------------
36CF     36  27 
B7A8     36  27 
DE54     36  27 
-----------------
36DE     36  27 
9AC5     36  27 
FB28     36  27 
-----------------
379D     32  24 
65BA     32  24 
FC41     32  24 
-----------------
379D     32  24 
6C4A     32  24 
F5B1     32  24 
-----------------
379D     32  24 
A2E6     32  24 
BF15     32  24 
-----------------
379D     32  24 
AF16     32  24 
B2E5     32  24 
-----------------
389C     32  24 
AF25     32  24 
B1D7     32  24 
-----------------
45DE     36  27 
8AB7     36  27 
FC36     36  27 
-----------------
45DE     36  27 
B78A     36  27 
CF63     36  27 
-----------------
468E     32  24 
95F3     32  24 
BD17     32  24 
-----------------
46AC     32  24 
5BD3     32  24 
F719     32  24 
-----------------
46AC     32  24 
7F91     32  24 
D35B     32  24 
-----------------
46AC     32  24 
93D7     32  24 
BF15     32  24 
-----------------
46AC     32  24 
9F17     32  24 
B3D5     32  24 
-----------------
478D     32  24 
93F5     32  24 
BE16     32  24 
-----------------
479C     32  24 
53DB     32  24 
FE21     32  24 
-----------------
479C     32  24 
5BE2     32  24 
F61A     32  24 
-----------------
479C     32  24 
5E2B     32  24 
F3D1     32  24 
-----------------
479C     32  24 
6FA1     32  24 
E25B     32  24 
-----------------
489B     32  24 
7EA1     32  24 
D25C     32  24 
-----------------
56AB     32  24 
73D9     32  24 
CF14     32  24 
-----------------
56AB     32  24 
7F19     32  24 
C3D4     32  24 
-----------------
579B     32  24 
62EA     32  24 
DF13     32  24 
-----------------
579B     32  24 
6F1A     32  24 
D2E3     32  24 
-----------------
589A     32  24 
71DB     32  24 
CF23     32  24 
-----------------
59AC     36  27 
8FB2     36  27 
E36D     36  27 
-----------------

Jer's solution arranged above is the:

158E     28  21 
76B4     28  21 
DA23     28  21 

with the columns rearranged and the bottom two rows reversed.

Edited on June 16, 2015, 3:08 pm
  Posted by Charlie on 2015-06-16 15:05:58

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 (0)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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