### Re: New Jersey Lottery Probability

by ergowolf (Monk)
 on May 03, 2000 at 23:53 UTC ( #10155=note: print w/ replies, xml ) Need Help??

in reply to New Jersey Lottery Probability

Chromatic,
I am impressed with how fast you came up with a solution. What was that like five minutes? You will definitely get one of my votes tommorrow. I thought it was an interesting problem. I will look at your code. I am always interested in seeing how people write there programs. I like the simplicity of your code, too. If anyone is interested they can still calculate how much I will win. My odds are 9153043200 to 1. Well the office has about 150 tickets so the odd go down a sliver. Wish me luck!

Ergowolf Does code make a sound if no one is there to type it?

Comment on Re: New Jersey Lottery Probability
RE: Re: New Jersey Lottery Probability
by Anonymous Monk on May 30, 2000 at 23:17 UTC
Don't approach playing the lottery like this. "Gee my odds are 9 billion to 1". You can improve your chances by playing the odds. That's just wrong. Sure, winning the lottery will always be a matter of luck but with some thought, you can IMPROVE your odds somewhat. Check out Ars Conjectandi, "The Law Of Large Numbers", by Jacob Bernoulli (sound familiar?) published eight years after his death in 1713. Just looking at the primary part of the game.. the 5 numbers between 1..50. What are you chances of drawing an even number or an odd number as the first draw? Well, there are 25 evens and 25 odds. So it's 50% that you will draw an odd or even number. What are the chances you will draw ALL even or ALL odd? Very unlikely. You'll find that if you look at the history of that lottery game, that 2odd/3even is the most prevalent pattern. What if you break it down more? What if you took the 50 numbers and broke them down into three groups.. group A (17 balls 1..17), group B (17 balls 18..34), and group C (16 balls 35..50). Initially, the odds favor drawing a ball from group A or B, simply because there is one extra ball in each of those groups. Going against the odds, say a ball is drawn from group C. Now what are the odds of drawing a ball from group A or group B? Better, eh? By calculating how many number combinations are possible for each group, you can calculate the odds for each type being drawn on a given night. There are 21 different ways 5 numbers can be drawn from 3 different number groups. Moreover, you can time your bets. Going back to the odd/even theory, if you know that an all odd or all even drawing takes place on average about once every 1000 draws and that hasn't happened, the chance that this happens increases (even though it still remains small). The balls in the lottery drawings are physical things. When there are more odd, for example, these odd numbers bounce around and get in the way of the even numbers. Don't take my word for it. Examine as many previous drawings as possible and see how many all odd/even, 4 odd/1 even, 3 odd/2 even drawings there are. See how many times all five numbers appeared in the group A numbers and how many times it was distributed across the three groups. You may improve your odds by doing so.

To illustrate, I slapped some extra code into that powerball program I found here.

```#!/usr/bin/perl -w

use strict;
use LWP::Simple;

my (@numbers, %normals, %powers, %chiral );

my \$content;

unless (defined (\$content = get('http://www.powerball.com/results/pbhist.txt'))) {
die "Cannot get PB history.\n";
}

@numbers = split /\n/, \$content;

my @data;

foreach my \$line (@numbers) {
next if (\$line =~ /^!/);
@data = split(/\s/, \$line);
shift @data;        # throw away the date

\$powers{pop @data}++;

my \$drawing_odd  = 1;
my \$drawing_even = 0;

my \$group_a = 0;
my \$group_b = 0;
my \$group_c = 0;

\$chiral{total}++;

\$chiral{totalnums} += 5;

foreach (@data) {
if (\$_ % 2 == 0) {
\$chiral{even}++;
\$drawing_even++;

} else {
\$chiral{odd}++;
\$drawing_odd++;

}

if (\$_ < 17) {
\$chiral{group_a}++;
\$group_a++;

} elsif (\$_ < 33) {
\$chiral{group_b}++;
\$group_b++;

} else {
\$chiral{group_c}++;
\$group_c++;

}

}

\$chiral{"\${drawing_even}_even"}++;
\$chiral{"\$group_a-\$group_b-\$group_c"}++;

foreach (@data) {
#       print "Normal: \$_\n";
\$normals{\$_}++;
}
}

print "Normal Pick Rate:\n\n";

my @norm_sort = sort { \$normals{\$a} <=> \$normals{\$b} } keys %normals;

foreach (@norm_sort) {
print "\$_ :\t(\$normals{\$_})\t", "*" x \$normals{\$_}, "\n";
}

print "\nPower Pick Rate:\n\n";

my @power_sort = sort { \$powers{\$a} <=> \$powers{\$b} } keys %powers;

foreach (@power_sort) {
print "\$_ :\t(\$powers{\$_})\t", "*" x \$powers{\$_}, "\n";
}
print "\nNormal Picks:\t";

print join(" ", sort (@norm_sort0 .. 11)), "\n";

print "\nPower Picks:\t";

print join(" ", sort (@power_sort0 .. 3)), "\n";

print "\nOdd/Even:\n";
printf "\t ODD: %d (%0.1f%%)\n", \$chiral{odd}, (\$chiral{odd}/\$chiral{totalnums})*100;
printf "\tEVEN: %d (%0.1f%%)\n", \$chiral{even}, (\$chiral{even}/\$chiral{totalnums})*100;

printf "\n0 Even/5 Odd: %d (%0.1f%%)\n",
\$chiral{"0_even"},
(\$chiral{"0_even"}/\$chiral{total})*100;

printf "1 Even/4 Odd: %d (%0.1f%%)\n",
\$chiral{"1_even"},
(\$chiral{"1_even"}/\$chiral{total})*100;

printf "2 Even/3 Odd: %d (%0.1f%%)\n",
\$chiral{"2_even"},
(\$chiral{"2_even"}/\$chiral{total})*100;

printf "3 Even/2 Odd: %d (%0.1f%%)\n",
\$chiral{"3_even"},
(\$chiral{"3_even"}/\$chiral{total})*100;

printf "4 Even/1 Odd: %d (%0.1f%%)\n",
\$chiral{"4_even"},
(\$chiral{"4_even"}/\$chiral{total})*100;

printf "5 Even/0 Odd: %d (%0.1f%%)\n",
\$chiral{"5_even"},
(\$chiral{"5_even"}/\$chiral{total})*100;

printf "\n\nGroup A: %d (%0.1f%%)\n",
\$chiral{"group_a"},
(\$chiral{"group_a"}/\$chiral{totalnums})*100;

printf "\n\nGroup B: %d (%0.1f%%)\n",
\$chiral{"group_b"},
(\$chiral{"group_b"}/\$chiral{totalnums})*100;

printf "\n\nGroup C: %d (%0.1f%%)\n",
\$chiral{"group_c"},
(\$chiral{"group_c"}/\$chiral{totalnums})*100;

foreach my \$k (sort {\$chiral{\$a} <=> \$chiral{\$b}} keys %chiral) {
my \$v = \$chiral{\$k};

if (\$k =~ /^\d\-/) {
printf "\n\n%s: %d (%0.1f%%)\n",
\$k, \$v, (\$v/\$chiral{total})*100;
}
}

print "\nDisclaimer:\n\tThis is not statistically accurate, except in that the drawings are guaranteed.\nThi
s is just a quick frequency analysis making no pretenses as to predictive accuracy.\n"

```

Ok, it's not beautiful code but it works and illustrates my point. Let's examine the output:

```Odd/Even:
ODD: 677 (50.5%)
EVEN: 663 (49.5%)

0 Even/5 Odd: 7 (2.6%)
1 Even/4 Odd: 38 (14.2%)
2 Even/3 Odd: 96 (35.8%)
3 Even/2 Odd: 81 (30.2%)
4 Even/1 Odd: 40 (14.9%)
5 Even/0 Odd: 6 (2.2%)

Group A: 464 (34.6%)

Group B: 417 (31.1%)

Group C: 459 (34.3%)

0-5-0: 1 (0.4%)

0-4-1: 3 (1.1%)

1-4-0: 3 (1.1%)

0-1-4: 3 (1.1%)

4-1-0: 4 (1.5%)

4-0-1: 7 (2.6%)

0-2-3: 8 (3.0%)

3-2-0: 9 (3.4%)

1-0-4: 9 (3.4%)

0-3-2: 9 (3.4%)

2-0-3: 11 (4.1%)

2-3-0: 14 (5.2%)

3-0-2: 16 (6.0%)

3-1-1: 20 (7.5%)

1-3-1: 20 (7.5%)

1-1-3: 26 (9.7%)

1-2-2: 33 (12.3%)

2-2-1: 34 (12.7%)

2-1-2: 38 (14.2%)

```

As you can see, you increase your odds by playing 2 odd/3 even and playing 1-2-2, 2-2-1, or 2-1-2 (e.g. 1-2-2 means 1 ball from first group, 2 balls from second group, 2 balls from third group).

What do you think of this? :)

Create A New User
Node Status?
node history
Node Type: note [id://10155]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?