Lexicographic 101

larbec

Member
Can anyone give me a crash course in Lexicographic numbers and how to apply them towards the lottery? I have read some on this and still clueless besides it front and back digits. If anyone could walk me through a real example it is most appreciative.

Thanks
 

Frank

Member
Older posts, like this one are a useful read, http://www.lottoforums.com/lottery/questions-answers/2180-lex-order-formula-excel-2.html?


And this thread, including one of PAB's first posts suggests a use . ... http://www.lottoforums.com/lottery/lotto-649/1994-what-numbers-these.html?
 

larbec

Member
Here's where I I, at in "trying" to understand this. Sometimes the simple things to me are harder than they really are lol

I really need or would like someone to walk me through an exercise using whatever lotto they want

The whole numbers (drawn numbers ) produce a Lexi number like 11742113 ,,,,,so what do I do with this?

Frank, can you put on paper or on this wall (post,forum) what's in your head (brain) and go through the steps you do from the time the numbers get drawn to what you do to determine what the next drawn numbers will be? If it's a "guess" I understand , if it's a statistically processed "guess" then explain your thought process please to me. If it's easier to skype me let me know or even a video. If you take the time to do a video I'll darn sure take the time to go through it several times I'd REALLY like to understand this

I've seen on other boards where ppl use Lexi and get 3/5 , some 4/5 and get real close week after week but are reluctant to explain any details how they get their answers

About me.....I'm an Electrical Engineer, Controls guy, Robotics and systems Engineer. I tell you this so you can see where my brain is. I'm very analytical and need a process to go through before it gets in my thick skull lol. The simplest things are hard for me to see lol
 

larbec

Member
I'm reading over the first link (thank you)
Here's one of my brick walls

How does:

11, 041, 994 = 11-18-25--33-40-41
4,161,997 = 3-12-22-27-44-46

I don't understand how Lexi numbers = numbers to play
 

Frank

Member
larbec said:
I'm reading over the first link (thank you)
Here's one of my brick walls
How does:

11, 041, 994 = 11-18-25--33-40-41
4,161,997 = 3-12-22-27-44-46



Well in the same way that a car odometer keeps track of your mileage, you have to have a counting system to understand a readout. We happen normally to use the decimal system, which means that when we increment by one, the rightmost digit of the odometer increases by one. However, when we get to 9 on the last digit and want to increment by one ... the rule says that the last digit goes to zero and then second right digit goes up by one. This rule applies digit by digit working from the right.

So what about a lottery with 49 balls and there are 6 drawn balls ? Each combination starting from 1,2,3,4,5,6 right up to 44,45,46,47,48,49 can be represented by a Combination Sequence number instead. Its easy to do the first and the last numbers 1,2,3,4,5,6 = CSN 1 and 44,45,46,47,48,49 =CSN 13,983,816. Most people exchange CSV for Lex and vice versa.

The rules for indexing are similar to the odometer except when the rightmost figure gets to its highest allowable value for its position when sorted ascending then (after incrementing) its reverts to its lowest allowable value for its position when sorted ascending. The digit to its left is incremented by one (except when it has reached its highest allowable value for its position when sorted ascending) and the rule carries on working right to left. Here are the first 94 CSV values and the combinations they represent. Note carefully what happens when the 6th digit reaches its upper limit ...

CSV..Combination
01..... 1 2 3 4 5 6
02 ..... 1 2 3 4 5 7
03..... 1 2 3 4 5 8
04 ..... 1 2 3 4 5 9
05..... 1 2 3 4 5 10
06..... 1 2 3 4 5 11
07..... 1 2 3 4 5 12
08..... 1 2 3 4 5 13
09..... 1 2 3 4 5 14
10..... 1 2 3 4 5 15
11..... 1 2 3 4 5 16
12..... 1 2 3 4 5 17
13..... 1 2 3 4 5 18
14..... 1 2 3 4 5 19
15..... 1 2 3 4 5 20
16..... 1 2 3 4 5 21
17..... 1 2 3 4 5 22
18..... 1 2 3 4 5 23
19..... 1 2 3 4 5 24
20..... 1 2 3 4 5 25
21..... 1 2 3 4 5 26
22..... 1 2 3 4 5 27
23..... 1 2 3 4 5 28
24..... 1 2 3 4 5 29
25..... 1 2 3 4 5 30
26..... 1 2 3 4 5 31
27..... 1 2 3 4 5 32
28..... 1 2 3 4 5 33
29..... 1 2 3 4 5 34
30..... 1 2 3 4 5 35
31..... 1 2 3 4 5 36
32..... 1 2 3 4 5 37
33..... 1 2 3 4 5 38
34..... 1 2 3 4 5 39
35..... 1 2 3 4 5 40
36..... 1 2 3 4 5 41
37..... 1 2 3 4 5 42
38..... 1 2 3 4 5 43
39..... 1 2 3 4 5 44
40..... 1 2 3 4 5 45
41..... 1 2 3 4 5 46
42..... 1 2 3 4 5 47
43..... 1 2 3 4 5 48
44..... 1 2 3 4 5 49

