Skip to main content
added 154 characters in body
Source Link
Rand al'Thor
  • 118k
  • 29
  • 325
  • 637

The only thing I can think of is

it gives you the day of the week from the date of the year (d,m,y with C and CD giving you information about the century and 4-century for leap-year purposes).

Now I have to work out the algebra to prove it - thanks Cop for wasting my time on this! :-[


Edit: looks similar to the C formula

here.


Progress - The input quantities are as follows:

$d$ is the day, $m$ is the month, $y$ is the year, $C=100$, $CD=400$ (Roman numerals - crafty!).

EditFirst consider the quantity $(1/(y\%4+1)+1/(y\%CD+1)-1/(y\%C+1))$. There are four cases to consider: looks similar

  • if $y$ is not a multiple of 4, then the first fraction is at most $\frac{1}{2}$ and (since 4 divides $CD$ and $C$) the whole sum is less than 1

  • if $y$ is a multiple of 4 but not of $C$, then the first fraction is exactly 1 and either the other two are equal or the $C$ one is smaller than the $CD$ one, so the whole sum is at least 1

  • if $y$ is a multiple of $C$ but not of $CD$, then the first and last fractions are exactly 1 and cancel out to leave the whole sum less than 1

  • if $y$ is a multiple of $CD$, then all three fractions are exactly 1 and the whole sum is 1.

So $(2-(1/(y\%4+1)+1/(y\%CD+1)-1/(y\%C+1)))$ is less than or equal to the C formula1 iff

the year denoted by here$y$ is a leap year.

Also $(m/3+1)$ is less than 2 iff

the month denoted by $m$ is January or February.

So the final term in the sum, $(1/(m/3+1)(2-(1/(y\%4+1)+1/(y\%CD+1)-1/(y\%C+1))))$, is greater than $\frac{1}{2}$ iff we need to alter the final answer due to

a leap year.

The only thing I can think of is

it gives you the day of the week from the date of the year (d,m,y with C and CD giving you information about the century and 4-century for leap-year purposes).

Now I have to work out the algebra to prove it - thanks Cop for wasting my time on this! :-[

Edit: looks similar to the C formula

here.

The only thing I can think of is

it gives you the day of the week from the date of the year (d,m,y with C and CD giving you information about the century and 4-century for leap-year purposes).

Now I have to work out the algebra to prove it - thanks Cop for wasting my time on this! :-[


Edit: looks similar to the C formula

here.


Progress - The input quantities are as follows:

$d$ is the day, $m$ is the month, $y$ is the year, $C=100$, $CD=400$ (Roman numerals - crafty!).

First consider the quantity $(1/(y\%4+1)+1/(y\%CD+1)-1/(y\%C+1))$. There are four cases to consider:

  • if $y$ is not a multiple of 4, then the first fraction is at most $\frac{1}{2}$ and (since 4 divides $CD$ and $C$) the whole sum is less than 1

  • if $y$ is a multiple of 4 but not of $C$, then the first fraction is exactly 1 and either the other two are equal or the $C$ one is smaller than the $CD$ one, so the whole sum is at least 1

  • if $y$ is a multiple of $C$ but not of $CD$, then the first and last fractions are exactly 1 and cancel out to leave the whole sum less than 1

  • if $y$ is a multiple of $CD$, then all three fractions are exactly 1 and the whole sum is 1.

So $(2-(1/(y\%4+1)+1/(y\%CD+1)-1/(y\%C+1)))$ is less than or equal to 1 iff

the year denoted by $y$ is a leap year.

Also $(m/3+1)$ is less than 2 iff

the month denoted by $m$ is January or February.

So the final term in the sum, $(1/(m/3+1)(2-(1/(y\%4+1)+1/(y\%CD+1)-1/(y\%C+1))))$, is greater than $\frac{1}{2}$ iff we need to alter the final answer due to

a leap year.

added 154 characters in body
Source Link
Rand al'Thor
  • 118k
  • 29
  • 325
  • 637

The only thing I can think of is

it gives you the day of the week from the date of the year (d,m,y with C and CD giving you information about the century and 4-century for leap-year purposes).

Now I have to work out the algebra to prove it - thanks Cop for wasting my time on this! :-[

Edit: looks similar to the C formula

here.

The only thing I can think of is

it gives you the day of the week from the date of the year (d,m,y with C and CD giving you information about the century and 4-century for leap-year purposes).

Now I have to work out the algebra to prove it - thanks Cop for wasting my time on this! :-[

The only thing I can think of is

it gives you the day of the week from the date of the year (d,m,y with C and CD giving you information about the century and 4-century for leap-year purposes).

Now I have to work out the algebra to prove it - thanks Cop for wasting my time on this! :-[

Edit: looks similar to the C formula

here.

Source Link
Rand al'Thor
  • 118k
  • 29
  • 325
  • 637

The only thing I can think of is

it gives you the day of the week from the date of the year (d,m,y with C and CD giving you information about the century and 4-century for leap-year purposes).

Now I have to work out the algebra to prove it - thanks Cop for wasting my time on this! :-[