United States
Member #27,049
November 26, 2005
40,273 Posts
Offline
For a pick 4 wheel which has 4 numbers, the required lines to get every combo straight would be 24 (I believe this is right). This assumes no doubles or triples, etc. What would be the minimum combination for a 5 number wheel? What about a 6 number wheel? Is there a formula anyone is willing to share? Thanks!
Redford/MI United States
Member #3,396
January 18, 2004
4,867 Posts
Offline
Option Explicit
'Written by Myrna Larson - Microsoft Excel MVP Dim vAllItems As Variant Dim Buffer() As String Dim BufferPtr As Long Dim Results As Worksheet
Sub ListPermutations() Dim Rng As Range Dim PopSize As Integer Dim SetSize As Integer Dim Which As String Dim N As Double Const BufferSize As Long = 4096
Set Rng = Range(Range("A1"), Cells(Rows.Count, "A").End(xlUp))
PopSize = Rng.Cells.Count - 2 If PopSize < 2 Then GoTo DataError
SetSize = Rng.Cells(2).Value If SetSize > PopSize Then GoTo DataError
Which = UCase$(Rng.Cells(1).Value) Select Case Which Case "C" N = Application.WorksheetFunction.Combin(PopSize, SetSize) Case "P" N = Application.WorksheetFunction.Permut(PopSize, SetSize) Case Else GoTo DataError End Select If N > Cells.Count Then GoTo DataError
Application.ScreenUpdating = False
Set Results = Worksheets.Add
vAllItems = Rng.Offset(2, 0).Resize(PopSize).Value ReDim Buffer(1 To BufferSize) As String BufferPtr = 0
If Which = "C" Then AddCombination PopSize, SetSize Else AddPermutation PopSize, SetSize End If vAllItems = 0
Application.ScreenUpdating = True Exit Sub
DataError: If N = 0 Then Which = "Enter your data in a vertical range of at least 4 cells. " _ & String$(2, 10) _ & "Top cell must contain the letter C or P, 2nd cell is the number " _ & "of items in a subset, the cells below are the values from which " _ & "the subset is to be chosen."
Else Which = "This requires " & Format$(N, "#,##0") & _ " cells, more than are available on the worksheet!" End If MsgBox Which, vbOKOnly, "DATA ERROR" Exit Sub End Sub
Private Sub AddPermutation(Optional PopSize As Integer = 0, _ Optional SetSize As Integer = 0, _ Optional NextMember As Integer = 0)
Static iPopSize As Integer Static iSetSize As Integer Static SetMembers() As Integer Static Used() As Integer Dim i As Integer
If PopSize <> 0 Then iPopSize = PopSize iSetSize = SetSize ReDim SetMembers(1 To iSetSize) As Integer ReDim Used(1 To iPopSize) As Integer NextMember = 1 End If
For i = 1 To iPopSize If Used(i) = 0 Then SetMembers(NextMember) = i If NextMember <> iSetSize Then Used(i) = True AddPermutation , , NextMember + 1 Used(i) = False Else SavePermutation SetMembers() End If End If Next i
If NextMember = 1 Then SavePermutation SetMembers(), True Erase SetMembers Erase Used End If
End Sub 'AddPermutation
Private Sub AddCombination(Optional PopSize As Integer = 0, _ Optional SetSize As Integer = 0, _ Optional NextMember As Integer = 0, _ Optional NextItem As Integer = 0)
Static iPopSize As Integer Static iSetSize As Integer Static SetMembers() As Integer Dim i As Integer
If PopSize <> 0 Then iPopSize = PopSize iSetSize = SetSize ReDim SetMembers(1 To iSetSize) As Integer NextMember = 1 NextItem = 1 End If
For i = NextItem To iPopSize SetMembers(NextMember) = i If NextMember <> iSetSize Then AddCombination , , NextMember + 1, i + 1 Else SavePermutation SetMembers() End If Next i
If NextMember = 1 Then SavePermutation SetMembers(), True Erase SetMembers End If
End Sub 'AddCombination
Private Sub SavePermutation(ItemsChosen() As Integer, _ Optional FlushBuffer As Boolean = False)
Dim i As Integer, sValue As String Static RowNum As Long, ColNum As Long
If RowNum = 0 Then RowNum = 1 If ColNum = 0 Then ColNum = 1
If FlushBuffer = True Or BufferPtr = UBound(Buffer()) Then If BufferPtr > 0 Then If (RowNum + BufferPtr - 1) > Rows.Count Then RowNum = 1 ColNum = ColNum + 1 If ColNum > 256 Then Exit Sub End If
Results.Cells(RowNum, ColNum).Resize(BufferPtr, 1).Value _ = Application.WorksheetFunction.Transpose(Buffer()) RowNum = RowNum + BufferPtr End If
BufferPtr = 0 If FlushBuffer = True Then Erase Buffer RowNum = 0 ColNum = 0 Exit Sub Else ReDim Buffer(1 To UBound(Buffer)) End If
End If
'construct the next set For i = 1 To UBound(ItemsChosen) sValue = sValue & ", " & vAllItems(ItemsChosen(i), 1) Next i
'and save it in the buffer BufferPtr = BufferPtr + 1 Buffer(BufferPtr) = Mid$(sValue, 3) End Sub 'SavePermutation
United States
Member #27,049
November 26, 2005
40,273 Posts
Offline
thanks Lottaloot - WOW, that's way over my Excel head! I was hoping for something a little less "intimidating"!
Like 4 numbers = 24 combos
Like 5 numbers = XX combos
Like 6 numbers = XXX combos
Is something like this easy to crunch? My guess is it would be way to staggering of a number to actually play all combos past 4 numbers, but would like to know. Thanks again.
New Jersey United States
Member #17,842
June 28, 2005
180,983 Posts
Offline
I'm not sure why you would want to unbox the pick4 numbers to their 24-way, 12-way, 6-way, 4-way combinations. A wealth of information exits in the forums and some of it can be found with the search function:
United States
Member #27,049
November 26, 2005
40,273 Posts
Offline
I'm not sure why you would want to unbox the pick4 numbers to their 24-way, 12-way, 6-way, 4-way combinations. A wealth of information exits in the forums and some of it can be found with the search function:
Michigan United States
Member #22,394
September 24, 2005
1,583 Posts
Offline
If you box a 4 digit number for the Pick4, that will produce 24 possible combinations (as long as each digit is unique i.e. 1,2,3,4 not 1,2,2,3 or 1,2,2,2 or 1,1,1,1). If you were to lay those out separately, you would have 24 tickets. Boxing is simply a convenient way of making those bets. If your digits are the correct ones that are drawn, by boxing (or playing each individually), you will have a straight hit. The reason the payoff is smaller for a boxed $1 ticket is because you are dividing that $1 into 24 pieces. If you wanted to be assured of a full $1 hit, you would purchase 24 individual ticket with 1 combination per ticket.
A 4 digit wheel is different. It only produces 1234. A single ticket. A wheel assures that all the numbers are represented with each other. It does not involve all the possible combinations of those digits.
A 5 digit wheel would be 5 plays or tickets that look like this:
You could, if you wanted, to cover all combinations...box each of those tickets. There is no secret "method or system" here. You are simply placing bets to cover more than one ticket. And we use those words, box/wheel to describe the process.
United States
Member #17,833
June 28, 2005
2,087 Posts
Offline
For a pick 4 wheel which has 4 numbers, the required lines to get every combo straight would be 24 (I believe this is right). This assumes no doubles or triples, etc. What would be the minimum combination for a 5 number wheel? What about a 6 number wheel? Is there a formula anyone is willing to share? Thanks!
I know it's kind of long but, you can filter down what you don't need.
It's based on Every drawing for the past year of 2005. I made this last year and I will be doing another for 2006 just have to wait for some months to pass by.
I'm also working on a straight or hopefully straights more then boxes also.
I have finished typeing out about 2000 of the 10000 combinations...Yes every combination sorted out and then my program keeps track of everything and then spits out what would be the best straight/box hit based on multiple stratigies.
Good Luck to All
P.S. Each line is based upon 1 digit but, if you combine let's say 2 digits and filter out the dups you get a nice stet of #'s.