Economy class Belgium Member #123700 February 27, 2012 4035 Posts Offline

Posted: May 14, 2013, 2:09 pm - IP Logged

Quote: Originally posted by mathhead on May 14, 2013

A VBA function might be more useful. See below. You can call it as =gap5Combo() to get just the single count (962,598). Or you can select a range of up to 3 horizontal cells and array-enter the same formula (press ctrl+shift+Enter) to get up to 3 values: the count of qualifying combos (962,598), the count of all possible combos (5,006,386), and the fraction of qualifying combos (about 0.1923), which you can format as Percentage. You can also select a range of up to 3 vertical cells and array-enter the formula =TRANSPOSE(gap5Combo()).

Function gap5Combo() As Variant ' number of combinations where each number ' is 5 or more from any other number Const nNum As Long = 59 ' Powerball Dim i1 As Long, i2 As Long, i3 As Long Dim i4 As Long, i5 As Long Dim n As Long, nc As Long nc = WorksheetFunction.Combin(nNum, 5) n = 0 For i1 = 1 To nNum - 20 For i2 = i1 + 5 To nNum - 15 For i3 = i2 + 5 To nNum - 10 For i4 = i3 + 5 To nNum - 5 For i5 = i4 + 5 To nNum n = n + 1 Next i5, i4, i3, i2, i1 gap5Combo = Array(n, nc, n / nc) End Function

United States Member #130795 July 25, 2012 80 Posts Offline

Posted: May 14, 2013, 3:51 pm - IP Logged

Quote: Originally posted by SergeM on May 14, 2013

....

Cells(r,c)=n_{i }...

In response to my posting of an Excel VBA function, to wit (abbreviated): Function gap5Combo() As Variant .... iterate over all qualifying combinations, incrementing n .... gap5Combo = Array(n, nc, n / nc) End Function

That was not intended to be a tutorial on Excel, and it is unclear what you mean by your comment.

We cannot assign to Cells(...) in a VBA function that is called directly or indirectly from an Excel formula, as I intended and explained previously. It results in a runtime error.

If your intent is to store the qualifying combinations, we would need to use a VBA sub(routine) like the one I posted previously [1]. However, it would be inefficient to store that many results cell-by-cell. It would be better to store them into a VBA array, then store the array into an appropriate range after the loops.

(But I would not store the qualifying combinations into a worksheet for several reasons.)

PS: The run time of my VBA function can be improved significantly (more than 6X faster on my computer) by changing the loops as follows:

For i1 = 1 To nNum - 20 For i2 = i1 + 5 To nNum - 15 For i3 = i2 + 5 To nNum - 10 For i4 = i3 + 5 To nNum - 5 n = n + nNum - i4 - 4 ' -(i4+5)+1 Next i4, i3, i2, i1

----- [1] Arguably, we could assign the VBA array of qualifying combinations to the function name, returning the entire array. I would not recommend that for several reasons.

New Hampshire United States Member #136492 December 12, 2012 322 Posts Offline

Posted: May 14, 2013, 5:10 pm - IP Logged

Quote: Originally posted by Ronnie316 on May 14, 2013

You guys are awesome. Keep up the great work.

Thank you Ronnie316 and thanks again Mathhead for providing the calculations! As 86% of all PB drawings since the inception of the current 5/59 format contain a number delta of 4 or less I was curious to see how many combinations I could eliminate if I played only lines that fit these parameters.

Granted 14% of the time my strategy would fail, but it's good to know I can get rid of 19.23% of the more evenly spaced combos the rest of the time and reduce my 5 of 5 odds down closer to 1:4,100,000. Still astronomical but better, lol.

Cheers to you both gentlemen and good luck tomorrow.

Dallas, Texas United States Member #4549 May 2, 2004 1701 Posts Online

Posted: May 14, 2013, 5:14 pm - IP Logged

Way to go mathhead!

Worked it up in QB64 for anyone who uses basic.

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!"

United States Member #130795 July 25, 2012 80 Posts Offline

