comp.lang.ada
 help / color / mirror / Atom feed
From: mose@ns.ccsn.edu (Russell Mosemann)
Subject: Re: Friday 13th, try it yourself (was Language Wars..)
Date: 1996/09/21
Date: 1996-09-21T00:00:00+00:00	[thread overview]
Message-ID: <521pfp$kec@ns.ccsn.edu> (raw)
In-Reply-To: 3242D1EB.3F54@ford.com


Clinton Pierce <cpierce1@ford.com> writes:

>See for yourself if the "Friday the 13th" thing is just a UL.  If you trust
>UNIX's 'cal' program, and that it does the Right Thing with Leap Years, the
>Gregorian/Julian switch etc..etc... This Perl script will show you the Truth:

   I decided to write a script of my own for Solaris 2.4 and perl
5.003 which calls cal for 1066 to 1996 and rips out the Fridays.  The
following is the number of times a particular day of the month falls
on a Friday.  The results are pretty evenly distributed, i.e. it is an
Urban Legend.

Day of month: 1 Freq: 1600
Day of month: 2 Freq: 1594
Day of month: 3 Freq: 1596
Day of month: 4 Freq: 1594
Day of month: 5 Freq: 1593
Day of month: 6 Freq: 1601
Day of month: 7 Freq: 1593
Day of month: 8 Freq: 1600
Day of month: 9 Freq: 1594
Day of month: 10 Freq: 1596
Day of month: 11 Freq: 1594
Day of month: 12 Freq: 1593
Day of month: 13 Freq: 1601
Day of month: 14 Freq: 1593
Day of month: 15 Freq: 1601
Day of month: 16 Freq: 1594
Day of month: 17 Freq: 1596
Day of month: 18 Freq: 1594
Day of month: 19 Freq: 1593
Day of month: 20 Freq: 1601
Day of month: 21 Freq: 1593
Day of month: 22 Freq: 1601
Day of month: 23 Freq: 1594
Day of month: 24 Freq: 1596
Day of month: 25 Freq: 1594
Day of month: 26 Freq: 1593
Day of month: 27 Freq: 1601
Day of month: 28 Freq: 1593
Day of month: 29 Freq: 1499
Day of month: 30 Freq: 1461
Day of month: 31 Freq: 930


    The script is
   

#!/usr/bin/perl

@dom = ();
for ($year = 1066; $year <= 1996; $year++)
{
    open(CAL, "cal $year |");
    $row = <CAL>;                   # Get rid of year
    $row = <CAL>;                   # A blank line
    while($row = <CAL>)
    {
        for ($cols = 0; $cols < 3; $cols++)
        {
            $day = substr($row, 15 + ($cols * 23), 2);
            $dom[$day]++ if $day =~ m/^( |\d)\d$/;
        }
    }
    close(CAL);
}
for ($day = 1; $day <= 31; $day++)
{
    print "Day of month: $day Freq: $dom[$day]\n";
}
-- 
Russell Mosemann     Concordia College      Voice: (402) 643-7445
Computing Center     Seward, NE 68434       Fax:   (402) 643-4073
"If Teflon is non-stick, how do they get it to stick to the pan?"




  reply	other threads:[~1996-09-21  0:00 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-09-13  0:00 language wars (results 13 September) last posting Roy Gardiner
1996-09-13  0:00 ` William Clodius
1996-09-13  0:00   ` Peter Seebach
1996-09-21  0:00     ` Robert Dewar
1996-09-21  0:00     ` Robert Dewar
1996-09-16  0:00   ` Robert Fahey
1996-09-18  0:00 ` James Giles
1996-09-18  0:00 ` Andrew Gierth
1996-09-18  0:00 ` Luke Chao
1996-09-18  0:00 ` Norman H. Cohen
1996-09-18  0:00 ` James Giles
1996-09-19  0:00 ` Andrew Gierth
1996-09-19  0:00 ` Daniel J. Long
1996-09-21  0:00   ` Ken Pizzini
1996-09-24  0:00     ` Art Schwarz
1996-09-26  0:00       ` Matthew D. Healy
1996-09-29  0:00         ` Randy MacDonald
1996-10-03  0:00           ` galina.kasminskaya
1996-10-03  0:00             ` Dave Tholen
1996-09-26  0:00       ` Ken Pizzini
1996-09-29  0:00         ` Paul Gilmartin
1996-09-21  0:00   ` Ken Pizzini
1996-09-19  0:00 ` Norman H. Cohen
1996-09-20  0:00 ` John Girash
1996-09-20  0:00   ` John Girash
1996-09-20  0:00 ` Friday 13th, try it yourself (was Language Wars..) Clinton Pierce
1996-09-21  0:00   ` Russell Mosemann [this message]
1996-09-21  0:00   ` Russell Mosemann
1996-09-25  0:00     ` Barrie Walker
1996-09-26  0:00       ` Jim Shapiro
1996-09-25  0:00     ` Ken Pizzini
1996-09-25  0:00       ` Results of my test: Re: Friday 13th, try it yourself Lee Crites
1996-09-25  0:00         ` William Clodius
1996-09-27  0:00         ` Dik T. Winter
     [not found]           ` <52qpqt$1b3l@ilx018.iil.intel.com>
1996-10-02  0:00             ` Ken Pizzini
1996-10-02  0:00             ` Dik T. Winter
1996-09-26  0:00       ` Dr John Stockton
1996-09-26  0:00         ` Lee Crites
1996-09-26  0:00           ` Daan Sandee
1996-09-26  0:00             ` Jeff Drummond
1996-09-30  0:00               ` Ray Dunn
1996-09-26  0:00           ` John Winters
1996-09-26  0:00           ` Adam Beneschan
1996-09-27  0:00             ` Glen Clark
1996-09-27  0:00           ` CHI Research, Inc. 
1996-09-27  0:00             ` Lee Crites
1996-09-28  0:00               ` John Winters
1996-09-30  0:00               ` Adam Beneschan
1996-10-01  0:00             ` Mike McCarty
1996-09-26  0:00         ` Dr John Stockton
     [not found]         ` <199609302101.JAA04610@kauri.vuw.ac.nz>
1996-09-30  0:00           ` Lee Crites
1996-09-23  0:00   ` Friday 13th, try it yourself (was Language Wars..) Matthew D. Healy
1996-09-23  0:00     ` Dik T. Winter
1996-09-25  0:00     ` Paul Gilmartin
1996-09-22  0:00 ` Dr John Stockton
1996-09-23  0:00 ` Dr John Stockton
1996-09-23  0:00 ` Randy MacDonald
1996-09-23  0:00   ` Dik T. Winter
1996-09-25  0:00   ` John Harper
1996-09-25  0:00     ` jupiter
1996-09-24  0:00 ` language wars (results 13 September) last posting Andrew Gierth
1996-09-24  0:00   ` Art Schwarz
  -- strict thread matches above, loose matches on Subject: below --
1996-09-25  0:00 Friday 13th, try it yourself (was Language Wars..) Barrie Walker
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox