sharky:
03/25/2013 at 16:04

Why on earth is 1900 not a leap year? A leap year occurs every 4 years, i.e. If it is divisible by 4, it is a leap year. And no more divisions by 100 or 400 are needed.

It’s normal to ask questions, but before you assert anything, study the hardware. The Earth revolves around the sun in 365 days 5 hours 48 minutes 46 seconds. As you can see, the remainder is not exactly 6 hours, but 11 minutes 14 seconds less. This means that by making a leap year we add extra time. Somewhere over 128 years, extra days accumulate. Therefore, every 128 years in one of the 4-year cycles there is no need to make a leap year in order to get rid of these extra days. But to simplify things, every 100th year is not a leap year. Is the idea clear? Fine. What then should we do next, since an extra day is added every 128 years, and we cut it off every 100 years? Yes, we cut off more than we should, and this needs to be returned at some point.

If the first paragraph is clear and still interesting, then read on, but it will be more difficult.

So, in 100 years, 100/128 = 25/32 days of excess time accumulates (that’s 18 hours 45 minutes). We do not make a leap year, that is, we subtract one day: we get 25/32-32/32 = -7/32 days (that’s 5 hours 15 minutes), that is, we subtract the excess. After four cycles of 100 years (after 400 years), we will subtract an extra 4 * (-7/32) = -28/32 days (this is minus 21 hours). For the 400th year we make a leap year, that is, we add a day (24 hours): -28/32+32/32=4/32=1/8 (that’s 3 hours).
We make every 4th year a leap year, but at the same time every 100th year is not a leap year, and at the same time every 400th year is a leap year, but still every 400 years an extra 3 hours are added. After 8 cycles of 400 years, that is, after 3200 years, an extra 24 hours will accumulate, that is, one day. Then another one is added required condition: Every 3200th year must not be a leap year. 3200 years can be rounded up to 4000, but then you will again have to play with added or trimmed days.
3200 years have not passed, so this condition, if it is made this way, is not yet talked about. But 400 years have already passed since the approval of the Gregorian calendar.
Years that are multiples of 400 are always leap years (for now), other years that are multiples of 100 are not leap years, and other years that are multiples of 4 are leap years.

The calculation I gave shows that in the current state, an error in one day will accumulate over 3200 years, but here’s what Wikipedia writes about it:
“An error of one day compared to the year of the equinoxes in the Gregorian calendar will accumulate in approximately 10,000 years (in the Julian calendar - approximately in 128 years). A frequently encountered estimate, leading to a value of the order of 3000 years, is obtained if one does not take into account that the number of days in the tropical year changes over time and, in addition, the relationship between the lengths of the seasons changes.” From the same Wikipedia, the formula for the length of a year in days with fractions paints a good picture:

365,2425=365+0,25-0,01+0,0025=265+1/4-1/100+1/400

The year 1900 was not a leap year, but 2000 was, and special, because such a leap year happens once every 400 years.

2016 is a leap year with 366 days instead of the usual 365. Leap year was proposed to synchronize calendars. Did you know that not every 4th year is a leap year?Why is a leap year considered unlucky, and what signs are associated with it?Here are a few facts you may not know about leap year.

What does leap year mean?

1 . A leap year is a year that has 366 days rather than the usual 365. An additional day in a leap year is added in February - February 29 (leap day).

An additional day in a leap year is necessary because a full revolution around the Sun takes a little more than 365 days, or rather 365 days, 5 hours, 48 ​​minutes and 46 seconds.

People once followed a 355-day calendar with an additional 22-day month every two years. But in 45 BC. Julius Caesar, together with the astronomer Sosigenes, decided to simplify the situation, and the Julian 365-day calendar was developed, with an extra day every 4 years to compensate for the extra hours.

This day was added in February because it was once the last month in the Roman calendar.

2 . This system was supplemented by dad Gregory XIII(who introduced the Gregorian calendar), who coined the term "leap year" and declared that year, multiple of 4 and multiple of 400, but not multiple of 100, is a leap year.

So on Gregorian calendar 2000 was a leap year, but 1700, 1800 and 1900 were not.

