|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Calculate the Number of SubsetsThis is Lotto Based. There is a System in Lotto called "Wheels". A Lotto Wheeling System is a Special Pattern to Arrange Numbers into Combinations. This System can be Used Over and Over again with Different Numbers. A Lotto Wheel is Constructed in such a way that if the Winning Numbers Fall in the Group of Numbers you have Selected, you will Always have a Winning Combination Somewhere. If for Example, you have a Group of 12 Numbers then the Lotto Wheel you Select should have the Numbers 1-12 Arranged in Sets of Numbers ( Each Set is 6 Numbers ). You then take the Wheel and Substitute your Numbers in the Wheels Pattern and Simply Replace all the 1's in the Pattern with your First Number, all the 2's with your Second Number, all the 3's with your Third Number, etc. All Wheels give a Guarantee. For Example, the Wheel 24,6,3,6,50 Means, there are 24 Different Numbers Used in the Wheel, there are 6 Numbers Drawn, the Guarantee of having 3 Numbers in at Least 1 Combination if ALL the 6 Numbers Drawn are in the Selected 24 Numbers. I have a Set of 6 Number Combinations in Cells "G13:L27" ( the Number of Combinations could be More or Less ). In this Example I am Using a Wheel with 24 Numbers :- 1,3,7,12,15,16 1,4,5,17,20,21 1,8,9,10,19,22 1,13,14,18,23,24 2,3,6,9,21,23 2,10,12,14,16,20 2,11,15,19,20,24 3,4,7,10,18,24 3,5,7,14,17,19 4,6,8,14,15,22 4,9,11,13,16,19 5,10,13,15,17,23 5,11,12,18,21,22 6,8,12,16,17,24 7,8,13,20,22,23 Here is the Code that someone has Kindly Provided which Cycles through ALL Combinations and Compares ALL the Combinations with ALL the Combinations in the Above Wheel. The Below Code Finds the Coverage ( Total Combinations ) of 5 Numbers if 5 Numbers are Matched ... Code: Sub test_5() Dim a, dic As Object Set dic = CreateObject("Scripting.Dictionary") a = Range("g13").CurrentRegion.Value For i = 1 To UBound(a, 1) For ii = 1 To 2 For iii = ii + 1 To 3 For iv = iii + 1 To 4 For v = iv + 1 To 5 For vi = v + 1 To 6 z = a(i, ii) & "," & a(i, iii) & a(i, iv) & a(i, v) & a(i, vi) If Not dic.exists(z) Then dic.Add z, Nothing n = n + 1 End If Next vi, v, iv, iii, ii, i Set dic = Nothing Range("O16") = n End Sub .... and Produces the Correct Result of 90. How can the Code be Modified to Also Produce the Combinations Covered for the Categories ... Matched = Covered Combinations 2 if 5 = 42,504 3 if 5 = 35,720 4 if 5 = 4,140 5 if 5 = 90 ( the Code Already Provides this Result ) .... Please. I was Told for the Interpretation of the 3 if 5 Category that you Need to Cycle through ALL 5 Number Combinations that can be Constructed from the Total Numbers Used in the Wheel ( 24 in this Case ). So if the Wheel Contains "x" Unique Numbers, you Need to Cycle through ALL 5 Number Combinations from those "x" Numbers. Then you Need to Scan the Wheel for Each 5 Number Combination Produced and Compare it with Each Line in the Wheel to see if that Line Matches the 5 Number Combination in *EXACTLY* 3 Numbers. If it does, then that Combination of 3 if 5 is Covered and Added to the Total and there is NO Need to Continue to Check for that Particular Combination Any Further. You then go onto the Next Combination to Check and so on Until ALL Combinations have been Cycled through and Checked with the Wheel. I Hope I have Explained this Clear Enough. Many Thanks in Advance. All the Best. Paul
Show quote
Hide quote
"Paul Black" <paul_blac***@hotmail.com> wrote in message woooooooo, way too much text. Can you shorten your question, most won't read news:1141573676.458315.313910@i39g2000cwa.googlegroups.com... > Hi Everyone, > > This is Lotto Based. > There is a System in Lotto called "Wheels". > A Lotto Wheeling System is a Special Pattern to Arrange Numbers into > Combinations. This System can be Used Over and Over again with > Different > Numbers. A Lotto Wheel is Constructed in such a way that if the Winning ...... > 3 Numbers. If it does, then that Combination of 3 if 5 is Covered and > Added to the Total and there is NO Need to Continue to Check for that > Particular Combination Any Further. You then go onto the Next > Combination to Check and so on Until ALL Combinations have been Cycled > through and Checked with the Wheel. all the way through that? :-) Michael On Mon, 6 Mar 2006 10:44:13 +1100, "Michael C" <nospam@nospam.com> Unles you're being ironic, Paul posted his original shorter question inwrote: >woooooooo, way too much text. Can you shorten your question, most won't read >all the way through that? :-) > Message-ID: <1140348667.729220.156***@o13g2000cwo.googlegroups.com> 'Subject: If ... Then Loop ?' on 19th Feb and was asked to clarify some of the terminology and define more clearly what help he was after, hence I presume this longer post :) -- Alfie <http://www.delphia.co.uk/> When you do not fear death, it's spectre no longer holds power over you. Without such weight upon your shoulders, you become free to live at last. "Alfie [UK]" <m*@privacy.net> wrote in message I'd suggest he has failed to meet a happy medium :-) So far no answers.....news:rquo021q7pk2ai7hjf5rookgf8ckkc6jea@4ax.com... > On Mon, 6 Mar 2006 10:44:13 +1100, "Michael C" <nospam@nospam.com> > wrote: >>woooooooo, way too much text. Can you shorten your question, most won't >>read >>all the way through that? :-) >> > Unles you're being ironic, Paul posted his original shorter question in > Message-ID: <1140348667.729220.156***@o13g2000cwo.googlegroups.com> > 'Subject: If ... Then Loop ?' on 19th Feb and was asked to clarify some > of the terminology and define more clearly what help he was after, hence > I presume this longer post :) Michael
Show quote
Hide quote
"Michael C" <nospam@nospam.com> wrote in message For me, it's Way Too Many Extraneous Capital Letters. Unless this is the news:u2sRc4KQGHA.3856@TK2MSFTNGP12.phx.gbl... >> Hi Everyone, >> >> This is Lotto Based. >> There is a System in Lotto called "Wheels". >> A Lotto Wheeling System is a Special Pattern to Arrange Numbers into >> Combinations. This System can be Used Over and Over again with >> Different >> Numbers. A Lotto Wheel is Constructed in such a way that if the Winning > ..... >> 3 Numbers. If it does, then that Combination of 3 if 5 is Covered and >> Added to the Total and there is NO Need to Continue to Check for that >> Particular Combination Any Further. You then go onto the Next >> Combination to Check and so on Until ALL Combinations have been Cycled >> through and Checked with the Wheel. > > > woooooooo, way too much text. longest book title ever.... Jeff Johnson [MVP: VB] wrote:
Show quoteHide quote > "Michael C" <nospam@nospam.com> wrote in message not to mention too many separate message threads.> news:u2sRc4KQGHA.3856@TK2MSFTNGP12.phx.gbl... > >>> Hi Everyone, >>> >>> This is Lotto Based. >>> There is a System in Lotto called "Wheels". >>> A Lotto Wheeling System is a Special Pattern to Arrange Numbers into >>> Combinations. This System can be Used Over and Over again with >>> Different >>> Numbers. A Lotto Wheel is Constructed in such a way that if the Winning >> ..... >>> 3 Numbers. If it does, then that Combination of 3 if 5 is Covered and >>> Added to the Total and there is NO Need to Continue to Check for that >>> Particular Combination Any Further. You then go onto the Next >>> Combination to Check and so on Until ALL Combinations have been Cycled >>> through and Checked with the Wheel. >> >> woooooooo, way too much text. > > For me, it's Way Too Many Extraneous Capital Letters. Unless this is the > longest book title ever.... > > Bob -- okay, fine, so I just did. deal. Thanks to everyone who has replied.
I have been off line for a while so appologies for not answering sooner. I think I have probably used the word subset in error. I am basically just trying to cycle through the combinations already in the Wheel and find out the coverage ( total combinations for each category ). Any other help will be appreciated. Thanks in advance. All the Best. Paul |
|||||||||||||||||||||||