Sorry about the formatting.

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? :)

In reply to RE: RE: Re: New Jersey Lottery Probability by Anonymous Monk
in thread New Jersey Lottery Probability by ergowolf

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.