Once In A Blue Moon

August 31, 2012

The new moon of January 6, 2000 was the 83017th new moon since the start of the julian calendar on January 1, 4700 B.C., so the first new moon of the julian calendar was at day 9.205190498965036. Adding half of 29.530588853 gives us a formula for computing full moons: 23.9704840005 + 29.530588853k. Thus, we can compute the first full moon after a given starting date, then each successive full moon by counting days from that date:

(define (blue-moons from to)
  (define (int x) (inexact->exact (floor x)))
  (let* ((delta 29.530588853) (offset 23.9704840005)
         (moon (+ offset (* delta (floor (/ from delta))))))
    (let loop ((moon moon) (prev 0) (moons (list)))
      (if (< to moon) (reverse moons)
        (let-values (((y m d) (gregorian (int moon))))
          (loop (+ moon delta) m
                (if (= m prev)
                    (cons (list m y) moons)
                    moons)))))))

There are thirty-six blue moons in the twenty-first century, including today’s full moon:

> (blue-moons (julian 2001 1 1) (julian 2100 12 31))
((10 2001) (7 2004) (5 2007) (12 2009) (8 2012) (7 2015)
(1 2018) (3 2018) (10 2020) (8 2023) (5 2026) (12 2028)
(9 2031) (6 2034) (1 2037) (3 2037) (10 2039) (7 2042)
(4 2045) (12 2047) (9 2050) (6 2053) (1 2056) (3 2056)
(10 2058) (7 2061) (4 2064) (12 2066) (8 2069) (5 2072)
(1 2075) (3 2075) (10 2077) (7 2080) (5 2083) (12 2085)
(8 2088) (6 2091) (1 2094) (3 2094) (10 2096) (8 2099))

We used the julian and gregorian functions from the Standard Prelude. You can run the program at http://programmingpraxis.codepad.org/rmEXGyfK.

Advertisement

Pages: 1 2

One Response to “Once In A Blue Moon”

  1. kernelbob said

    Note that blue moons are timezone dependent. For example, the full moon that occurred on 2001-11-30 at 20:49 UTC was the second moon in November for North America, but was the first full moon of December for Europe and Asia. In North America, Nov. 30th was the blue moon. In Europe, the blue moon was 30 Dec. (source: http://www.timeanddate.com/calendar/moonphases.html?year=2001&n=0 )

    Wikipedia gives a completely different definition of a blue moon: third full moon in a season with four full moons. Since the seasons are delimited by the equinoxes and solstices, which occur at the same times worldwide, this kind of blue moon is not timezone dependent.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: