How to go about finding how many years between 1 and 2000 were leap years? Question:
Assuming x represents the value of the year. If x is divisible by 4, then the year is determined as being leap. But, if x is divisible by 100, then, the year would be determined as not being leap, unless it would be divisible 400, which would then imply it being leap. How many years between 1 and 2000 would be leap?
Here is what I got:
Number of years divisible by 4 = $\frac{1996-4}{4}+1$ = 499
Number of years divisible by 100 = $\frac{1900-100}{100}+1$ = 19
Number of years divisible by 400 = $\frac{1600-400}{400}+1$ = 4
Number of years between 1 and 2000 would be leap = 499 - 19 + 4 = 484
Could anyone assist me into reformatting/ presenting my answers into a more mathematically proper presentation?
 A: Prior to the Gregorian calendar, a leap year would occur once every four years. In this case we have
$$j(x)=\left\lfloor\frac{x}{4}\right\rfloor$$
Once the Gregorian calendar was adopted, which occurred in 1582, we have that every 400 years contains 97 leap years. Hence
$$g(x)=\left\lfloor\frac{97x}{400}\right\rfloor$$
In this case we also have to account for the 12 leap years that occurred prior to 1582. Kudos to egreg for pointing this out.
$$g(x)=\left\lfloor\frac{97x}{400}\right\rfloor+12$$
Since 4 AD was not a leap year, we must substract one from the end result in both scenarios
$$j(x)=\left\lfloor\frac{x}{4}\right\rfloor-1$$
$$g(x)=\left\lfloor\frac{97x}{400}\right\rfloor+11$$
Ultimately what you're looking for is this
$$f(x)=\left\{\begin{array}{ll}
0, & x\lt 4 \\
\left\lfloor\frac x4\right\rfloor-1, & 4\le x\lt 1582 \\
\left\lfloor\frac{97x}{400}\right\rfloor+11, & x\ge 1582
\end{array}\right.$$
Where $x$ is an integer that represents a given year in the common era. Since we seek the total number of leap years between 1 and 2000, we have
$$f(1999)=495$$
And we're done. I hope this helps you understand.
A: For a moment, let's gloss over the finer points of how leap years are determined, and find the number of multiple of $4$'s there are between $4$ and $1996$:
\begin{align}
1996-4 &= 1992 \\
1992 \div 4 &= 498 \, .
\end{align}
$498$ is not quite right because of what's called the Fence Post Problem. How many multiple of $4$'s are there between $4$ and $8?$ Not one but two! So there are actually $499$ multiple of $4$'s between $4$ and $1996$. Now let's try to think about the multiples of $100$ that are not multiples of $400$. There are $19$ multiples of $100$ in the range: $100,200,300,\ldots,1900$. Of those $19$, four of them are multiples of $400$. So there are $15$ exceptions that we have to deal with. We are left with
$$
499-15=484
$$
leap years.

This answer is technically incorrect because $4$ AD was not a leap year, as k170 has pointed out. So we are left with $483$ leap years (unless someone points out some other idiosyncrasy about the calendar system!).
A: Another way to get the answer summarizes as
$${2000\over4}-{2000\over100}+{2000\over400}-1$$
That is, start by including year 2000 and assume for the moment that every fourth year is a leap year. That gives the $2000/4$. Next assume you throw away the leap day from every century mark. That gives the $-2000/100$. Then remember that there is a leap year in every fourth century mark. That gives the $2000/400$. And finally, remember that you don't want to include the year 2000. That gives the $-1$.
Remark: As k170 points out, the Julian calendar omitted leap day in the year 4, so there's an argument for subtracting another $1$ from the answer. However, the Julian calendar otherwise included leap days every four years, not skipping century marks, so there is an argument for adding back another dozen to the answer, since the Gregorian calendar, whose main innovation was the skipping of leap day in three out of every four century marks, wasn't invented until the sixteenth century. The reason for saying "a dozen or so" instead of something more precise is that the exact answer is geopolitically dependent: Different countries adopted the Gregorian calendar in different centuries. (See egreg's comment below k170's answer, which I only just now noticed.)