What are leap years in the 20th and 21st centuries?

1904, 1908, 1912, 1916, 1920, 1924, 1928, 1932, 1936, 1940, 1944, 1948, 1952, 1956, 1960, 1964, 1968, 1972, 1976, 1980, 1984, 1988, 1992, 1996, 2000, 2004, 2008, 2012, 2016, 2020, 2024, 2028, 2032, 2036, 2040, 2044, 2048, 2052, 2056, 2060, 2064, 2068, 2072, 2076, 2080, 2084, 2088, 2092, 2096

February 29 is leap day

3 . February 29 is considered the only day when a woman can propose marriage to a man. This tradition began in 5th century Ireland when St. Brigid complained to St. Patrick that women had to wait too long for suitors to propose.

Then he gave women one day in a leap year - the last day in the shortest month, so that the fair sex could propose to a man.

According to legend, Brigitte immediately knelt down and proposed to Patrick, but he refused, kissing her on the cheek and offering her a silk dress to soften her refusal.

4 . According to another version, this tradition appeared in Scotland, when Queen Margaret, at the age of 5, announced in 1288 that a woman could propose to any man she liked on February 29.

She also made a rule that those who refused had to pay a fine in the form of a kiss, a silk dress, a pair of gloves or money. To warn suitors in advance, the woman was required to wear trousers or a red petticoat on the day of the proposal.

In Denmark, a man who refuses a woman's marriage proposal must provide her with 12 pairs of gloves, and in Finland - fabric for a skirt.

Leap year wedding

5 . One in five couples in Greece avoid getting married on a leap year, as it is believed to brings bad luck.

In Italy it is believed that during a leap year the woman becomes unpredictable and at this time there is no need to plan important events. So, according to the Italian proverb "Anno bisesto, anno funesto". (“A leap year is a doomed year”).

Born on February 29

6 . The chances of being born on February 29th are 1 in 1461. Around the world, about 5 million people were born on Leap Day.

7 . For many centuries, astrologers believed that Children born on Leap Day have unusual talents, a unique personality and even special forces. Among famous people Those born on February 29 can name the poet Lord Byron, composer Gioachino Rossini, actress Irina Kupchenko.

8. In Hong Kong, the official birthday for those born on February 29 is March 1 in normal years, while in New Zealand it is February 28. If you time it correctly, you can celebrate while traveling from one country to another longest birthday in the world.

9. The city of Anthony in Texas, USA is a self-proclaimed " world capital of leap year". A festival is held here annually, where those born on February 29 gather from all over the world.

10. Record the largest number generations born on leap day, belongs to the Keogh family.

Peter Anthony Keogh was born on February 29, 1940 in Ireland, his son Peter Eric was born on February 29, 1964 in the UK, and his granddaughter Bethany Wealth was born on February 29, 1996.

11. Karin Henriksen from Norway holds the world record the largest number of children born on leap day.

Her daughter Heidi was born on February 29, 1960, son Olav on February 29, 1964, and son Lief-Martin on February 29, 1968.

12. In the traditional Chinese, Jewish and ancient Indian calendars, not a leap day is added to the year, but a whole month. It is called the "intercalary month". It is believed that children born in a leap month are more difficult to raise. In addition, it is considered unlucky to start serious business during a leap year.

Leap year: signs and superstitions

Since ancient times, a leap year has always been considered difficult and bad for many undertakings. IN folk beliefs Leap year is associated with Saint Kasyan, who was considered evil, envious, stingy, unmerciful and brought misfortune to people.

According to legend, Kasyan was a bright angel to whom God trusted all plans and intentions. But then he went over to the side of the Devil, telling him that God intended to overthrow all satanic power from heaven.

For his betrayal, God punished Kasyan by ordering him to be beaten on the forehead with a hammer for three years, and in the fourth year to be released to earth, where he committed unkind deeds.

There are many signs associated with leap year:

Firstly, on a leap year you can't start anything. This applies to important matters, business, major purchases, investments and construction.

Is it possible to get married on a leap year?

Leap year is considered extremely unsuccessful for marriage. Since ancient times, it was believed that a wedding played in a leap year would lead to an unhappy marriage, divorce, infidelity, widowhood, or the marriage itself would be short-lived.

