Once In A Blue Moon
August 31, 2012
Sometimes the phases of the moon fall on the calendar in such a way that one calendar month has two full moons; the second full moon of the month is called a blue moon, for reasons that have been lost in antiquity. Poets and songwriters sometimes use the phrase “once in a blue moon” to indicate an event that occurs infrequently, but in fact blue moons occur every two or three years, on average. Today’s full moon is the blue moon of August 2012.
We looked at the phases of the moon in a previous exercise. There we learned that new moons occur every 29.530588853 days, that a new moon occurred on January 6, 2000 (julian date 2451550.1), and that full moons occur halfway between two new moons.
Your task is to write a program that calculates all the blue moons of the twenty-first century. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.
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.