How to Determine the Day of the Week

download How to Determine the Day of the Week

of 3

Transcript of How to Determine the Day of the Week

  • 8/12/2019 How to Determine the Day of the Week

    1/3

    How to Determine the Day of the Week,

    Given the Month, Day and Year

    [Home Page][Junior Database] [enior Database][!"#oad][ear$h][%isitor&s'ook]

    First a brief explanation: In the Gregorian Calendar, over a period of four hundred years,there are 97 leap years and 303 normal years !a"h normal year, the day of #anuary $

    advan"es by one% for ea"h leap year it advan"es by t&o

    's a result, #anuary $ year ( o""urs on the same day of the &ee) as #anuary $ year ( * +00

    e"ause the leap year pattern also re"urs &ith a four hundred year "y"le, a simple table offour hundred elements, and single modulus, suffi"es to determine the day of the &ee) -in the

    Gregorian Calendar., and does it mu"h faster than all the other algorithms proposed 'lso,

    ea"h element ta)es -in prin"iple. only three bits% the entire table thus ta)es only $/00 bits% onmany "omputers this &ill be less than the instru"tions to do all the "ompli"ated "al"ulations

    proposed for the other

    algorithms

    In"idental note: e"ause 7 does not divide +00, #anuary $ o""urs more freuently on somedays than others1 2ri") your friends1 In a "y"le of +00 years, #anuary $ and ar"h $ o""ur on

    the follo&ing days &ith the follo&ing freuen"ies:

    4un on 2ue 5ed 2hu Fri 4at

    #an $ 6 68 6 67 67 6 68

    ar $ 6 68 6 68 6 67 67

    f interest is that -"ontrary to most initial guesses. the o""urren"e is not maximally flat

    In the athemati"al Gaette, vol 63,, pp$/7;$/9, it is sho&n that the $3th of the month is

    more li)ely to be a Friday than any other day 2he author is a $3 year old, 4 / elements is ne"essary forthe #ulian Calendar

    2here is still a 3 day over $0,000 years error &hi"h the Gregorian "alendar does not ta)e into

    a""ount 't some time su"h a "orre"tion &ill have to be done but your soft&are &ill probably

    http://smard.cqu.edu.au/Database/Puzzles/smad.htmlhttp://smard.cqu.edu.au/Database/Puzzles/junior.htmlhttp://smard.cqu.edu.au/Database/Puzzles/senior.htmlhttp://smard.cqu.edu.au/Database/Puzzles/upload.htmlhttp://smard.cqu.edu.au/cgi-bin/ffwcgi.en/schoolshttp://smard.cqu.edu.au/cgi-bin/ffwcgi.en/schoolshttp://smard.cqu.edu.au/Database/Puzzles/visitors.htmlhttp://smard.cqu.edu.au/Database/Puzzles/visitors.htmlhttp://smard.cqu.edu.au/Database/Puzzles/smad.htmlhttp://smard.cqu.edu.au/Database/Puzzles/junior.htmlhttp://smard.cqu.edu.au/Database/Puzzles/senior.htmlhttp://smard.cqu.edu.au/Database/Puzzles/upload.htmlhttp://smard.cqu.edu.au/cgi-bin/ffwcgi.en/schoolshttp://smard.cqu.edu.au/Database/Puzzles/visitors.htmlhttp://smard.cqu.edu.au/Database/Puzzles/visitors.html
  • 8/12/2019 How to Determine the Day of the Week

    2/3

    not last that long1

    ?ere is a standard method suitable for mental "omputation:

    $ 2a)e the last t&o digits of the year/ @ivide by +, dis"arding any fra"tion

    3 'dd the day of the month+ 'dd the monthAs )ey value: #F '# #'4 (@ $++ 0/6 038 $+8

    6 4ubtra"t $ for #anuary or February of a leap year

    8 For a Gregorian date, add 0 for $900As, 8 for /000As, + for $700As, /for $00As% for other years, add or subtra"t multiples of +00

    7 For a #ulian date, add $ for $700As, and $ for every additional "entury you go ba")

    'dd the last t&o digits of the year9 @ivide by 7 and ta)e the remainder

    (o& $ is 4unday, the first day of the &ee), / is onday, and so on

    2he follo&ing formula, &hi"h is for the Gregorian "alendar only, may be more "onvenient

    for "omputer programming (ote that in some programming languages the remainder

    operation "an yield a negative result if given a negative operand, so mod 7 may not translateto a simple remainder

    ' good mnemoni" rule to help on the "omputation of the day of the &ee) is as follo&s In

    any given year the follo&ing days "ome on the same day of the &ee):+B+

    8B8

    B$0B$0$/B$/

    2o remember the next four, remember that I &or) from 9;6 at a 7;$$ so

    9B6

    6B97B$$

    $$B7

    and the last day of February

    In $996 they "ome on 2uesday !very year this advan"es one other than leap;years &hi"hadvan"e / 2herefore for $998 the day &ill be 2hursday, and for $997 it &ill be Friday

    2herefore ordinarily every + years it advan"es 6 days 2here is a minor "orre"tion for the

    "entury sin"e the "entury is a leap year iff the "entury is divisible by + 2herefore /000 is aleap year, but $900, $00, and $700 &ere not

    !ven ignoring the pattern over for a period of years this is still useful sin"e you "an generally

    figure out &hat day of the &ee) a given date is on faster than someone else "an loo) it up

  • 8/12/2019 How to Determine the Day of the Week

    3/3

    &ith a "alender if the "alender is not right there -' useful s)ill that.