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=2.1 required=5.0 tests=BAYES_40,INVALID_MSGID, LOTS_OF_MONEY,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f7be1,be6b7e036aa9236c X-Google-Attributes: gidf7be1,public X-Google-Thread: 11390f,be6b7e036aa9236c X-Google-Attributes: gid11390f,public X-Google-Thread: 103376,be6b7e036aa9236c X-Google-Attributes: gid103376,public X-Google-Thread: 1094ba,be6b7e036aa9236c X-Google-Attributes: gid1094ba,public X-Google-Thread: 101deb,be6b7e036aa9236c X-Google-Attributes: gid101deb,public X-Google-Thread: fa0ae,be6b7e036aa9236c X-Google-Attributes: gidfa0ae,public X-Google-Thread: 1014db,be6b7e036aa9236c X-Google-Attributes: gid1014db,public X-Google-Thread: 1164ba,be6b7e036aa9236c X-Google-Attributes: gid1164ba,public From: Randy MacDonald Subject: Re: Friday 13th, try it yourself (was Language Wars..) Date: 1996/09/23 Message-ID: <32462521.76DD@godin.on.ca>#1/1 X-Deja-AN: 184719679 distribution: inet references: <51bv60$8d@pheidippides.axion.bt.co.uk> content-type: text/plain; charset=us-ascii organization: Godin London Incorporated mime-version: 1.0 reply-to: randy@godin.on.ca newsgroups: comp.lang.ada,comp.lang.apl,comp.lang.basic,comp.lang.c,comp.lang.fortran,comp.lang.perl.misc,comp.lang.pl1,comp.lang.rexx,comp.lang.pascal.misc,comp.lang.smalltalk x-mailer: Mozilla 3.0b6Gold (Win95; I) Date: 1996-09-23T00:00:00+00:00 List-Id: I've reposted this message from Roger Hui, since his access to the newsgroup didn't allow for posting to the other groups. With apologies to the comp.lang.apl folk... Subject: Re: Triskaidekanalysis Date: 21 Sep 96 05:35:19 GMT From: Roger Hui Organization: UofNB News Gateway, Fredericton, CANADA Newsgroups:comp.lang.apl A more recent and complete leap year rule specifies that years divisible by 4000 are common (not leap) years. In J, the following verb is 1 if the argument is a leap year, and 0 if it is common: leapyear=: 0&(~:/ . =) @ (4000 400 100 4&(|/)) In words: Compute the remainder of division by 4000, 400, 100, and 4. If the number of 0 remainders is odd, then it is a leap year; if even, then it is a common year. The additional 4000-year rule is described in Guy Ottewell's "The Astronomical Companion", 1979, Furman University, Greenville, SC, USA, Telephone (803) 294-2208. The reason for having the rule is to bring the average calendar year closer to the tropical year (within one day in 20000 years): 1460969 days % 4000 years = 365.24225 days/year (4000 year rule) 146097 days % 400 years = 365.2425 days/year (400 year rule) Therefore, to determine the distribution of the 13-th day over the days of the week, it is necessary to consider not just a 400 year cycle, but a 28000 year cycle. (Actually the first should be a 2800 year cycle, with a short cut to 400 years made possible by the fact that 146097 is divisible by 7.) The analysis can be done in J as follows: p=: 31 28,10$5$31 30 NB. days in month in common years q=: 31 29,10$5$31 30 NB. days in month in leap years +/,(leapyear i.4000){p,:q NB. # days in 4000 years 1460969 y=: i.28000 NB. year numbers from 0 to 27999. d=: (leapyear y){p,:q NB. # of days in each month in y $d NB. d is a 28000 by 12 matrix 28000 12 5{.d NB. first 5 rows of d 31 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31 29 31 30 31 30 31 31 30 31 30 31 w=: 7| +/\ ,d NB. day-of-week of every 13-th day of month 20 {. w NB. first 20 entries in w 3 3 6 1 4 6 2 5 0 3 5 1 4 4 0 2 5 0 3 6 t=: /:~ (~.w) ,. #/.~ w NB. sorted table of day-of-week, # occurrences t 0 48000 1 48000 2 48000 3 48000 4 48000 5 48000 6 48000 The next example shows that a 4000-year cycle exhibits uneven distribution. Since the number of days in 4000 years (1460969) is not divisible by 7, the unevenness is smoothed out when the cycle is lengthen by a factor of 7, as above. /:~ (~.w) ,. #/.~ w=: 7 | +/\ , (leapyear i.4000){p,:q 0 6880 1 6840 2 6869 3 6851 4 6850 5 6870 6 6840