Welcome Guest
You last visited April 23, 2017, 5:30 pm
All times shown are
Eastern Time (GMT-5:00)

# Formula

Topic closed. 4 replies. Last post 2 years ago by SergeM.

 Page 1 of 1
New Member
Makati
Philippines
Member #159196
September 17, 2014
19 Posts
Offline
 Posted: June 5, 2015, 5:40 am - IP Logged

Hello lottery mathematician. Could you help me on a formula where I can remove the number of combination for straight combination in Lotto

For example in a 6/42 Lotto game which has a Total Combinations of 5,245,786

If you eliminate 1,2,3,4,5,6 combination the total combinations would be 5,245,785

My purpose is to reduce the number of combination

Thank you very much

Do not cry for money it doesn't cry for you

The Quantum Master
West Concord, MN
United States
Member #21
December 7, 2001
3807 Posts
Offline
 Posted: June 5, 2015, 11:47 am - IP Logged

What you might need is a way to convert a combination to an index number and back.

We have a Macro Excel sheet with a function for converting any combination to an index number and one for the reverse operation.

 Index Value ⇒ Index to Combination ⇒ Combination Separated ⇒ Combination to Index 1 01 02 03 04 05 06 1 2 3 4 5 6 1 2 01 02 03 04 05 07 1 2 3 4 5 7 2 3 01 02 03 04 05 08 1 2 3 4 5 8 3 400 01 02 03 04 17 39 1 2 3 4 17 39 400 500 01 02 03 04 22 29 1 2 3 4 22 29 500 600 01 02 03 04 28 30 1 2 3 4 28 30 600 5245786 37 38 39 40 41 42 37 38 39 40 41 42 5245786 4970739 16 18 26 27 33 40 16 18 26 27 33 40 4970739 2845703 05 16 19 26 28 29 5 16 19 26 28 29 2845703 565432 01 11 17 21 30 33 1 11 17 21 30 33 565432 285273 01 05 12 24 38 41 1 5 12 24 38 41 285273 5160055 20 24 25 31 39 40 20 24 25 31 39 40 5160055 3535127 07 15 21 25 28 29 7 15 21 25 28 29 3535127 3612379 07 24 27 29 34 42 7 24 27 29 34 42 3612379 2302424 04 11 17 32 41 42 4 11 17 32 41 42 2302424 4487671 11 21 27 32 41 42 11 21 27 32 41 42 4487671 3759255 08 13 14 17 28 36 8 13 14 17 28 36 3759255 3073279 06 10 14 16 19 31 6 10 14 16 19 31 3073279 733528 01 22 31 35 40 42 1 22 31 35 40 42 733528 229241 01 04 15 26 27 42 1 4 15 26 27 42 229241 397337 01 07 12 36 39 41 1 7 12 36 39 41 397337 4520820 12 13 18 19 33 39 12 13 18 19 33 39 4520820 3610716 07 23 32 34 36 41 7 23 32 34 36 41 3610716 416893 01 07 20 27 28 30 1 7 20 27 28 30 416893

If you don't want to download the files, here is the VB Code for each of the functions.

____________________________________________________________________________________________________

Function Fact(ByVal N As Integer) As Double
If (N <= 1) Then
Fact = 1
Else
Fact = N * Fact(N - 1)
End If
End Function

Function Perm(ByVal N As Integer, ByVal R As Integer) As Double
Dim a As Integer
Dim b As Double
b = 1
If (N < R) Then
Perm = 0
Else
For a = (N - (R - 1)) To N
b = b * a
Next a
Perm = b
End If
End Function

Function Comb(ByVal N As Integer, ByVal R As Integer) As Double
If (N < R) Then
Comb = 0
Else
Comb = Perm(N, R) / Fact(R)
End If
End Function

Function Cdist(ByVal N As Integer, ByVal R As Integer, ByVal C As Integer, ByVal Z As Integer) As Double
If ((Z < C) Or (Z > (N - (R - C))) Or (Z > N) Or (C > R) Or (N < 1) Or (R < 1) Or (C < 1) Or (Z < 1)) Then
Cdist = 0
Else
Cdist = Comb((Z - 1), (C - 1)) * Comb((N - Z), (R - C))
End If
End Function