This superstition may be due to the fact that in a leap year, girls could woo anyone they liked young man, who could not refuse the offer. Often such marriages were forced, and therefore family life didn't ask.

However, you should treat these signs wisely and understand that everything depends on the spouses themselves and how they build the relationship. If you do plan a wedding, there are several ways to mitigate the “consequences”:

Brides are advised to wear long dress for a wedding, covering the knees to make the marriage last.

Wedding dress and other wedding accessories It is not recommended to give it to anyone.

The ring should be worn on the hand, not the glove., since wearing a ring on a glove will cause the spouses to take marriage lightly

To protect the family from troubles and misfortunes, a coin was placed in the shoes of the bride and groom.

What should you not do during a leap year?

· During a leap year don't carol at Christmas time, since it is believed that you can lose your happiness. Also, by sign, a caroler who dresses up as an animal or monster can take on the personality evil spirits.

· Pregnant women should not have their hair cut before giving birth, since the child may be born unhealthy.

· During a leap year do not start building a bathhouse, which can lead to illness.

· You can't pick mushrooms, as it is believed that they all become poisonous.

· In a leap year there is no need to celebrate the appearance baby's first tooth. According to legend, if you invite guests, your teeth will be bad.

· You can't change jobs or apartments. According to the sign, the new place will turn out to be joyless and turbulent.

· If a child is born on a leap year, it must be baptize as quickly as possible, and choose godparents among blood relatives.

· Elderly people are not allowed buy things for the funeral in advance, as this can bring death closer.

· You can't get a divorce, because in the future you will not be able to find your happiness.


I hope you had a great New Year and are in a great holiday mood right now. At least that’s how it is for me - we didn’t drink any alcohol, and clinked glasses of water from a five-liter canister at midnight, so we woke up, took a walk, and then I remembered one of yesterday’s Happy New Year greetings:

I wish that at the end of each year, remembering what happened over the last 366 if ((year%4 == 0 and year%100 != 0) or (year%400 == 0)) else 365 days, think about myself:

Oh, wow, what an action that was. I will definitely tell my grandchildren or write a book about it later.


So, above is a fairly simple inline way to determine the number of days in a year (year variable), which, in fact, fully reveals their essence: in the Gregorian calendar leap years those years are considered whose serial number is either a multiple of 4, but not a multiple of 100, or a multiple of 400. In other words, if a year is divisible by 4 without a remainder, but is divisible by 100 only with a remainder, then it is a leap year, otherwise it is not a leap year, except case, if it is divisible by 400 without a remainder, then it is still a leap year.

For example, 2013 is not a leap year, 1700, 1800 and 1900 are again not leap years, but 2000, 2004, 2008 and 2012 are leap years.

But what if we don't remember how many days there are in leap years (366 days) and non-leap years (365 days), or we just want to write the definition of the number of days in a year as quickly as possible? Is it possible to do this in Python? Of course you can.

So Python has a calendar module. It is perfect for finding out whether a year is a leap year (or, for example, how many leap years there are in a certain interval), determining the number of days in a month, getting the number of the day of the week for a certain date, and so on.

In particular, we can get the number of days in each month of the year and simply add them up.

The calendar.monthrange function takes the year number as the first argument and the month number as the second argument. Returns the number of the day of the week on the first day of the given month and the number of days in the given month:

>>> import calendar >>> calendar.monthrange(2013, 1) (1, 31)
Accordingly, we can calculate total days for all 12 months, and thus get the number of days for a given year:

>>> import calendar >>> year = 2013 >>> sum(map(lambda x: calendar.monthrange(year, x), range(1, 13))) 365
But if you think about how exactly this line is executed, it becomes obvious that this solution is very inefficient if you need to count the number of days for large quantity years.

We check using the timeit module.

To perform it 1 million times, it takes 13.69 seconds if import calendar is done once at the beginning. If import calendar is done every time then 14.49 seconds

Now let's try another option. It requires knowing how many days there are in leap and non-leap years, but it is very short:

