jeff.mo...@multisystem.com wrote: > Can any of you puzzle experts think of any way to figure out what day that > Thanksgiving comes on for any specified year?
jeff.mo...@multisystem.com wrote: > Can any of you puzzle experts think of any way to figure out what day that > Thanksgiving comes on for any specified year?
jeff.mo...@multisystem.com wrote: > Can any of you puzzle experts think of any way to figure out what day that > Thanksgiving comes on for any specified year? I wrote: > Oh, you meant which DATE!
Take the year number y. Divide y-1900 by 4 to get q remainder r. Divide y+q+4 by 7 to get f remainder g. If g is less than 5, subtract g from 5 to get d. Otherwise, subtract g from 12 to get d. Thanksgiving comes on d+21.
For example, the current year is 1995. Divide 95 by 4 to get 23 remainder 3. Divide 122 by 7 to get 17 remainder 3. Subtract 3 from 5 to get 2. Thanksgiving comes on 23 November 1995.
I wrote: > Take the year number y. Divide y-1900 by 4 to get q remainder r. > Divide y+q+4 by 7 to get f remainder g. If g is less than 5, subtract > g from 5 to get d. Otherwise, subtract g from 12 to get d. Thanksgiving > comes on d+21.
> For example, the current year is 1995. Divide 95 by 4 to get 23 remainder > 3. Divide 122 by 7 to get 17 remainder 3. Subtract 3 from 5 to get 2. > Thanksgiving comes on 23 November 1995.
I forgot to mention that this only works until the year 2100.
In article <446gmt$...@nonews.col.hp.com>, c...@col.hp.com (Chris Best) wrote: > : Can any of you puzzle experts think of any way to figure out what day that > : Thanksgiving comes on for any specified year?
> ----------
> Well, the knee-jerk answer is "Thursday" in case that's what you were > trolling for (or away from).
> The whole answer, from the dictionary, is: 4th Thursday in November (in the > USA), 2nd Monday in October (in Canada).
> I'm still trying to figure what the "puzzle" was meant to be here.
Maybe a function "US" which maps from {years} to {22,23,24,25,26,27,28}, the possible dates in November on which Thanksgiving may fall in the US (trusting your dictionary to have the correct definition of Thanksgiving). Similarly for Canada, of course.
mag
-- Tom Magliery ** NCSA ** 605 E Springfield ** Champaign IL 61820 ** USA
I wrote: > Take the year number y. Divide y-1900 by 4 to get q remainder r. > Divide y+q+4 by 7 to get f remainder g. If g is less than 5, subtract > g from 5 to get d. Otherwise, subtract g from 12 to get d. Thanksgiving > comes on d+21.
Duh. Easier to do the following:
Take the year number y. Multiply y-1900 by 5, then divide by 4, then subtract 1. Take the remainder modulo 7. Subtract from 28. That's the date that Thanksgiving comes on.
In C:
offset = year-1900; date = 28-(offset*5/4-1)%7
For instance: 95*5/4 = 118 117/7 = 16 remainder 5 Thanksgiving comes on 23 November.
jeff.mo...@multisystem.com wrote: >Can any of you puzzle experts think of any way to figure out what day that >Thanksgiving comes on for any specified year? >---
Are you referring to American Thanksgiving (Nov 23rd) or Canadian (Oct 9th). ed_py...@mindlink.bc.ca Vancouver, British Columbia, Canada - its SuperNatural