CSN

tomtom

Member
I have seen several times an expression Combination Sequence Number or CSN. Anybody is willing to give some basic details in relation to the CSN???
 

PAB

Member
Hi tomtom,

A CSN ( Combination Sequence Number ) is also known as a Lexicographic Index Number. This is a Unique Combination Number.
For Example, in a 649 Lotto, which Produces 13,983,816 Combinations, the First CSN Number is One and gives you the Combination 1-2-3-4-5-6, the Last CSN Number is 13,983,816 and gives you the Combination 44-45-46-47-48-49.

I Hope this Helps
All the Best
PAB
:wavey:
 

tomtom

Member
Hi Pab,

I wonder if you have any idea how a Lexicographic Index Number that is for example 1 for the combination 1,2,3,4,5,6 can be related to the trios 1,2,3 or 2,3,5?
 

tomtom

Member
tomtom said:
Hi Pab,

I wonder if you have any idea how a Lexicographic Index Number that is for example 1 for the combination 1,2,3,4,5,6 can be related to the trios 1,2,3 or 2,3,5?
I was reading some covering stuff, and it seems that there exists relationship between a combination and any (and all) subset(s) of the same combination by the means of Lexicographic Index Number. Any opinion about this?
 

PAB

Member
Hi tomtom,

There are a Total of 20 Combinations of 3 Numbers from 6.
The Lexicographic Index Number for ALL 20 Combinations ( Including 1-2-3 & 2-3-5 which you wanted ) are as Follows :-

CSN ( Lexicographic ) No 01 = 1-2-3
CSN ( Lexicographic ) No 02 = 1-2-4
CSN ( Lexicographic ) No 03 = 1-2-5
CSN ( Lexicographic ) No 04 = 1-2-6
CSN ( Lexicographic ) No 05 = 1-3-4
CSN ( Lexicographic ) No 06 = 1-3-5
CSN ( Lexicographic ) No 07 = 1-3-6
CSN ( Lexicographic ) No 08 = 1-4-5
CSN ( Lexicographic ) No 09 = 1-4-6
CSN ( Lexicographic ) No 10 = 1-5-6
CSN ( Lexicographic ) No 11 = 2-3-4
CSN ( Lexicographic ) No 12 = 2-3-5
CSN ( Lexicographic ) No 13 = 2-3-6
CSN ( Lexicographic ) No 14 = 2-4-5
CSN ( Lexicographic ) No 15 = 2-4-6
CSN ( Lexicographic ) No 16 = 2-5-6
CSN ( Lexicographic ) No 17 = 3-4-5
CSN ( Lexicographic ) No 18 = 3-4-6
CSN ( Lexicographic ) No 19 = 3-5-6
CSN ( Lexicographic ) No 20 = 4-5-6

Good Luck
All the Best
PAB
:wavey:
 

tomtom

Member
I guess I asked my question wrongly…Well, let me clarify it. I did some search around the Net regarding wheels and coverings. My conclusion is that many if not all of those wheels that hold some records in covering 3/6 in 49 etc… were essentially arranged by looking at (and looking for) some Lexicographic Index Numbers only. Therefore, I wonder what is the significance of a Lexicographic Index Number in covering.
 

johnph77

Member
Lexicographic index numbers for 1-2-3 will be 1 through 15,180. Others depend on what the other numbers are, but will be 15,180 combinations for any specific 3 numbers in a 6/49 lottery.
 

tomtom

Member
johnph77 said:
Lexicographic index numbers for 1-2-3 will be 1 through 15,180. Others depend on what the other numbers are, but will be 15,180 combinations for any specific 3 numbers in a 6/49 lottery.

Thanks johnph77.
It makes sense. Therefore, about 14mill/15180= 922 tickets is necessary to play for a sure 3 of 3 in 49.
 
Here some very good code:

Search Forum below for more code.

http://www.visualbasicforum.com/showthread.php?t=168296&highlight=lotto




VB:

Option Explicit
'
' Odometer-style Combination generating functions
' by MathImagics (Dr Memory) 2004
'
' SetCombination
' NextCombination
' ThisCombination
'
Dim Cwheel() As Long

Public Sub SetCombination(ByVal N As Long, ByVal K As Long, ByVal Combn As String)

ReDim token(K) As String
token = Split(Combn, ",")

If UBound(token) <> K - 1 Then Exit Sub

Dim W As Long

ReDim Cwheel(0 To K)

For W = 1 To K
Cwheel(W) = Val(token(W - 1))
If Cwheel(W) <= Cwheel(W - 1) Then Exit Sub ' invalid combn
If Cwheel(W) > N Then Exit Sub ' ditto
Next
End Sub

Public Function ThisCombination() As String
'
' Current Combination readout
'
Dim i As Long, Comb As String
Comb = Cwheel(1)
For i = 2 To UBound(Cwheel)
Comb = Comb & ", " & Cwheel(i)
Next
ThisCombination = Comb
End Function


Public Sub NextCombination(ByVal N As Long, ByVal K As Long)
' "Combination Odometer"
'
' By MathImagics: the array Cwheel contains the current
' K items combined, in increasing order.
' Each call to this sub will adjust Cwheel
' so it contains
' the NEXT combination in lex order
'

Dim i As Long
Dim j As Long
i = K
While Cwheel(i) >= N - K + i
i = i - 1 ' find rightmost wheel that allows an increment
If i = 0 Then
' wraps around (natch!)
i = 1
Cwheel(1) = 0
End If
Wend
Cwheel(i) = Cwheel(i) + 1
For j = i + 1 To K
Cwheel(j) = Cwheel(i) + j - i
Next
End Sub

------------------

VB:

Option Explicit

Function Index2Combination( _
ByVal N As Long, ByVal K As Long, ByVal CNO As Variant) As String
'
' by Dr Memory (MathImagics) May 2004
'
' N = # of values (balls)
' K = # selected to combine
' CNO = index number of combination to return
' 1 <= CNO <= Combinations(N, K) < 75 x 10^27
'
'=============================================
Dim NC, V, cCount ' Variants (Decimal)
Dim Wheel As Long, W As Long, Combo As String

NC = Combinations(N, K)
If CNO < 1 Or CNO > NC Then Exit Function

Wheel = 1

cCount = CDec(0) ' running count of combinations

For W = 1 To K - 1
Do
V = Combinations(N - Wheel, K - W) ' how many till next value?
If V = 0 Then Exit Do
If cCount + V >= CNO Then Exit Do
cCount = cCount + V
Wheel = Wheel + 1
Loop
If W = 1 Then Combo = Wheel Else Combo = Combo & ", " & Wheel
Wheel = Wheel + 1
Next
Index2Combination = Combo & ", " & Wheel + (CNO - cCount - 1)
End Function


Function Combination2Index(ByVal N As Long, ByVal K As Long, Combn As String) As Variant
'
' by Dr Memory (MathImagics) May 2004
'
' N = # of values (balls)
' K = # selected to combine
' Combn= list of values, e.g. "2, 7, 9, 23, 40, 45"
' must be in ascending order
'=============================================

ReDim token(K) As String
token = Split(Combn, ",")

If UBound(token) <> K - 1 Then Exit Function

Dim NC, wcount, Wheel() As Long, W As Long
Dim V As Long, msg As String
ReDim Wheel(K)
Combination2Index = CDec(0)
For W = 1 To K
Wheel(W) = Val(token(W - 1))
If Wheel(W) <= Wheel(W - 1) Then Exit Function
If Wheel(W) > N Then Exit Function
Next

For W = 1 To K - 1
For V = Wheel(W - 1) + 1 To Wheel(W) - 1
Combination2Index = Combination2Index + Combinations(N - V, K - W) - 1
Next
Next
Combination2Index = Combination2Index + Wheel(K) - K + 1
End Function

------------------------
 

Sidebar

Top