The Gregorian calendar that we use today is a compromise between having leap years spaced as evenly as possible and keeping the calculations relatively simple. (The older Julian calendar, which had a leap year every 4 years, was also such a compromise, one with a greater bias toward simplicity.)
In the Gregorian calendar, every 4th year is a leap year, except that every 100th year is not a leap year, except that every 400th year is a leap year. The cycle repeats every 400 years, with 97 leap years in each cycle. But they're not distributed as evenly as they could be; most successive leap years are 4 years apart, but some of them are 8 years apart.
The Gregorian calendar assumes that a year is 365.2425 days. In fact, it's slightly less than that; WolframAlpha says it's 365.242190419 days.
What you're suggesting, I think, is a calendar in which leap years are always either 4 or 5 years apart, and are as evenly distributed as possible, so that the difference between the calendar and the astronomical year are minimized.
To do this, start with a 365-day year, and keep track of the offset between the calendar the astronomical year. This offset increases by 0.242190419 days every year.
- Year 0: offset = 0
- Year 1: offset = 0.242190419 days
- Year 2: offset = 0.484380838 days
- Year 3: offset = 0.726571257 days
- Year 4: offset = 0.968761676 days
- Year 5: offset = 1.210952095 days
- Add a leap day, recompute offset = 0.210952095 days
- ...
Every time the offset exceeds 1 day, add a leap day and subtract 1 day from the offset.
This will keep the offset as small as possible over time, but at the expense of easy predictability; it becomes much more difficult for those who are not mathematically inclined to understand when the next leap year is going to be. And the calendar would presumably have to be adjusted as the number of days in a solar year is computed more precisely, or as it changes as the Earth's rotation rate changes slightly.
Assuming that the figure of 365.242190419 is correct, your calendar would repeat itself, not every 400 years, but every billion years.
An alternative would be to keep the Gregorian calendar's assumption of 365.2425 days per year, and just distribute the leap years more evenly through the 400-year cycle. For example, starting from 2000, you have leap years in 2000, 2004, 2008, 2012, ..., 2128, 2133, 2137, 2141, ..., 2265, 2270, 2274, ....
In either case, most of the time leap years would not be years that are multiples of 4, which is a nice property of the Julian and Gregorian calendars.
That's the math, but it's absolutely trivial compared to the politics. I'm afraid there's very little chance that such a system would be widely accepted. The Gregorian calendar, which was a clear improvement over the Julian calendar, was introduced in 1582, but it wasn't fully adopted worldwide until the late 1920s (and there are still pockets of resistance).
There are tremendous advantages in the fact that almost the entire world uses the Gregorian calendar, and it will remain within a day or so of the astronomical year for the next several thousand years. Your proposed calendar has the advantage of remaining very slightly closer to the astronomical year, but the costs of universal adoption would be tremendous, and the costs of partial adoption would be even worse.
y
is evenly divisible by 4, by 100 and 400, then you have a leap year. Modulo is your friend, in this case. $\endgroup$