45..... 1 2 3 4 6 7
46..... 1 2 3 4 6 8
47..... 1 2 3 4 6 9
48..... 1 2 3 4 6 10
49..... 1 2 3 4 6 11
50..... 1 2 3 4 6 12
51..... 1 2 3 4 6 13
52..... 1 2 3 4 6 14
53..... 1 2 3 4 6 15
54..... 1 2 3 4 6 16
55..... 1 2 3 4 6 17
56..... 1 2 3 4 6 18
57..... 1 2 3 4 6 19
58..... 1 2 3 4 6 20
59..... 1 2 3 4 6 21
60..... 1 2 3 4 6 22
61..... 1 2 3 4 6 23
62..... 1 2 3 4 6 24
63..... 1 2 3 4 6 25
64..... 1 2 3 4 6 26
65..... 1 2 3 4 6 27
66..... 1 2 3 4 6 28
67..... 1 2 3 4 6 29
68..... 1 2 3 4 6 30
69..... 1 2 3 4 6 31
70..... 1 2 3 4 6 32
71..... 1 2 3 4 6 33
72..... 1 2 3 4 6 34
73..... 1 2 3 4 6 35
74..... 1 2 3 4 6 36
75..... 1 2 3 4 6 37
76..... 1 2 3 4 6 38
77..... 1 2 3 4 6 39
78..... 1 2 3 4 6 40
79..... 1 2 3 4 6 41
80..... 1 2 3 4 6 42
81..... 1 2 3 4 6 43
82..... 1 2 3 4 6 44
83..... 1 2 3 4 6 45
84..... 1 2 3 4 6 46
85..... 1 2 3 4 6 47
86..... 1 2 3 4 6 48
87..... 1 2 3 4 6 49

88..... 1 2 3 4 7 8
89..... 1 2 3 4 7 9
90..... 1 2 3 4 7 10
91..... 1 2 3 4 7 11
92..... 1 2 3 4 7 12
93..... 1 2 3 4 7 13
94..... 1 2 3 4 7 14

If you keep going with this rule , eventually you will get:-

11, 041, 994.....11-18-25--33-40-41

The Excel fromula first posted by GillesD (its somewhere in those links) will save you the time and effort of doing it by hand. There is also a method of doing a reverse CSV conversion, so you start with a CSV and find out what numbers generated it. GillesD published a macro to do this, I published an on line spreadsheet factoristion method which would to do the same, which PAB made into a dowloadable spreadsheet.

larbec said:
I don't understand how Lexi numbers = numbers to play
Neither do I, and I never said they did. Lex numbers demonstrate that lottery balls are just a fancy window dressing way of choosing a large random number running into the millions without it being obvious how large the odds are against punters. They do provide a vehicle for consolation prizes though.
Converting lotto numbers to Lex can be a convenient way of storing numbers in a computer, sorting them into ascending order and then decoding them back again to ball number set. You can do the same with pairs triples quads etc and refer to the ntuplet by its Lex rather than say 02,34,46.
If you take the first three numbers of a six ball result as drawn, sort to ascending order and get their CSN, then take the last three numbers as drawn, sort in ascending order and get their lex, you get a pair of cartesian co-ordinates which can be plotted as a scatter graph. The whole lottery can be seen on an X-Y plane, you can spot clusters and empty space. Its a bit quirky but its an example of things that can be done.
But as for Lex numbers= numbers to play then read one of my links above. Convert your birthday to Lex format and get the numbers they represent. You never know. :) :beer:
 

larbec

Member
It's a little clearer but the light bulb is a little dim yet lol. I'll keep reading. My obstacle is you said I'd eventually get to 11,041,997 will = 3-12-22-27-44-47
 

Frank

Member
Play about on a spreadsheet.


The following is taken from the above links. Original poster GillesD.
-------------------------------------------------------------------------------------------
The following formula works fine for a 6/49 lottery:

=COMBIN(49,6)-IF(44-N1>0,COMBIN(49-N1,6),0)-IF(45-N2>0,COMBIN(49-N2,5),0)-IF(46-N3>0,COMBIN(49-N3,4),0)-IF(47-N4>0,COMBIN(49-N4,3),0)-IF(48-N5>0,COMBIN(49-N5,2),0)-IF(49-N6>0,COMBIN(49-N6,1),0)

