The complexity of the Gregorian calendar can be explained by rational approximations to an irrational number.
A calendar based on an average year of 365.2425 days was created, with 97 out of 400 years having 365 days.
The Gregorian calendar is off by about 1 day in 3030 years, but the length of the year varies by about 1 day in 7700 years.
The design of the calendar aimed to minimize the discrepancy between the calendar year and solar year, while also using a round number for the cycle length.