Posted: May 14, 2013, 8:32 pm - IP Logged

Quote: Originally posted by msharkey2001 on May 14, 2013

Thank you Ronnie316 and thanks again Mathhead for providing the calculations! As 86% of all PB drawings since the inception of the current 5/59 format contain a number delta of 4 or less I was curious to see how many combinations I could eliminate if I played only lines that fit these parameters.

Granted 14% of the time my strategy would fail, but it's good to know I can get rid of 19.23% of the more evenly spaced combos the rest of the time and reduce my 5 of 5 odds down closer to 1:4,100,000. Still astronomical but better, lol.

Cheers to you both gentlemen and good luck tomorrow.

msharkey wrote: "86% of all PB drawings since the inception of the current 5/59 format contain a number delta of 4 or less".

I count 374 of 454 from 7 Jan 2009 through 11 May 2013, which is about 82.38%. But let's not split hairs.

msharkey wrote: "Granted 14% of the time my strategy would fail, but it's good to know I can get rid of 19.23% of the more evenly spaced combos the rest of the time and reduce my 5 of 5 odds down closer to 1:4,100,000".

At the risk of popping bubbles, selecting from a predominant pattern does not improve the odds of matching 5 of 5. You are failing to account for the conditional probability.

Consider a hypothetical roulette wheel with 12 black numbers and 24 red numbers. What is the probability that the wheel will select any one number that we choose? It is 1 in 36. Now suppose we limit ourselves to choosing one of the red numbers. What is the probability that the wheel will select that number? It is still 1 in 36. The fact that we selected from a pattern representing 2/3 of the numbers (red) does not improve our odds of matching that number. It would improve our chances if we were betting on "any red number". But we are not.

Returning to PB, of the 5,006,386 combinations of C(59,5), 962,598 combinations are such that each number is 5 or more than any other number. So 4,043,788 combinations have at least one pair of numbers that is 4 or less apart.

If we select only from the latter set, our chance of matching (that set) is 1 in 4,043,788. But that is only for 4,043,788 / 5,006,386 of the time, when the lottery drawing is a combination from that set. Thus, our chance of matching the drawing is (1 / 4,043,788) * (4,043,788 / 5,006,386) = 1 in 5,006,386. That is the same as our odds of matching 5 of 5 (with and without matching the powerball) if we did not take the pattern into account.

Nonetheless, it makes us feel good to select combinations with a pattern that arises about 80.77% of the time. It means that 81% of the time, we are more likely to be able to post a comment saying, "Darn, I was close!" :-)).

New Hampshire United States Member #136492 December 12, 2012 322 Posts Offline

Posted: May 15, 2013, 9:54 am - IP Logged

Quote: Originally posted by mathhead on May 14, 2013

msharkey wrote: "86% of all PB drawings since the inception of the current 5/59 format contain a number delta of 4 or less".

I count 374 of 454 from 7 Jan 2009 through 11 May 2013, which is about 82.38%. But let's not split hairs.

msharkey wrote: "Granted 14% of the time my strategy would fail, but it's good to know I can get rid of 19.23% of the more evenly spaced combos the rest of the time and reduce my 5 of 5 odds down closer to 1:4,100,000".

At the risk of popping bubbles, selecting from a predominant pattern does not improve the odds of matching 5 of 5. You are failing to account for the conditional probability.

Consider a hypothetical roulette wheel with 12 black numbers and 24 red numbers. What is the probability that the wheel will select any one number that we choose? It is 1 in 36. Now suppose we limit ourselves to choosing one of the red numbers. What is the probability that the wheel will select that number? It is still 1 in 36. The fact that we selected from a pattern representing 2/3 of the numbers (red) does not improve our odds of matching that number. It would improve our chances if we were betting on "any red number". But we are not.

Returning to PB, of the 5,006,386 combinations of C(59,5), 962,598 combinations are such that each number is 5 or more than any other number. So 4,043,788 combinations have at least one pair of numbers that is 4 or less apart.