where N1, N2 ... N6 are the respective numbers (in ascending order) you want the lex number. You can also replace these values by a reference to cells where they are in a sheet.


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


And going the other way from a Lex back to numbers......

The following macro does the job. It just goes through all combinations until it reaches the lex value that is entered in cell A1. It then places the numbers N1 to N6 in cells B1 to G1.

A formula might be faster and more elegant but brute force does the job here while we come up with something.

Listing for the macro LexToNumbers:

Option Explicit

Dim A As Integer, B As Integer, C As Integer, D As Integer, E As Integer, F As Integer
Dim nVal As Double, nLex As Double

Sub LexToNumbers()
nVal = Range("A1").Value
nLex = 0
For A = 1 To 44
For B = A + 1 To 45
For C = B + 1 To 46
For D = C + 1 To 47
For E = D + 1 To 48
For F = E + 1 To 49
nLex = nLex + 1
If nLex = nVal Then
Range("B1").Value = A
Range("C1").Value = B
Range("D1").Value = C
Range("E1").Value = D
Range("F1").Value = E
Range("G1").Value = F
Exit Sub
End If
Next F
Next E
Next D
Next C
Next B
Next A
End Sub


---------------------------------------------------------------------
Have a play with it...Pick some changeover numbers like

23 ,27,43 ,47,48 ,49 and get the lex.
Then try 23,27,43,46,47,48 and get the lex
theres a difference of 3 in the Lex value.

Remember numbers, because they have to be sorted in order and sit in their ordered positions, they are 'locked' by the rule that sets a maximum value of 44 in position 1, 45 in position 2, 46 in position 3, 47 in position 4, 48 in position 5 and 49 in position 6. Any attempted increment in Lex forces the digits to revert to the rules I set above, whilst flipping to the lowest allowable rightmost digits still keeping the balls in their order. :)
 

Icewynd

Member
Interesting stuff, Frank.

I have GilesD's formula in my spreadsheet and everytime I update I look at it and think "What the heck am I supposed to do with that?"

Seems to bounce around a lot. Its sort of like sums -- if the average is too high or too low, you could look for some lower/higher combinations. But not much real use for it that I can see.

Good Luck!
:thumb:
 

larbec

Member
Frank,

Do you know what is change in the Macro and/or formula to say the mega million. 5/75 1/15 or Lotto Texas 6/54
Frank said:
Play about on a spreadsheet.


The following is taken from the above links. Original poster GillesD.
-------------------------------------------------------------------------------------------
The following formula works fine for a 6/49 lottery:

=COMBIN(49,6)-IF(44-N1>0,COMBIN(49-N1,6),0)-IF(45-N2>0,COMBIN(49-N2,5),0)-IF(46-N3>0,COMBIN(49-N3,4),0)-IF(47-N4>0,COMBIN(49-N4,3),0)-IF(48-N5>0,COMBIN(49-N5,2),0)-IF(49-N6>0,COMBIN(49-N6,1),0)

where N1, N2 ... N6 are the respective numbers (in ascending order) you want the lex number. You can also replace these values by a reference to cells where they are in a sheet.


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


And going the other way from a Lex back to numbers......

The following macro does the job. It just goes through all combinations until it reaches the lex value that is entered in cell A1. It then places the numbers N1 to N6 in cells B1 to G1.

A formula might be faster and more elegant but brute force does the job here while we come up with something.

Listing for the macro LexToNumbers:

Option Explicit

Dim A As Integer, B As Integer, C As Integer, D As Integer, E As Integer, F As Integer
Dim nVal As Double, nLex As Double

Sub LexToNumbers()
nVal = Range("A1").Value
nLex = 0
For A = 1 To 44
For B = A + 1 To 45
For C = B + 1 To 46
For D = C + 1 To 47
For E = D + 1 To 48
For F = E + 1 To 49
nLex = nLex + 1
If nLex = nVal Then
Range("B1").Value = A
Range("C1").Value = B
Range("D1").Value = C
Range("E1").Value = D
Range("F1").Value = E
Range("G1").Value = F
Exit Sub
End If
Next F
Next E
Next D
Next C
Next B
Next A
End Sub
M

---------------------------------------------------------------------
Have a play with it...Pick some changeover numbers like

23 ,27,43 ,47,48 ,49 and get the lex.
Then try 23,27,43,46,47,48 and get the lex
theres a difference of 3 in the Lex value.

Remember numbers, because they have to be sorted in order and sit in their ordered positions, they are 'locked' by the rule that sets a maximum value of 44 in position 1, 45 in position 2, 46 in position 3, 47 in position 4, 48 in position 5 and 49 in position 6. Any attempted increment in Lex forces the digits to revert to the rules I set above, whilst flipping to the lowest allowable rightmost digits still keeping the balls in their order. :)
 
