NEW YORK (AP) — Leap year. It’s a delight for the calendar and math nerds among us. So how did it all begin and why?

Have a look at some of the numbers, history and lore behind the (not quite) every-four-year phenomenon that adds a 29th day to February.

BY THE NUMBERS

The math is mind-boggling in a layperson sort of way and down to fractions of days and minutes. There’s even a leap second occasionally, but there’s no hullabaloo when that happens.

The thing to know is that leap year exists, in large part, to keep the months in sync with annual events, including equinoxes and solstices, according to the Jet Propulsion Laboratory at the California Institute of Technology.

It’s a correction to counter the fact that Earth’s orbit isn’t precisely 365 days a year. The trip takes about six hours longer than that, NASA says.

Contrary to what some might believe, however, not every four years is a leaper. Adding a leap day every four years would make the calendar longer by more than 44 minutes, according to the National Air & Space Museum.

Later, on a calendar yet to come (we’ll get to it), it was decreed that years divisible by 100 not follow the four-year leap day rule unless they are also divisible by 400, the JPL notes. In the past 500 years, there was no leap day in 1700, 1800 and 1900, but 2000 had one. In the next 500 years, if the practice is followed, there will be no leap day in 2100, 2200, 2300 and 2500.

Still with us?

The next leap years are 2028, 2032 and 2036.

WHAT WOULD HAPPEN WITHOUT A LEAP DAY?

Eventually, nothing good in terms of when major events fall, when farmers plant and how seasons align with the sun and the moon.

“Without the leap years, after a few hundred years we will have summer in November,” said Younas Khan, a physics instructor at the University of Alabama at Birmingham. “Christmas will be in summer. There will be no snow. There will be no feeling of Christmas.”

WHO CAME UP WITH LEAP YEAR?

The short answer: It evolved.

Ancient civilizations used the cosmos to plan their lives, and there are calendars dating back to the Bronze Age. They were based on either the phases of the moon or the sun, as various calendars are today. Usually they were “lunisolar,” using both.

Now hop on over to the Roman Empire and Julius Caesar. He was dealing with major seasonal drift on calendars used in his neck of the woods. They dealt badly with drift by adding months. He was also navigating a vast array of calendars starting in a vast array of ways in the vast Roman Empire.

He introduced his Julian calendar in 46 BCE. It was purely solar and counted a year at 365.25 days, so once every four years an extra day was added. Before that, the Romans counted a year at 355 days, at least for a time.

But still, under Julius, there was drift. There were too many leap years! The solar year isn’t precisely 365.25 days! It’s 365.242 days, said Nick Eakes, an astronomy educator at the Morehead Planetarium and Science Center at the University of North Carolina in Chapel Hill.

Thomas Palaima, a classics professor at the University of Texas at Austin, said adding periods of time to a year to reflect variations in the lunar and solar cycles was done by the ancients. The Athenian calendar, he said, was used in the fourth, fifth and sixth centuries with 12 lunar months.

That didn’t work for seasonal religious rites. The drift problem led to “intercalating” an extra month periodically to realign with lunar and solar cycles, Palaima said.

The Julian calendar was 0.0078 days (11 minutes and 14 seconds) longer than the tropical year, so errors in timekeeping still gradually accumulated, according to NASA. But stability increased, Palaima said.

The Julian calendar was the model used by the Western world for hundreds of years. Enter Pope Gregory XIII, who calibrated further. His Gregorian calendar took effect in the late 16th century. It remains in use today and, clearly, isn’t perfect or there would be no need for leap year. But it was a big improvement, reducing drift to mere seconds.

Why did he step in? Well, Easter. It was coming later in the year over time, and he fretted that events related to Easter like the Pentecost might bump up against pagan festivals. The pope wanted Easter to remain in the spring.

He eliminated some extra days accumulated on the Julian calendar and tweaked the rules on leap day. It’s Pope Gregory and his advisers who came up with the really gnarly math on when there should or shouldn’t be a leap year.

“If the solar year was a perfect 365.25 then we wouldn’t have to worry about the tricky math involved,” Eakes said.

WHAT’S THE DEAL WITH LEAP YEAR AND MARRIAGE?

Bizarrely, leap day comes with lore about women popping the marriage question to men. It was mostly benign fun, but it came with a bite that reinforced gender roles.

There’s distant European folklore. One story places the idea of women proposing in fifth century Ireland, with St. Bridget appealing to St. Patrick to offer women the chance to ask men to marry them, according to historian Katherine Parkin in a 2012 paper in the Journal of Family History.

Nobody really knows where it all began.

In 1904, syndicated columnist Elizabeth Meriwether Gilmer, aka Dorothy Dix, summed up the tradition this way: “Of course people will say … that a woman’s leap year prerogative, like most of her liberties, is merely a glittering mockery.”

The pre-Sadie Hawkins tradition, however serious or tongue-in-cheek, could have empowered women but merely perpetuated stereotypes. The proposals were to happen via postcard, but many such cards turned the tables and poked fun at women instead.

Advertising perpetuated the leap year marriage game. A 1916 ad by the American Industrial Bank and Trust Co. read thusly: “This being Leap Year day, we suggest to every girl that she propose to her father to open a savings account in her name in our own bank.”

There was no breath of independence for women due to leap day.

SHOULD WE PITY THE LEAPLINGS?

Being born in a leap year on a leap day certainly is a talking point. But it can be kind of a pain from a paperwork perspective. Some governments and others requiring forms to be filled out and birthdays to be stated stepped in to declare what date was used by leaplings for such things as drivers licenses, whether Feb. 28 or March 1.

Technology has made it far easier for leap babies to jot down their Feb. 29 milestones, though there can be glitches in terms of health systems, insurance policies and with other businesses and organization that don’t have that date built in.

There are about 5 million people worldwide who share the leap birthday out of about 8 billion people on the planet. Shelley Dean, 23, in Seattle, Washington, chooses a rosy attitude about being a leapling. Growing up, she had normal birthday parties each year, but an extra special one when leap years rolled around. Since, as an adult, she marks that non-leap period between Feb. 28 and March 1 with a low-key “whew.”

This year is different.

“It will be the first birthday that I’m going to celebrate with my family in eight years, which is super exciting, because the last leap day I was on the other side of the country in New York for college,” she said. “It’s a very big year.”

Leanne Italie, The Associated Press