>>> import calendar >>> year = 2013 >>> 365+calendar.isleap(year) 365
And, as you might guess, it is already much faster: 0.83 seconds, including import calendar, and 0.26 seconds if import calendar is done once at the beginning.

Let's also see how long the very first option takes, with a "manual" approach: 0.07 seconds for 2012 and 2013 and 0.12 seconds for 2000 (I think everyone understands where such a difference in speed comes from for these years).

It turns out that this is the most quick option of these three:

>>> import calendar >>> year = 2013 >>> 366 if ((year%4 == 0 and year%100 != 0) or (year%400 == 0)) else 365 365
Of course, in most cases you can use any of these options - after all, when determining the number of days in one, two, ten or a hundred years, you are unlikely to notice any difference.

Write, optimize, improve, test and measure performance - but don't forget about the readability of the source code of your programs.

Happy New Year! Good luck, happiness, joy and self-improvement in the new year.

Leap year (lat. bis sextus - “second sixth”) - a year in the Julian and Gregorian calendars, the duration of which is 366 days - for one day longer duration an ordinary, non-leap year. In the Julian calendar, every fourth year is a leap year; in the Gregorian calendar there are exceptions to this rule.

A year is a conventional unit of time, which historically meant a single cycle of seasons (spring, summer, autumn, winter). In most countries, the calendar year is 365 or 366 days. Currently, the year is also used as a time characteristic of the revolution of planets around stars in planetary systems, in particular the Earth around the Sun.

The calendar year in the Gregorian and Julian calendars is 365 days in non-leap years, and 366 days in leap years. The average length of the year is 365.2425 days for the Gregorian calendar and 365.25 days for the Julian calendar.

The calendar year in the Islamic calendar contains 353, 354 or 355 days - 12 lunar months. Average duration year - 354.37 days, which is less than a tropical year and therefore Muslim holidays “roam” according to the seasons.

The calendar year in the Hebrew calendar contains 353, 354 or 355 days in a common year and 383, 384 or 385 days in a leap year. The average length of the year is 365.2468 days, which is close to the tropical year.

The length of the tropical year (the time between the two spring equinoxes) is 365 days 5 hours 48 minutes 46 seconds. The difference in the length of the tropical year and the average Julian calendar year (365.25 days) is 11 minutes 14 seconds. From these 11 minutes and 14 seconds, one day is added up in approximately 128 years.

Over the centuries, a shift in the day of the vernal equinox, which is associated with church holidays. By the 16th century the vernal equinox occurred approximately 10 days earlier than March 21, which is used to determine the day of Easter.

To compensate for the accumulated error and avoid such a shift in the future, in 1582 Pope Gregory XIII carried out a calendar reform. To average calendar year corresponded better to the solar one, it was decided to change the rule of leap years. As before, a year whose number was a multiple of four remained a leap year, but an exception was made for those that were a multiple of 100. From now on, such years were leap years only when they were also divisible by 400.

In other words, a year is a leap year in two cases: either it is a multiple of 4, but not a multiple of 100, or a multiple of 400. A year is not a leap year if it is not a multiple of 4, or it is a multiple of 100, but not a multiple of 400.

The last years of centuries ending in two zeros are not leap years in three cases out of four. Thus, the years 1700, 1800 and 1900 are not leap years, since they are a multiple of 100 and not a multiple of 400. The years 1600 and 2000 are leap years, since they are a multiple of 400. The years 2100, 2200 and 2300 are not leap years. In leap years, an additional day is introduced - February 29. The Catholic world lives according to the Julian calendar. Unlike the Julian calendar, the Gregorian calendar takes into account only one object - the Sun.

Now we live according to the Julian calendar (new style), before the revolution we lived according to the Gregorian calendar (old style). The difference between the old and new styles was 11 days in the 18th century, 12 days in the 19th century, and 12 days in the 20th century. XXI centuries- 13 days. In the 22nd century, this difference will already be 14 days. The Gregorian calendar was introduced under Soviet rule on February 14, 1918 (after January 31, it was no longer February 1, but immediately the 14th). The last leap year was, the next one will be.

