Lotto Forums
Click Here For Your Free Lottery Report

Go Back   Lotto Forums > Lotto Forums Players Toolbox > Lotto Software

Lotto Software Let Your Puter Pick the Winners.

Reply
 
Thread Tools Display Modes
  #1  
Old 07-24-2006, 03:44 AM
JackpotJockey JackpotJockey is offline
Registered User
 
Join Date: Jul 2006
Posts: 3
Curious as to the "real" number of possible draws (code help)

Hello all,


Sorry if I jumped into a wrong forum, as this is more to do with math and code, than actual lottery. Quick scan of forum sections didn't reveal a spot suitable for my question. So I am posting here.

Lotto stuff has always been awesome for learning programming, which is what I am doing to get my limited and extremely rusty vb6 knowledge up to speed and (actually) learn VB.NET. Of course hoping for a side benefit of a win sure helps with staring at textbooks.

The curious thing I ran across is this:

Everyone claims, and I am in full mathematical agreement that in a 6/49 lottery the number of possible draws is :

49!/(6!*(49 - 6)!) or 13,983,816

Now, what I have done is try to code a small app that will generate all of them. Pretty useless but that is irelevant to the issue.

The way I worked it, and I am a newbie at programming, is to simply go :

1-2-3-4-5-6
1-2-3-4-5-7
1-2-3-4-5-8
1-2-3-4-5-9
1-2-3-4-5-10
.....
1-2-3-4-5-48
1-2-3-4-5-49
1-2-3-4-6-7
etc

Notice the switch once i hit 49 the previous number goes +1 and the following go from previous+1 to 49 and so on.

This is the visual basic code for those who know how to code and can read - be gentle I am newb at this:

[code] Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click
Dim i As Long
Dim n6 As Integer
Dim n5 As Integer
Dim n4 As Integer
Dim n3 As Integer
Dim n2 As Integer
Dim n1 As Integer

For n1 = 1 To 43
For n2 = n1 + 1 To 44
For n3 = n2 + 1 To 45
For n4 = n3 + 1 To 46
For n5 = n4 + 1 To 47
For n6 = n5 + 1 To 48
i += 1
My.Application.DoEvents()
Label1.Text = CStr(i & vbTab & n1 & "," & n2 & "," & n3 & "," & n4 & "," & n5 & "," & n6)
FileOpen(1, "c:/enumerated.txt", OpenMode.Append)
PrintLine(1, i & "," & n1 & "," & n2 & "," & n3 & "," & n4 & "," & n5 & "," & n6)
FileClose(1)
Next n6
i += 1
My.Application.DoEvents()
FileOpen(1, "c:/enumerated.txt", OpenMode.Append)
PrintLine(1, i & "," & n1 & "," & n2 & "," & n3 & "," & n4 & "," & n5 & "," & n6)
FileClose(1)
Next n5
i += 1
My.Application.DoEvents()
FileOpen(1, "c:/enumerated.txt", OpenMode.Append)
PrintLine(1, i & "," & n1 & "," & n2 & "," & n3 & "," & n4 & "," & n5 & "," & n6)
FileClose(1)
Next n4
i += 1
My.Application.DoEvents()
FileOpen(1, "c:/enumerated.txt", OpenMode.Append)
PrintLine(1, i & "," & n1 & "," & n2 & "," & n3 & "," & n4 & "," & n5 & "," & n6)
FileClose(1)
Next n3
i += 1
My.Application.DoEvents()
FileOpen(1, "c:/enumerated.txt", OpenMode.Append)
PrintLine(1, i & "," & n1 & "," & n2 & "," & n3 & "," & n4 & "," & n5 & "," & n6)
FileClose(1)
Next n2
i += 1
My.Application.DoEvents()
FileOpen(1, "c:/enumerated.txt", OpenMode.Append)
PrintLine(1, i & "," & n1 & "," & n2 & "," & n3 & "," & n4 & "," & n5 & "," & n6)
FileClose(1)
Next n1
i += 1
My.Application.DoEvents()
FileOpen(1, "c:/enumerated.txt", OpenMode.Append)
PrintLine(1, i & "," & n1 & "," & n2 & "," & n3 & "," & n4 & "," & n5 & "," & n6)
FileClose(1)
Label1.Text = Label1.Text & vbtab & "done"
End Sub[/code]

