all possible combiations

Phil F

Member
Hi does anyone know how I can get every possible combination of 6/45 in the Australian lotto eg 1.6.13.25.31.40 /4.12.18.22.26.44 etc I know there are over 8 million combinations
 

tomtom

Member
Phil F said:
Hi does anyone know how I can get every possible combination of 6/45 in the Australian lotto eg 1.6.13.25.31.40 /4.12.18.22.26.44 etc I know there are over 8 million combinations
:teach: Try some search around here, because Mr.GillesD somewhere posted a nice little macro that possibly may do the work.
 

Irvin

Member
Here it is expanded;

(45 x 44 x 43 x 42 x 41 x 40) / (6 x 5 x 4 x 3 x 2 x 1)

I'll let you figure out the answer.


Regards,

Irvin
 

Babarlish

Member
Phil F said:
Hi does anyone know how I can get every possible combination of 6/45 in the Australian lotto eg 1.6.13.25.31.40 /4.12.18.22.26.44 etc I know there are over 8 million combinations

8,145,060 possible combinations ranging from 1-2-3-4-5-6
to 40-41-42-43-44-45.

Pretty nice odds.
What is the Jackpot like?

Baba :teach:
 

johnph77

Member
Information I have on my site indicates three different 6/45 lotteries in Australia with payout percentages dependent on which state(s) in which they were played. All payouts are parimutuel. When I was working on the Keno pages, the Tatts (Tattersall's) games in Victoria had the worst payout percentages (around 50.00%), the others paid out at least 60.00%.

gl

john
 

GillesD

Member
All combinations for a 6 / 45 lottery

The following macro will list all 8,145,060 combinations for a 6 / 45 lottery in the active sheet.

Option Explicit
Dim A As Integer, B As Integer, C As Integer, D As Integer, E As Integer, F As Integer
Dim N As Long, nMinA As Integer, nMaxF As Integer

Sub List_6x45Comb()
' Macro to list combinations in an Excel sheet
Sheets("List_Comb").Select
Range("A1").Select
Application.ScreenUpdating = False
N = 1
Selection.ColumnWidth = 18
ActiveCell.Value = "Comb."
' Change minimum value for A or maximum value for F
' to cover range of values to be covered
nMinA = 1
nMaxF = 45
' Start of loops for 6 variables (A-F)
For A = nMinA To nMaxF - 5
For B = A + 1 To nMaxF - 4
For C = B + 1 To nMaxF - 3
For D = C + 1 To nMaxF - 2
For E = D + 1 To nMaxF - 1
For F = E + 1 To nMaxF
' Verification of number of combinations posted
' and move to top of next column if 65,000
If N = 65001 Then
Selection.ColumnWidth = 18
N = 1
ActiveCell.Offset(-65000, 1).Select
Application.ScreenUpdating = True
Application.ScreenUpdating = False
ActiveCell.Value = "Comb."
End If
' Copying the combination in the form N1-N2-N3-N4-N5-N6 in a cell
ActiveCell.Offset(1, 0).Select
N = N + 1
ActiveCell.Value = Application.WorksheetFunction.Text(A, "00") & "-" _
& Application.WorksheetFunction.Text(B, "00") & "-" _
& Application.WorksheetFunction.Text(C, "00") & "-" _
& Application.WorksheetFunction.Text(D, "00") & "-" _
& Application.WorksheetFunction.Text(E, "00") & "-" _
& Application.WorksheetFunction.Text(F, "00")
Next F
Next E
Next D
Next C
Next B
Next A
Application.ScreenUpdating = True
End Sub
 

Sheba

Member
Re: All combinations for a 6 / 45 lottery

GillesD said:
The following macro will list all 8,145,060 combinations for a 6 / 45 lottery in the active sheet.

Option Explicit
Dim A As Integer, B As Integer, C As Integer, D As Integer, E As Integer, F As Integer
Dim N As Long, nMinA As Integer, nMaxF As Integer

Sub List_6x45Comb()
' Macro to list combinations in an Excel sheet
Sheets("List_Comb").Select
Range("A1").Select
Application.ScreenUpdating = False
N = 1
Selection.ColumnWidth = 18
ActiveCell.Value = "Comb."
' Change minimum value for A or maximum value for F
' to cover range of values to be covered
nMinA = 1
nMaxF = 45
' Start of loops for 6 variables (A-F)
For A = nMinA To nMaxF - 5
For B = A + 1 To nMaxF - 4
For C = B + 1 To nMaxF - 3
For D = C + 1 To nMaxF - 2
For E = D + 1 To nMaxF - 1
For F = E + 1 To nMaxF
' Verification of number of combinations posted
' and move to top of next column if 65,000
If N = 65001 Then
Selection.ColumnWidth = 18
N = 1
ActiveCell.Offset(-65000, 1).Select
Application.ScreenUpdating = True
Application.ScreenUpdating = False
ActiveCell.Value = "Comb."
End If
' Copying the combination in the form N1-N2-N3-N4-N5-N6 in a cell
ActiveCell.Offset(1, 0).Select
N = N + 1
ActiveCell.Value = Application.WorksheetFunction.Text(A, "00") & "-" _
& Application.WorksheetFunction.Text(B, "00") & "-" _
& Application.WorksheetFunction.Text(C, "00") & "-" _
& Application.WorksheetFunction.Text(D, "00") & "-" _
& Application.WorksheetFunction.Text(E, "00") & "-" _
& Application.WorksheetFunction.Text(F, "00")
Next F
Next E
Next D
Next C
Next B
Next A
Application.ScreenUpdating = True
End Sub


Error 9 Subscript out of range???
 

GillesD

Member
All combinations for a 6/45 lottery

Sheba,

The macro runs fine but at the beginning, it looks for a sheet named List_Comb to place the combinations generated. If not found, the error message you indicated stops the macro.

To successfully run the macro, either:
- Name a sheet List_Comb and the combinations will be listed there
- Remove the line Sheets("List_Comb").Select near the top of the macro and the combinations will be listed on the active page whenever you start the macro.
 

Sidebar

Top