WOLFRAM LANGUAGE FEATURED EXAMPLE

Find Leap Years

By using LeapYearQ with DateDifference, you can find leap years and the intervals between them.

    
Find the leap years that occur from 1600 to 2012:
In[1]:=
Click for copyable input
Out[1]=
Find the intervals between them:
In[2]:=
Click for copyable input
Out[2]=
While leap years most commonly come in four-year intervals, they sometimes come every eight years. This is because a traditional leap day every four years is actually a slight overcompensation in the calendar. Thus, a leap year is skipped every 100 years when those years are not divisible by 400:
In[3]:=
Click for copyable input
Out[3]=
Find the years where an eight-year interval between leap years exists:
In[4]:=
Click for copyable input
Out[4]=