Function fColumnSum(ByVal N As Integer, ByVal R As Integer, ByVal Z As Integer) As Double
Dim a As Integer
Dim ColumnSum As Double
If (Z < 1) Then
fColumnSum = 0
ElseIf ((Z >= 1) And (Z < (N - (R - 1)))) Then
ColumnSum = 0
For a = 1 To Z
ColumnSum = ColumnSum + Cdist(N, R, 1, a)
Next a
fColumnSum = ColumnSum
ElseIf (Z >= (N - (R - 1))) Then
fColumnSum = Comb(N, R)
End If
End Function

Function Index2Combin(ByVal N As Integer, ByVal R As Integer, ByVal I As Long) As String
Dim a, b, Combination(), Z As Integer
Dim C, J As Long
ReDim Combination(R)
Dim tmpString, CombinFormat As String
Dim NumberFound As Boolean
tmpString = ""
CombinFormat = ""
C = Comb(N, R)
J = I
J = J - 1
Z = 0
b = Len(Format(N, "0"))
For a = 1 To b
CombinFormat = CombinFormat & "0"
Next a
For a = 1 To R
If ((I >= 1) And (I <= C)) Then
If (a = 1) Then
Combination(a) = 1
Else
Combination(a) = Combination(a - 1) + 1
End If
NumberFound = False
Do
Select Case (J - fColumnSum((N - Z), (R - (a - 1)), (Combination(a) - (Z + 1))))
Case Is < 0
Combination(a) = Combination(a) - 1
NumberFound = True
Case Is = 0
NumberFound = True
Case Is > 0
Combination(a) = Combination(a) + 1
End Select
Loop Until NumberFound
J = J - fColumnSum((N - Z), (R - (a - 1)), (Combination(a) - (Z + 1)))
Z = Combination(a)
Else
Combination(a) = 0
End If
tmpString = tmpString & Format(Combination(a), CombinFormat)
If (a < R) Then tmpString = tmpString & " "
Next a
Index2Combin = tmpString
End Function

Function Combin2Index(ByVal N As Integer, ByVal R As Integer, ByVal theRange As Range) As Double
Dim a As Integer
Dim fSum As Double
Dim NotInAscendingOrder, NotInPool As Boolean
NotInAscendingOrder = False
NotInPool = False
If ((theRange.Rows.Count <> 1) Or (theRange.Columns.Count <> R)) Then
Combin2Index = -1
Exit Function
End If
For a = 1 To R
If (a < R) Then
If (theRange.Cells(1, a) >= theRange.Cells(1, (a + 1))) Then
NotInAscendingOrder = True
End If
End If
If ((theRange.Cells(1, a) < 1) Or (theRange.Cells(1, a) > N)) Then
NotInPool = True
End If
Next a
If (NotInAscendingOrder Or NotInPool) Then
Combin2Index = -1
Exit Function
End If
fSum = 1
For a = 1 To R
If (a = 1) Then
fSum = fSum + fColumnSum(N, R, (theRange.Cells(1, 1) - 1))
Else
fSum = fSum + fColumnSum((N - theRange.Cells(1, (a - 1))), (R - (a - 1)), (theRange.Cells(1, a) - (theRange.Cells(1, (a - 1)) + 1)))
End If
Next a
Combin2Index = fSum
End Function

____________________________________________________________________________________________________

Presented 'AS IS' and for Entertainment Purposes Only.
Any gain or loss is your responsibility.

Order is a Subset of Chaos
Knowledge is Beyond Belief
Wisdom is Not Censored
Douglas Paul Smallish
Jehocifer

Dallas, Texas
United States
Member #4549
May 2, 2004
1875 Posts
Offline
 Posted: June 5, 2015, 12:06 pm - IP Logged

Hello lottery mathematician. Could you help me on a formula where I can remove the number of combination for straight combination in Lotto

For example in a 6/42 Lotto game which has a Total Combinations of 5,245,786

If you eliminate 1,2,3,4,5,6 combination the total combinations would be 5,245,785

My purpose is to reduce the number of combination

Thank you very much

You have 37 combinations that meet your straight combination criteria.

1, 2, 3, 4, 5, 6

2, 3, 4, 5, 6, 7

3, 4, 5, 6, 7, 8

4, 5, 6, 7, 8, 9

5, 6, 7, 8, 9, 10

6, 7, 8, 9, 10, 11

7, 8, 9, 10, 11, 12

8, 9, 10, 11, 12, 13

9, 10, 11, 12, 13, 14

10, 11, 12, 13, 14, 15

11, 12, 13, 14, 15, 16

12, 13, 14, 15, 16, 17

13, 14, 15, 16, 17, 18

14, 15, 16, 17, 18, 19

15, 16, 17, 18, 19, 20

16, 17, 18, 19, 20, 21

17, 18, 19, 20, 21, 22

18, 19, 20, 21, 22, 23

19, 20, 21, 22, 23, 24

20, 21, 22, 23, 24, 25

21, 22, 23, 24, 25, 26

22, 23, 24, 25, 26, 27

23, 24, 25, 26, 27, 28

24, 25, 26, 27, 28, 29

25, 26, 27, 28, 29, 30

26, 27, 28, 29, 30, 31

27, 28, 29, 30, 31, 32

28, 29, 30, 31, 32, 33

29, 30, 31, 32, 33, 34

30, 31, 32, 33, 34, 35

31, 32, 33, 34, 35, 36

32, 33, 34, 35, 36, 37

33, 34, 35, 36, 37, 38

34, 35, 36, 37, 38, 39

35, 36, 37, 38, 39, 40

36, 37, 38, 39, 40, 41

37, 38, 39, 40, 41, 42

My greatest accomplishment is teaching cats about Vienna Sausage. When I need a friend, all I need do is walk outside, pop open a can, and every little critter in the neighborhood drops by to say "Hi!"

The Quantum Master
West Concord, MN
United States
Member #21
December 7, 2001
3807 Posts
Offline
 Posted: June 5, 2015, 3:40 pm - IP Logged

What you might need is a way to convert a combination to an index number and back.

We have a Macro Excel sheet with a function for converting any combination to an index number and one for the reverse operation.

 Index Value ⇒ Index to Combination ⇒ Combination Separated ⇒ Combination to Index 1 01 02 03 04 05 06 1 2 3 4 5 6 1 2 01 02 03 04 05 07 1 2 3 4 5 7 2 3 01 02 03 04 05 08 1 2 3 4 5 8 3 400 01 02 03 04 17 39 1 2 3 4 17 39 400 500 01 02 03 04 22 29 1 2 3 4 22 29 500 600 01 02 03 04 28 30 1 2 3 4 28 30 600 5245786 37 38 39 40 41 42 37 38 39 40 41 42 5245786 4970739 16 18 26 27 33 40 16 18 26 27 33 40 4970739 2845703 05 16 19 26 28 29 5 16 19 26 28 29 2845703 565432 01 11 17 21 30 33 1 11 17 21 30 33 565432 285273 01 05 12 24 38 41 1 5 12 24 38 41 285273 5160055 20 24 25 31 39 40 20 24 25 31 39 40 5160055 3535127 07 15 21 25 28 29 7 15 21 25 28 29 3535127 3612379 07 24 27 29 34 42 7 24 27 29 34 42 3612379 2302424 04 11 17 32 41 42 4 11 17 32 41 42 2302424 4487671 11 21 27 32 41 42 11 21 27 32 41 42 4487671 3759255 08 13 14 17 28 36 8 13 14 17 28 36 3759255 3073279 06 10 14 16 19 31 6 10 14 16 19 31 3073279 733528 01 22 31 35 40 42 1 22 31 35 40 42 733528 229241 01 04 15 26 27 42 1 4 15 26 27 42 229241 397337 01 07 12 36 39 41 1 7 12 36 39 41 397337 4520820 12 13 18 19 33 39 12 13 18 19 33 39 4520820 3610716 07 23 32 34 36 41 7 23 32 34 36 41 3610716 416893 01 07 20 27 28 30 1 7 20 27 28 30 416893

If you don't want to download the files, here is the VB Code for each of the functions.

____________________________________________________________________________________________________

Function Fact(ByVal N As Integer) As Double
If (N <= 1) Then
Fact = 1
Else
Fact = N * Fact(N - 1)
End If
End Function

Function Perm(ByVal N As Integer, ByVal R As Integer) As Double
Dim a As Integer
Dim b As Double
b = 1
If (N < R) Then
Perm = 0
Else
For a = (N - (R - 1)) To N
b = b * a
Next a
Perm = b
End If
End Function

Function Comb(ByVal N As Integer, ByVal R As Integer) As Double
If (N < R) Then
Comb = 0
Else
Comb = Perm(N, R) / Fact(R)
End If
End Function