1996, 1992, 1988, 1984, 1980, 1976, 1972, 1968, 1964, 1960, 1956, 1952, 1948, 1944, 1940, 1936, 1932, 1928, 1924, 1920, 191 6, 1912, 1908, 1904, Gregorian According to the Julian calendar, 1900 is a leap year. 1896.

Note: For most computer and mobile systems, valid dates are from December 13, 1901, 20:45:54 GMT to January 19, 2038, 03:14:07 GMT. (These dates correspond to the minimum and maximum value of a 32-bit signed integer.) For Windows, valid dates are 01/01/1970 to 01/19/2038.

A leap year occurs once every four years. But why then was 1904 a leap year, 1900 was not, and 2000 was again?

The Summer Olympics are held in a leap year - where did this order come from? And why do we need any special “extended” years at all? How are they different from ordinary ones? Let's figure it out.

Who introduced leap years into the calendar?

Ancient Roman astronomers were well aware that a year on Earth lasts 365 days and a few more hours. Because of this, the calendar year, which then consisted of a constant number of days, did not coincide with the astronomical one. The excess hours gradually accumulated, turning into days. Calendar dates gradually shifted and deviated from natural phenomena- for example, the equinoxes. A group of astronomers led by Sosigenes, working at the court of Julius Caesar, proposed adjusting the calendar. According to the new chronology, every fourth year was extended by one day. This year began to be called bis sextus, which in Latin means "second sixth" . In Russian this word was transformed into "leap" - that’s what we call it to this day.

By order of Julius Caesar, a new calendar was introduced starting in 45 BC. After the death of the emperor, there was a glitch in the calculation of leap years, and the countdown began again from the 8th year of our era. That's why even years are leap years today.

It was decided to add a day to the last, shortest month of the year, which already “didn’t have enough days.” IN Ancient Rome New Year was celebrated on March 1, so the extra 366th day was added to February. The new calendar began to be called “Julian” in honor of Caesar. By the way, the Orthodox and some other churches still live according to the Julian calendar - this is a tribute to tradition.

And again the calendar changes

Astronomical observations continued, methods became more and more accurate. Over time, astrologers realized that the duration of the earth's year is not 365 days and 6 hours, but slightly less. (We now know that a year lasts 365 days, 5 hours, 48 ​​minutes and 46 seconds.)


The use of the Julian calendar led to the fact that the calendar began to lag behind the real flow of time. Astronomers have noticed that the spring equinox occurs much earlier than the day allotted to it according to the calendar, that is, March 21. There was a need to adjust the calendar, which was done by decree of Pope Gregory XIII in 1582.

To compensate for the discrepancy, they decided to set leap years according to a new rule. It was necessary to reduce their number, which was done. From that moment on, all years that are divisible by four are still considered leap years, except those that are divisible by 100. For even more accurate calculation, years that are divisible by 400 are still considered leap years.

That is why 1900 (like 1700 and 1800) was not a leap year, but 2000 (like 1600) was.

The new calendar was named Gregorian in honor of the Pope - all countries of the world currently live according to it. The Julian calendar is used by a number of Christian churches– including the Russian Orthodox Church.

Rule for determining leap years

So, leap years are determined using a simple algorithm:

If a year is divisible by 4 but not divisible by 100, it is a leap year;

If a year is divisible by 100, it is not considered a leap year;

If a year is divisible by 100 and also divisible by 400, it is a leap year.

How is a leap year different from others?

Only one - it has 366 days, with an additional day assigned to February. Despite the fact that the year now begins on January 1, which means the last month of the year is December, we still give an extra day to February. He's the shortest - we'll feel sorry for him!

And let's rejoice for those who were born on February 29 in a leap year. These “lucky ones” celebrate their birthday once every four years, which makes this event more long-awaited and desirable than for other people.

What happens during a leap year?

Leap years were chosen to host the main sporting event humanity - the Olympics. Now, in leap years, only the summer Games are held, and the winter Games are held with a shift of two years. The sports community adheres to ancient tradition, which was established by the first Olympians - the ancient Greeks.


It was they who decided that such a grandiose event should not happen too often - once every four years. The four-year cycle coincided with the alternation of leap years, so modern Olympics began to be carried out specifically in leap years.