comp.lang.ada
 help / color / mirror / Atom feed
From: Lee Crites <adonai@jump.net>
Subject: Re: Results of my test: Re: Friday 13th, try it yourself
Date: 1996/09/26
Date: 1996-09-26T00:00:00+00:00	[thread overview]
Message-ID: <Pine.SOL.3.91.960926130011.17641E-100000@serv1.jump.net> (raw)
In-Reply-To: 5bxuvOAdKcSyEwne@merlyn.demon.co.uk



As they say, a little knowledge is a dangerous thing.  I guess I went out 
of my way to prove something nobody cared about.  I got a message telling 
me I was proving the wrong thing.  The discussion was not "how frequently 
does each date happen on a Friday," but was "how frequently is the 13th a 
Friday."  The argument, as I understand it, is that the 13th is a Friday 
more often than some other day because of some statistical glitch in the 
calendar.

My initial proof showed that each date happened on each day of the week 
basically as often as any other.  I would think that would be enough to 
close the topic.  However, I was requested to test it the other way -- 
tell me how often the 13th happens on each day of the week.  Fine.  I 
went in and changed my scripts to do so.  I've included them here just as 
I did before.

However, the results are no different.  Basically, the 13th falls 
uniformily across each day of the week.

Now the same disclaimer still applies.  I'm using aix 4.1's cal utility to
give me the calendar data.  If IF is wrong, then I am also wrong.  Before
you stomp on the data again, though, you'd better be able to tell me which
of the calendar entries I sent out earlier is in error.

If you can't find an error in my scripts below, or an error in the
calendar entries I sent out earlier, then it is settled.  There is a
uniform distribution of dates across the day of the week AND a uniform
distribution of days of the week across dates. 


Lee Crites

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

This is the csh script that ran it:

#!/bin/csh -f

#
# get 13th dates for 400 years
#
if (-e w13.out) then
  rm w13.out
endif

#
# for those who can't follow the logic, yr is going from
# 0 to 399 at the while statement, incremented (so it will
# be 1 to 400) BEFORE it is used, then ADDED to yr_base,
# which will then go from 1753 to 2152
#
@ yr_base = 1752 # from Ken Pizzini
@ yr = 0

# we will be going from 0 to 399 at the while statement
while ( $yr < 400 )

  # increment the yr counter, so it will go from 1 to 400 here
  @ yr ++

  # add the yr counter to the yr_base
  @ year = $yr_base + $yr

  # show me the year we are working with
  echo $year

  # initialize month counter
  @ month = 0

  # again, we are going from 0 to 11 at the while statement
  while ( $month < 12 )

    # increment the month counter, so it will go from 1 to 12 here
    @ month ++

    # get the calendar for the month, strip out the line with 13 in it
    cal $month $year | grep "13" >> w13.out

    end

  end

# strip out invalid entries -- e.g. January 1913, March 2130, etc
grep -iv "y" w13.out | grep -iv "a" | grep -iv "e" | \
  awk -f w13.awk > w13.rpt
cat w13.rpt

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Just because it's there, here is a list of the first 20 entries in
the w13.out:

 7   8   9  10  11  12  13
11  12  13  14  15  16  17
11  12  13  14  15  16  17
 8   9  10  11  12  13  14
13  14  15  16  17  18  19
10  11  12  13  14  15  16
 8   9  10  11  12  13  14
12  13  14  15  16  17  18
 9  10  11  12  13  14  15
 7   8   9  10  11  12  13
11  12  13  14  15  16  17
 9  10  11  12  13  14  15
13  14  15  16  17  18  19
10  11  12  13  14  15  16
10  11  12  13  14  15  16
 7   8   9  10  11  12  13
12  13  14  15  16  17  18
 9  10  11  12  13  14  15
 7   8   9  10  11  12  13
11  12  13  14  15  16  17

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

This is the awk file used above:

BEGIN {
  cnt = 0
  x = 0
  for (x=1; x<9; x++) {
    cntr[x] = 0
    }
}
{
  cnt++
  if ($1 == 13) {
    cntr[1]++
    continue
    }
  if ($2 == 13) {
    cntr[2]++
    continue
    }
  if ($3 == 13) {
    cntr[3]++
    continue
    }
  if ($4 == 13) {
    cntr[4]++
    continue
    }
  if ($5 == 13) {
    cntr[5]++
    continue
    }
  if ($6 == 13) {
    cntr[6]++
    continue
    }
  if ($7 == 13) {
    cntr[7]++
    continue
    }
  cntr[8]++
}
END {
  printf("Summary of days which the 13th happen on:\n")
  printf("\n")
  printf("%10s total items\n", cnt)
  printf("\n")
  printf("%10s found %4d times\n", "Sun", cntr[1])
  printf("%10s found %4d times\n", "Mon", cntr[2])
  printf("%10s found %4d times\n", "Tue", cntr[3])
  printf("%10s found %4d times\n", "Wed", cntr[4])
  printf("%10s found %4d times\n", "Thu", cntr[5])
  printf("%10s found %4d times\n", "Fri", cntr[6])
  printf("%10s found %4d times\n", "Sat", cntr[7])
  printf("%10s found %4d times\n", "error", cntr[8])
}

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

And finally, here are the results of the run:

Summary of days which the 13th happen on:

      4800 total items

       Sun found  687 times
       Mon found  685 times
       Tue found  685 times
       Wed found  687 times
       Thu found  684 times
       Fri found  688 times
       Sat found  684 times
     error found    0 times







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

Thread overview: 66+ 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 ` Norman H. Cohen
1996-09-18  0:00 ` Andrew Gierth
1996-09-18  0:00 ` Luke Chao
1996-09-18  0:00 ` James Giles
1996-09-19  0:00 ` Daniel J. Long
1996-09-21  0:00   ` Ken Pizzini
1996-09-21  0:00   ` Ken Pizzini
1996-09-24  0:00     ` Art Schwarz
1996-09-26  0:00       ` Ken Pizzini
1996-09-29  0:00         ` Paul Gilmartin
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-19  0:00 ` Norman H. Cohen
1996-09-19  0:00 ` Andrew Gierth
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
1996-09-21  0:00   ` Russell Mosemann
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             ` Dik T. Winter
1996-10-02  0:00             ` Ken Pizzini
1996-09-26  0:00       ` Dr John Stockton
1996-09-26  0:00         ` Dr John Stockton
1996-09-26  0:00         ` Lee Crites [this message]
1996-09-26  0:00           ` Adam Beneschan
1996-09-27  0:00             ` Glen Clark
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-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
     [not found]         ` <199609302101.JAA04610@kauri.vuw.ac.nz>
1996-09-30  0:00           ` Lee Crites
1996-09-25  0:00     ` Friday 13th, try it yourself (was Language Wars..) Barrie Walker
1996-09-26  0:00       ` Jim Shapiro
1996-09-23  0:00   ` 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 ` 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-23  0:00 ` Dr John Stockton
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-10-03  0:00 Results of my test: Re: Friday 13th, try it yourself James Gillespie
1996-10-03  0:00 ` Paul Skoczylas
1996-10-03  0:00 ` Dr John Stockton
1996-10-03  0:00 ` Daan Sandee
replies disabled

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