PDA

Click to See Complete Forum and Search --> : Challenge: Sets whose Elements Sum to...


NotLKH
Feb 17th, 2007, 01:04 PM
Given:
You have 13 variables, F_0 thru F_12, that represent 13 distinct sets of numbers.
These Variables, The Number of elements in their sets, and the sums of the
elements in their sets are listed below:
F(n) #Elements Sums(Of their elements)
F(0) #=1 Sum=0
F(1) #=6 Sum=22
F(2) #=3 Sum=50
F(3) #=3 Sum=41
F(4) #=6 Sum=58
F(5) #=6 Sum=147
F(6) #=6 Sum=156
F(7) #=6 Sum=203
F(8) #=3 Sum=177
F(9) #=3 Sum=168
F(10) #=6 Sum=295
F(11) #=6 Sum=286
F(12) #=6 Sum=227



The sets can only use the numbers 0 thru 60, and cumulatively, these numbers
are used once and only once across the entire sets of variables.

So for example,
Consider:
F(8) #=3 Sum=177
This identifies that:
F(8) is the sum of 3 numbers that add to 177

Since the range of all possible numbers that F(8) can draw from is 0->60
{or for that matter, Any of the F variable sets};
And since the TOP(3) Values, 58,59,60 sum to 177
We know that F(8) MUST BE {58,59,60}
[if any of the distinct elements for F(8) were less than 58,
then it would require a number greater than 60 to also be
an element, which is beyond the allowed range.]
And at this point we also know that the numbers 58 59 and 60
Cannot be used by any other Variable set other than F(8), which simplifies
the analysis of the remaining F sets.

Therefore:
Either
Determine the 2 possible sets of numbers for F(4)
OR
Tell me why F(4) has either more or less than 2 solution sets.



Enjoy!

Logophobic
Feb 17th, 2007, 07:17 PM
Similar to the proof given as an example, that F(8) = {58,59,60}, the collective sum of the 42 numbers in sets F(5) through F(12) is 1659. This can only be the sum of the numbers 19 through 60, inclusive, thereby limiting the range for the remaining sets to 0 through 18.

The first three each have only one solution:
F(0) = {0}
F(1) = {1,2,3,4,5,7}
F(2) = {15,17,18}

This leaves us with 9 numbers for F(3) and F(4), and two possible solutions for those sets:
F(3) = {11,14,16}
F(4) = {6,8,9,10,12,13}
-OR-
F(3) = {12,13,16}
F(4) = {6,8,9,10,11,14}

NotLKH
Feb 17th, 2007, 08:19 PM
lol.

Very Good!


Now,

Can you generically code this?
{Up to the 11,12,13,14 point anyways}

I'll start with the prelim setup:

{vbnet}


Public Class Form1
Dim SUPERFAMS_CELLCOUNTS() As Integer
Dim FAM_SOL() As Integer
Dim SUPER_FAMCOUNT As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SUPER_FAMCOUNT = 12
ReDim SUPERFAMS_CELLCOUNTS(SUPER_FAMCOUNT)
ReDim FAM_SOL(SUPER_FAMCOUNT)

SUPERFAMS_CELLCOUNTS(0) = 1
SUPERFAMS_CELLCOUNTS(1) = 6
SUPERFAMS_CELLCOUNTS(2) = 3
SUPERFAMS_CELLCOUNTS(3) = 3
SUPERFAMS_CELLCOUNTS(4) = 6
SUPERFAMS_CELLCOUNTS(5) = 6
SUPERFAMS_CELLCOUNTS(6) = 6
SUPERFAMS_CELLCOUNTS(7) = 6
SUPERFAMS_CELLCOUNTS(8) = 3
SUPERFAMS_CELLCOUNTS(9) = 3
SUPERFAMS_CELLCOUNTS(10) = 6
SUPERFAMS_CELLCOUNTS(11) = 6
SUPERFAMS_CELLCOUNTS(12) = 6

FAM_SOL(0) = 0
FAM_SOL(1) = 22
FAM_SOL(2) = 50
FAM_SOL(3) = 41
FAM_SOL(4) = 58
FAM_SOL(5) = 147
FAM_SOL(6) = 156
FAM_SOL(7) = 203
FAM_SOL(8) = 177
FAM_SOL(9) = 168
FAM_SOL(10) = 295
FAM_SOL(11) = 286
FAM_SOL(12) = 227

End Sub

NotLKH
Feb 17th, 2007, 08:24 PM
The first three each have only one solution:
F(0) = {0}
F(1) = {1,2,3,4,5,7}
F(2) = {15,17,18}



Hmmm,,,,


I'll look it over, but I'm not sure that you can initially easily say that about F(2). {Without considering F4 and F3 first} {Although you are absolutely correct}
At least, in My algorythm, the sequence of consideration is F0, F1, F4, F3, Then F2, ie... I'm looking at the Bot_Sums(N)

Got Milk, err,,, a summerization of why you say that?

NotLKH
Feb 17th, 2007, 08:44 PM
Similar to the proof given as an example, that F(8) = {58,59,60}, the collective sum of the 42 numbers in sets F(5) through F(12) is 1659. This can only be the sum of the numbers 19 through 60, inclusive, thereby limiting the range for the remaining sets to 0 through 18.

Ahh. Now that I've reread, Yep!
You went the Top_Sums route, whereas I go the Bot_Sums route first.

Good Job!

Still,

Given the initial conditions,

{Challenge #2}

What are the minimal sets that each F can draw from to build their sets?

For Example,

As You indicated,

F4 is a subset, a combination, of 6 out of the 8 numbers in the set: {6 8 9 10 11 12 13 14}

And, This is the Minimal set that will produce ALL of the solutions for F(4)

What are the equivalent sets for all the other F's?