Here is the kicker.

i have tested this algorythm for say small sets - like 5 out of 8, and it works absolutely perfectly. All combinations are indeed written, enumerated and unique - no repeats.

However, once I actually plug in the 6 out of 49 the total number of possible outcomes is well above 13 million. In fact it stops at 44-45-46-47-48-49 and enumerates it as 10,068,347,520.

What i dont get is, I know the math is right, I think, and I should be getting 13 million and change, but I also seem to have done the nested loop properly as it works perfectly for smaller sets that I can verify by hand.

Whats going on here? Is my code wrong, or is the real number of possible combinations far above 13 mil? Every smaller set test of this snippet I have done has never generated any duplicates and has indeed generated every combination.
Reply With Quote
  #2  
Old 07-24-2006, 12:32 PM
johnph77's Avatar
johnph77 johnph77 is offline
Registered User
 
Join Date: Mar 2004
Location: US
Posts: 388
You are opening your text file after each integer. I believe it should only be necessary to do so after n6 changes value.

Also, your coding appears to be for a 6/48 matrix, not 6/49.

Originally I had this coded in and for QBASIC. This is what I used:


OPEN "T649.DAT" FOR OUTPUT AS #1
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
N1& = N1& + 1
PRINT #1, USING "########"; N1&;
PRINT #1, USING "##"; A%; B%; C%; D%; E%; F%
NEXT F%
NEXT E%
NEXT D%
NEXT C%
NEXT B%
NEXT A%
CLOSE
END


Good luck,

John
Reply With Quote
  #3  
Old 07-24-2006, 03:35 PM
JackpotJockey JackpotJockey is offline
Registered User
 
Join Date: Jul 2006
Posts: 3
I need to because otherwise the +1 that changes the lower limit of the next one wouldn't be written

curious again. I know the code is wrong now. I ran the exact same code from VB6 and it stopped at proper 13mil +.

Weird.

My guess is something must be reinitializing the loop after it has completed.

Anyway, since now this is definitely a code thing it no longer bellongs here, I thank you for your help.

Cheers
Reply With Quote
  #4  
Old 07-25-2006, 06:41 AM
johnph77's Avatar
johnph77 johnph77 is offline
Registered User
 
Join Date: Mar 2004
Location: US
Posts: 388
I've got text files with all possible draws, but they're rather large. With line numbers the file is 382Mb in size, without, 260Mb. They can be converted into ".csv" files suitable for import into MS Excel or any other spreadsheet program. But an Excel worksheet with all possible draws takes over 830Mb of space and requires nine pages.
Reply With Quote
  #5  
Old 07-27-2006, 05:28 AM
JackpotJockey JackpotJockey is offline
Registered User
 
Join Date: Jul 2006
Posts: 3
No worries I got it to work. Its just a bit tougher to catch small logical or code errors after having "learned" vb6, not coding for couple of years and then facing a whole new language in .NET.

The file is indeed 300 some MB with line numbers but that is not an issue as I plan to filter it to smaller manageable size. After all it makes no sense for a draw to end up being 4,5,6,7,8,9

Thanks.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
6/49 Discussion For October 02, 2004 gsobier Lotto 649 65 10-04-2004 03:12 PM
6/49 Discussion For June 26, 2004 gsobier Lotto 649 33 06-28-2004 04:07 AM
has anyone looked at a bell curve with regard to winning numbers? mirage Questions & Answers 15 05-03-2004 06:17 PM
Probability That Player Index X Draws Ticket Number X Ion Saliu Lotto Tips & Strategies 2 02-03-2003 07:51 PM
Final Digit Study Picard Lotto Tips & Strategies 17 02-24-2002 10:15 AM


All times are GMT -5. The time now is 11:37 PM.

Silver Lotto System
Silver Lotto System

 

Lottery Circle Manual

 


Powered by vBulletin
Copyright © 2000 - 2012 Jelsoft Enterprises Ltd.
Copyright © 1999 - 2012 LottoForums.com