If we select only from the latter set, our chance of matching (that set) is 1 in 4,043,788. But that is only for 4,043,788 / 5,006,386 of the time, when the lottery drawing is a combination from that set. Thus, our chance of matching the drawing is (1 / 4,043,788) * (4,043,788 / 5,006,386) = 1 in 5,006,386. That is the same as our odds of matching 5 of 5 (with and without matching the powerball) if we did not take the pattern into account.

Nonetheless, it makes us feel good to select combinations with a pattern that arises about 80.77% of the time. It means that 81% of the time, we are more likely to be able to post a comment saying, "Darn, I was close!" :-)).

Nice job explaining lottery probability and making it easy to understand for us non math experts Mathhead. Much appreciative of your responses and the time you put in addressing my question and clarifying some things for me. Keep up the great work you do here on LP!

Economy class Belgium Member #123700 February 27, 2012 4035 Posts Offline

Posted: May 15, 2013, 11:45 am - IP Logged

Studies show that though many people participate in gambling as a form of recreation or even as a means to gain an income, gambling, like any behavior which involves variation in brain chemistry, can become a psychologically addictive and harmful behavior in some people. Reinforcement schedules may also make gamblers persist in gambling even after repeated losses.

The Russian writer Dostoevsky (himself a problem gambler) portrays in his novella The Gambler the psychological implications of gambling and how gambling can affect gamblers. He also associates gambling and the idea of "getting rich quick", suggesting that Russians may have a particular affinity for gambling. Dostoevsky shows the effect of betting money for the chance of gaining more in 19th-century Europe. The association between Russians and gambling has fed legends of the origins of Russian roulette.

Evolutionary psychology suggests that women more than men tend to select mating partners based on their resources. Thus, from an evolutionary perspective men may have had more to gain from a large increase in resources than women have had, which may be one explanation for why men, and especially poor men, tend to gamble more than women.

****

The difference between playing the lottery and gambling is the gaming speed.

United States Member #93947 July 10, 2010 2180 Posts Offline

Posted: May 16, 2013, 1:55 pm - IP Logged

Quote: Originally posted by mathhead on May 14, 2013

msharkey wrote: "86% of all PB drawings since the inception of the current 5/59 format contain a number delta of 4 or less".

I count 374 of 454 from 7 Jan 2009 through 11 May 2013, which is about 82.38%. But let's not split hairs.

msharkey wrote: "Granted 14% of the time my strategy would fail, but it's good to know I can get rid of 19.23% of the more evenly spaced combos the rest of the time and reduce my 5 of 5 odds down closer to 1:4,100,000".

At the risk of popping bubbles, selecting from a predominant pattern does not improve the odds of matching 5 of 5. You are failing to account for the conditional probability.

Consider a hypothetical roulette wheel with 12 black numbers and 24 red numbers. What is the probability that the wheel will select any one number that we choose? It is 1 in 36. Now suppose we limit ourselves to choosing one of the red numbers. What is the probability that the wheel will select that number? It is still 1 in 36. The fact that we selected from a pattern representing 2/3 of the numbers (red) does not improve our odds of matching that number. It would improve our chances if we were betting on "any red number". But we are not.

Returning to PB, of the 5,006,386 combinations of C(59,5), 962,598 combinations are such that each number is 5 or more than any other number. So 4,043,788 combinations have at least one pair of numbers that is 4 or less apart.

If we select only from the latter set, our chance of matching (that set) is 1 in 4,043,788. But that is only for 4,043,788 / 5,006,386 of the time, when the lottery drawing is a combination from that set. Thus, our chance of matching the drawing is (1 / 4,043,788) * (4,043,788 / 5,006,386) = 1 in 5,006,386. That is the same as our odds of matching 5 of 5 (with and without matching the powerball) if we did not take the pattern into account.

Nonetheless, it makes us feel good to select combinations with a pattern that arises about 80.77% of the time. It means that 81% of the time, we are more likely to be able to post a comment saying, "Darn, I was close!" :-)).

