home *** CD-ROM | disk | FTP | other *** search
- ############################################################################
- #
- # File: full13th.icn
- #
- # Subject: Procedure to give days when a full moon occurs on
- # Friday the 13th
- #
- # Author: Ralph E. Griswold
- #
- # Date: September 6, 1992
- #
- ###########################################################################
- #
- # full13th(year1, year2) generates records giving the days on
- # which a full moon occurs on Friday the 13th in the range from
- # year1 though year2.
- #
- ############################################################################
- #
- # Acknowledgement: This procedure is based on an algorithm given in
- # "Numerical Recipes; The Art of Scientific Computing"; William H. Press,
- # Brian P. Flannery, Saul A. Teukolsky. and William T. Vetterling;
- # Cambridge University Press, 1986.
- #
- ############################################################################
- #
- # Links: pom, julian
- #
- ############################################################################
-
- record date(month, year, fraction)
-
- link julian
- link pom
-
- procedure full13th(year1, year2)
- local time_zone, jd, jday, fraction, jul
- local year, month, julday, n, icon, day_of_week, c
-
- time_zone := -5.0 / 24.0
-
- every year := year1 to year2 do {
- every month := 1 to 12 do {
- jday := julian(month, 13, year)
- day_of_week := (jday + 1) % 7
- if day_of_week = 5 then {
- n := integer(12.37 * (year - 1900 + integer((month - 0.5) / 12.0)))
- icon := 0
- repeat {
- jul := pom(n,2)
- jd := jul.number
- fraction := 24.0 * (jul.fraction + time_zone)
- if (fraction < 0.0) then {
- jd -:= 1
- fraction +:= 24.0
- }
- if fraction > 12.0 then {
- jd +:= 1
- fraction -:= 12.0
- }
- else fraction +:= 12.0
- if jd = jday then {
- suspend date(month, year, fraction)
- break
- }
- else {
- c := if jday >= jd then 1 else -1
- if c = -icon then break
- icon := c
- n +:= c
- }
- }
- }
- }
- }
-
- end
-