Results 1 to 6 of 6
Thread: Help

20110609, 23:42 #1
 Join Date
 May 2010
 Location
 Kitchener
 Posts
 6
 Thanks
 0
 Thanked 0 Times in 0 Posts
Help
This puzzle is driving me nuts...
Ever dreamt of winning the lottery? Well, here's your chance!
You have just invented a device which allows you to retrieve pieces of information from the future. Howver, it is still a beta version, so you can only use it to get information about a week ahead of time, and only a few small bits of information per week.
Since you always wanted to be rich, you instruct the device to get you the lottery numbers for the next drawing of the 6/49 lottery. Unfortunately 6 numbers at the same time is too much information for the machine, and it just spits out an error.
Being a smart cookie, you try and ask the device for the sum of the 6 lottery numbers. The machine starts rattling, and voila  spits out a piece of paper with a number on it. Looking at the number, you start to realize your mistake: There's got to be thousands of possible number combinations that yield this particular sum!
Luckily the machine is also quite smart and feels your despair. It starts working again and spits out some more information: It tells you that if you figure out exactly how many possible number combinations there are (from 6 out of 49 numbers) to yield this particular sum, and then multiply this number with the sum on the paper, it will yield a new number of around one million, and you will also get the same number if you multiply all 6 lottery numbers with each other.
After that, the machine went silent.
Now you need to figure out those 6 numbers! Rest assured that this is enough information to find a single set of 6 winning numbers for the lottery.

20110618, 15:56 #2
 Join Date
 Jan 2001
 Location
 La Jolla, CA
 Posts
 1,210
 Thanks
 17
 Thanked 45 Times in 44 Posts
Of the 6, can there be duplicates or not?
I figured out that there are 13,552 combinations that give you a sum of 76.
And, 76 times 13552 is around a million (1,029,952).
Kinda stuck at this point.Last edited by kweaver; 20110618 at 16:33. Reason: added more info

20110628, 09:32 #3
 Join Date
 Jun 2011
 Location
 Dorset, UK
 Posts
 6
 Thanks
 0
 Thanked 3 Times in 3 Posts
For a lottery, no, there can't be duplicates.
So...
1 <= a <> b <> c <> d <> e <> f <= 49
a + b + c + d + e + f = x
y = Number of Combinations
x * y = z
a * b * c * d * e * f = z
So combining those we have:
(a + b + c + d + e + f) * y = a * b * c * d * e * f
I'm not getting any further than that at the moment. I think I need to look into the maths of how to work out the number of combinations (possibly a factorialbased equation?).

20110711, 19:44 #4
 Join Date
 Dec 2009
 Location
 UK
 Posts
 13
 Thanks
 0
 Thanked 0 Times in 0 Posts
The answer is : (I tried to use a spoiler, it didn't work)
2,8,11,14,19,22 which add to 76 and there are 13552 possible lines which add to this sum. 76 x 13552=1029952
2 x 8 x 11 x 14 x 19 x 22 =1029952.
No fancy maths folks. I just happen to be a lottery analyst who happens to have spreadsheets programmed to extract data like sums etc. With a slight modification I managed to program my spreadsheet to solve the puzzle.Last edited by Frankonline; 20110711 at 19:51. Reason: add spoiler

20110715, 08:27 #5
 Join Date
 Dec 2009
 Location
 UK
 Posts
 13
 Thanks
 0
 Thanked 0 Times in 0 Posts
The following Excel macro generates a table of how many combinations add up to a specific sum. There are 260 different possible sums between 21 and 279.
Option Explicit
Option Base 1 ' start array at 1 not 0
Dim A As Integer, B As Integer, C As Integer, D As Integer, E As Integer, F As Integer
Dim I As Integer, nSum(279) As Long
Sub sumall()
Application.ScreenUpdating = False
Sheets("Sheet1").Select
Range("A2").Select
Range("A1").Value = "Sum"
Range("B1").Value = "# combs."
For I = 21 To 279
nSum(I) = 0
Next I
For A = 1 To 44
For B = A + 1 To 45
For C = B + 1 To 46
For D = C + 1 To 47
For E = D + 1 To 48
For F = E + 1 To 49
nSum(A + B + C + D + E + F) = nSum(A + B + C + D + E + F) + 1
Next F
Next E
Next D
Next C
Next B
Next A
For I = 21 To 279
ActiveCell.Value = I
ActiveCell.Offset(0, 1).Value = nSum(I)
ActiveCell.Offset(1, 0).Select
Next I
Application.ScreenUpdating = False
Range("A1").Select
End Sub
From this you can create an extra column to the right which contains the product of sum and number of lines. Inspect this column for any entries which are near to one million. For this there are a few candidates which might satisfy the given criteria, 76 being just one of them.
...............
Its just a matter now of examining each of these possible sums using another macro to generate all the combinations adding up to each sum. On the spreadsheet, multiply the combination elements found to see if they agree with the figure in the product column as in . a * b * c * d * e * f = z Eventually I found the match with a sum of 76 and the particular combination shown.Last edited by Frankonline; 20110716 at 05:44.

20110715, 13:15 #6
 Join Date
 Dec 2009
 Location
 UK
 Posts
 13
 Thanks
 0
 Thanked 0 Times in 0 Posts
In order to identify combinations when you know the possible sums which satisfy the product criteria, then if you use this Excel macro on the same module as the above macro, you can get a listing of the combinations for any named sum.
'finds all combinations adding up to a chosen sum
Sub listCombs() 'change the value in the If statement to the required sum (currently 76)
Dim count As Long
Sheets("Sheet2").Select
Columns("A:F").Select
Selection.Clear
Application.ScreenUpdating = False
Range("A1").Value = "a"
Range("B1").Value = "b"
Range("C1").Value = "c"
Range("D1").Value = "d"
Range("E1").Value = "e"
Range("F1").Value = "f"
Range("A2").Select
count = 0
For A = 1 To 44
For B = A + 1 To 45
For C = B + 1 To 46
For D = C + 1 To 47
For E = D + 1 To 48
For F = E + 1 To 49
If (A + B + C + D + E + F) = 76 Then
count = count + 1
ActiveCell.Offset(count, 0) = A
ActiveCell.Offset(count, 1) = B
ActiveCell.Offset(count, 2) = C
ActiveCell.Offset(count, 3) = D
ActiveCell.Offset(count, 4) = E
ActiveCell.Offset(count, 5) = F
End If
Next F
Next E
Next D
Next C
Next B
Next A
Application.ScreenUpdating = True
Range("A1").Select
End Sub
Note that older versions of Excel you can only have 65536 rows and some values of sum (150 for example) require almost 166,000 lines to list all the combinations.
Fortunately, the candidate sums we require to investigate here are 75,76,77,236,237 and 238 , (found from the results of running the first macro) none of which require that many rows. By changing the value in the line..
If (A + B + C + D + E + F) = 76 Then
to another target sum value, combinations for all the candidate possible sums can be listed. Add an extra column to the spreadsheet to calculate A*B*C*D*E*F and there will be a column of possible products of elements which can be compared with the target figure for sum X (count of combinations) which for 76 is ........76 X 13552. or 1,029,952
Thats how I did it.