"At the risk of popping bubbles,"

Well MathHead, at the risk of giving you the "Kiss Of Death," I must commend you for a very nice job of explaining this. Your illustration using roulette was perfect. Amazingly, your post has been standing nearly 2 days, unscathed! Maybe it takes longer than that for the effects of cognitive dissonence to wear off. I hope, for your sake, that when the hatchet men realize you're revealing to them essentially the same sorts of things that Don Catlin, BlueJay, Epstein, Boney526, and myself have been telling them, you are not subjected to the same abuse, attacks, and belittling, that we were. Keep up the good work.

Kentucky United States Member #32652 February 14, 2006 7314 Posts Offline

Posted: May 19, 2013, 3:51 pm - IP Logged

Quote: Originally posted by jimmy4164 on May 16, 2013

"At the risk of popping bubbles,"

Well MathHead, at the risk of giving you the "Kiss Of Death," I must commend you for a very nice job of explaining this. Your illustration using roulette was perfect. Amazingly, your post has been standing nearly 2 days, unscathed! Maybe it takes longer than that for the effects of cognitive dissonence to wear off. I hope, for your sake, that when the hatchet men realize you're revealing to them essentially the same sorts of things that Don Catlin, BlueJay, Epstein, Boney526, and myself have been telling them, you are not subjected to the same abuse, attacks, and belittling, that we were. Keep up the good work.

--Jimmy4164

The posts by Don Catlin, BlueJay, and Epstein that were "subjected to the same abuse, attacks, and belittling" must be invisible because I only saw where mathhead simply explained to msharkey2001 why getting 4.1 million to 1 odds in 82.38% of the drawings is the same as getting 5 million to 1 odds in 100% of the drawings. Those of us who have no disagreement with what mathhead's comments didn't respond and msharkey2001 simply thanked them for the information.

"I hope, for your sake, that when the hatchet men realize you're revealing to them essentially the same sorts of things that Don Catlin, BlueJay, Epstein, Boney526, and myself have been telling them, you are not subjected to the same abuse, attacks, and belittling, that we were."

I can find hundreds of your posts answering questions nobody asked in your usual Delusions of Grandeur way. I'll just have to take your word that one or two members responded with thanks to one or two of your hundreds of useless posts because I'm not going to take the time to look for them.

Why do you assume the identities of non-LP members and invent imaginary attacks apparently on you, yourself, or any of the other imaginary personalities swimming in you head?

United States Member #124493 March 14, 2012 7023 Posts Offline

Posted: May 19, 2013, 4:12 pm - IP Logged

Quote: Originally posted by SergeM on May 15, 2013

Studies show that though many people participate in gambling as a form of recreation or even as a means to gain an income, gambling, like any behavior which involves variation in brain chemistry, can become a psychologically addictive and harmful behavior in some people. Reinforcement schedules may also make gamblers persist in gambling even after repeated losses.

The Russian writer Dostoevsky (himself a problem gambler) portrays in his novella The Gambler the psychological implications of gambling and how gambling can affect gamblers. He also associates gambling and the idea of "getting rich quick", suggesting that Russians may have a particular affinity for gambling. Dostoevsky shows the effect of betting money for the chance of gaining more in 19th-century Europe. The association between Russians and gambling has fed legends of the origins of Russian roulette.

Evolutionary psychology suggests that women more than men tend to select mating partners based on their resources. Thus, from an evolutionary perspective men may have had more to gain from a large increase in resources than women have had, which may be one explanation for why men, and especially poor men, tend to gamble more than women.

****

The difference between playing the lottery and gambling is the gaming speed.

Economy class Belgium Member #123700 February 27, 2012 4035 Posts Offline

Posted: May 19, 2013, 4:16 pm - IP Logged

Actually in gambling you can make 3600 dollars from 100 dollars in less than a minute. I saw it many times.There are more loosers than winners, and if there weren't so many loosers, there wouldn't be any winners! You can win or loose at any speed. I don't believe that gambling or playing lotto is a race.