Function Cdist(ByVal N As Integer, ByVal R As Integer, ByVal C As Integer, ByVal Z As Integer) As Double
If ((Z < C) Or (Z > (N - (R - C))) Or (Z > N) Or (C > R) Or (N < 1) Or (R < 1) Or (C < 1) Or (Z < 1)) Then
Cdist = 0
Else
Cdist = Comb((Z - 1), (C - 1)) * Comb((N - Z), (R - C))
End If
End Function

Function fColumnSum(ByVal N As Integer, ByVal R As Integer, ByVal Z As Integer) As Double
Dim a As Integer
Dim ColumnSum As Double
If (Z < 1) Then
fColumnSum = 0
ElseIf ((Z >= 1) And (Z < (N - (R - 1)))) Then
ColumnSum = 0
For a = 1 To Z
ColumnSum = ColumnSum + Cdist(N, R, 1, a)
Next a
fColumnSum = ColumnSum
ElseIf (Z >= (N - (R - 1))) Then
fColumnSum = Comb(N, R)
End If
End Function

Function Index2Combin(ByVal N As Integer, ByVal R As Integer, ByVal I As Long) As String
Dim a, b, Combination(), Z As Integer
Dim C, J As Long
ReDim Combination(R)
Dim tmpString, CombinFormat As String
Dim NumberFound As Boolean
tmpString = ""
CombinFormat = ""
C = Comb(N, R)
J = I
J = J - 1
Z = 0
b = Len(Format(N, "0"))
For a = 1 To b
CombinFormat = CombinFormat & "0"
Next a
For a = 1 To R
If ((I >= 1) And (I <= C)) Then
If (a = 1) Then
Combination(a) = 1
Else
Combination(a) = Combination(a - 1) + 1
End If
NumberFound = False
Do
Select Case (J - fColumnSum((N - Z), (R - (a - 1)), (Combination(a) - (Z + 1))))
Case Is < 0
Combination(a) = Combination(a) - 1
NumberFound = True
Case Is = 0
NumberFound = True
Case Is > 0
Combination(a) = Combination(a) + 1
End Select
Loop Until NumberFound
J = J - fColumnSum((N - Z), (R - (a - 1)), (Combination(a) - (Z + 1)))
Z = Combination(a)
Else
Combination(a) = 0
End If
tmpString = tmpString & Format(Combination(a), CombinFormat)
If (a < R) Then tmpString = tmpString & " "
Next a
Index2Combin = tmpString
End Function

Function Combin2Index(ByVal N As Integer, ByVal R As Integer, ByVal theRange As Range) As Double
Dim a As Integer
Dim fSum As Double
Dim NotInAscendingOrder, NotInPool As Boolean
NotInAscendingOrder = False
NotInPool = False
If ((theRange.Rows.Count <> 1) Or (theRange.Columns.Count <> R)) Then
Combin2Index = -1
Exit Function
End If
For a = 1 To R
If (a < R) Then
If (theRange.Cells(1, a) >= theRange.Cells(1, (a + 1))) Then
NotInAscendingOrder = True
End If
End If
If ((theRange.Cells(1, a) < 1) Or (theRange.Cells(1, a) > N)) Then
NotInPool = True
End If
Next a
If (NotInAscendingOrder Or NotInPool) Then
Combin2Index = -1
Exit Function
End If
fSum = 1
For a = 1 To R
If (a = 1) Then
fSum = fSum + fColumnSum(N, R, (theRange.Cells(1, 1) - 1))
Else
fSum = fSum + fColumnSum((N - theRange.Cells(1, (a - 1))), (R - (a - 1)), (theRange.Cells(1, a) - (theRange.Cells(1, (a - 1)) + 1)))
End If
Next a
Combin2Index = fSum
End Function

____________________________________________________________________________________________________

Presented 'AS IS' and for Entertainment Purposes Only.
Any gain or loss is your responsibility.

Order is a Subset of Chaos
Knowledge is Beyond Belief
Wisdom is Not Censored
Douglas Paul Smallish
Jehocifer

Economy class
Belgium
Member #123700
February 27, 2012
4035 Posts
Offline
 Posted: June 5, 2015, 5:29 pm - IP Logged

Write all combinations on paper. Strike through every second combination. Simulate a winning situation. Calculate the payout.

 Page 1 of 1