I'm designing a new calendar and I want the first day of the year to be the first day after the longest night of year in the northern hemisphere. Under this plan, "natural" leap years, where the first day of two adajacent years are 366 days apart, will occur every four years, but sometimes with a five year gap instead.

If I want this calendar to be embraced by the software engineers of the world, the position of those leap years will need to be predictable with a mathematical function that operates only on the year number, making no reference to observed astronomy.

Given a year number *y*, how can I predict if that year is a leap year, as defined above?

For the puroses of this question, my year numbers are the same as standard years for the bulk of the year, with the exception of the period between the winter solstice and new years day where they will differ by one.

Also, for the purposes of this question, assume that the Earth's cycles will remain as they are now indefinitely.

---

Update: I've rephrased the question a little after reading the comments.

Every year, there is day that's the first one after the longest night in the northern hemisphere. Most years, that day will be 365 days after the previous one.

Some years, that day will be 366 days later. I'll call them "natural leap years".

These "natural leap years" will mostly be four years apart, but will sometimes be five years apart instead.

How can I calculate, assuming the Earth's current cycles, when these "natural leap years" will occur?