Frank said:
Well in the same way that a car odometer keeps track of your mileage, you have to have a counting system to understand a readout. We happen normally to use the decimal system, which means that when we increment by one, the rightmost digit of the odometer increases by one. However, when we get to 9 on the last digit and want to increment by one ... the rule says that the last digit goes to zero and then second right digit goes up by one. This rule applies digit by digit working from the right.

So what about a lottery with 49 balls and there are 6 drawn balls ? Each combination starting from 1,2,3,4,5,6 right up to 44,45,46,47,48,49 can be represented by a Combination Sequence number instead. Its easy to do the first and the last numbers 1,2,3,4,5,6 = CSN 1 and 44,45,46,47,48,49 =CSN 13,983,816. Most people exchange CSV for Lex and vice versa.

...
Brilliant explanation Frank. Thanks!
 

Frank

Member
Thanks TheConcept for your comments, much appreciated.

Larbec:-

try this for the Megamillion 5/75

To get CSV from numbers entered
type ( or copy/paste) in cell A1 this formula:-

=IF(C1<>0,COMBIN(75,5)-IF(71-C1>0,COMBIN(75-C1,5),0)-IF(72-D1>0,COMBIN(75-D1,4),0)-IF(73-E1>0,COMBIN(75-E1,3),0)-IF(74-F1>0,COMBIN(75-F1,2),0)-IF(75-G1>0,COMBIN(75-G1,1),0),0)

Then, enter Your numbers in cells C1,D1,E1,F1,G1 to get CSV in cell A1.

To get a set of numbers from an entered CSV (0 to17,259,390) then use this Macro:_


Sub LexToNumbersMegamillions() '5/75

Dim A As Integer, B As Integer, C As Integer, D As Integer, E As Integer, F As Integer
Dim nVal As Double, nLex As Double

nVal = Range("A1").Value
nLex = 0
For A = 1 To 71
For B = A + 1 To 72
For C = B + 1 To 73
For D = C + 1 To 74
For E = D + 1 To 75

nLex = nLex + 1
If nLex = nVal Then
Range("B1").Value = A
Range("C1").Value = B
Range("D1").Value = C
Range("E1").Value = D
Range("F1").Value = E

Exit Sub
End If

Next E
Next D
Next C
Next B
Next A
End Sub

Note:- Use a different Excel sheet from the first one above
to avoid confusion before running this macro

so enter your CSV value into cell A1 on this different sheet to get the numbers (run the macro) in cells B1,C1,D1,E1,F1 which that CSV represent.

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

For Texas 5/54 then on another sheet type (or copy/paste) in cell A1 this formula:-

=IF(B1<>0,COMBIN(54,6)-IF(49-B1>0,COMBIN(54-B1,6),0)-IF(50-C1>0,COMBIN(54-C1,5),0)-IF(51-D1>0,COMBIN(54-D1,4),0)-IF(52-E1>0,COMBIN(54-E1,3),0)-IF(53-F1>0,COMBIN(54-F1,2),0)-IF(54-G1>0,COMBIN(54-G1,1),0),0)

Enter your 6 numbers in cells:- B1,C1,D1,E1,F1,G1 to get the CSV output in cell A1.

To get a set of numbers from an entered CSV ( 0 to 25,827,165) then use this Macro:-

Sub LexToNumbersTexas() '6/54
Dim A As Integer, B As Integer, C As Integer, D As Integer, E As Integer, F As Integer
Dim nVal As Double, nLex As Double

nVal = Range("A1").Value
nLex = 0
For A = 1 To 49
For B = A + 1 To 50
For C = B + 1 To 51
For D = C + 1 To 52
For E = D + 1 To 53
For F = E + 1 To 54
nLex = nLex + 1
If nLex = nVal Then
Range("B1").Value = A
Range("C1").Value = B
Range("D1").Value = C
Range("E1").Value = D
Range("F1").Value = E
Range("G1").Value = F
Exit Sub
End If
Next F
Next E
Next D
Next C
Next B
Next A
End Sub

Note:- Use a different Excel sheet from the previous ones above
to avoid confision before running this macro

so enter your CSV value into cell A1 on this different sheet to get the numbers (run the macro) in cells B1,C1,D1,E1,F1,G1

Whichever Macro module(s) you have the macros on, should have at the very top (before any Sub appears ) Option Explicit

Good luck!

 

larbec

Member
Sorry for late reply Frank. Had really bad sinus infection past week and half. Err. Will try this tonight. Again THANK YOU
 

Sidebar

Top