From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11390f,be6b7e036aa9236c X-Google-Attributes: gid11390f,public X-Google-Thread: 10261c,68666e29d0425009 X-Google-Attributes: gid10261c,public X-Google-Thread: 1014db,be6b7e036aa9236c X-Google-Attributes: gid1014db,public X-Google-Thread: 1164ba,be6b7e036aa9236c X-Google-Attributes: gid1164ba,public X-Google-Thread: fa0ae,be6b7e036aa9236c X-Google-Attributes: gidfa0ae,public X-Google-Thread: 114809,68666e29d0425009 X-Google-Attributes: gid114809,public X-Google-Thread: 1094ba,be6b7e036aa9236c X-Google-Attributes: gid1094ba,public X-Google-Thread: 103376,be6b7e036aa9236c X-Google-Attributes: gid103376,public From: Lee Crites Subject: Re: Results of my test: Re: Friday 13th, try it yourself Date: 1996/09/26 Message-ID: X-Deja-AN: 185508314 references: <5bxuvOAdKcSyEwne@merlyn.demon.co.uk> content-type: TEXT/PLAIN; charset=US-ASCII organization: Jump Point Communications, Inc. mime-version: 1.0 newsgroups: comp.lang.ada,comp.lang.apl,comp.lang.basic,comp.lang.c,comp.lang.fortran,comp.lang.perl.misc,comp.lang.pascal.misc,comp.lang.smalltalk Date: 1996-09-26T00:00:00+00:00 List-Id: 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