Ted's Math World Be Your Own
Perpetual Calendar

Calculate the Day of the Week for any Date

It's easier than you might think.  A short string of digits and a short formula are all that are required for an all-encompassing calendar.  In fact, anyone reasonably proficient with numbers can perform this calculation in his/her head!  While your companions are fumbling for a notebook or reaching for a PDA, you could already have the answer.

This algorithm is well-known.  I even found mention of it in an ancient Funk & Wagnall Encyclopedia.  I merely offer suggestions for streamlining the method for ease of calculation.

The months and weekdays have serial identifications as follows:

Image


For each month, its code simply reflects the prior month's code, plus the number of days in the prior month in excess of 28.  January has 31 days, or 28+3; therefore, February's code = January's code + 3.  Whenever the number goes to 7 or higher, 7 is subtracted.  It would be necessary to memorize or reconstruct these two tables in order to do mental date calculations.

This is the magic formula:

Image

That's all there is to it.  Here are some examples:

Image

That wasn't too difficult, and we got the correct answers.  The process can be made even easier, however.  Notice that, at the end, we are interested only in the remainder; the number of 7's taken out is immaterial.  This means that we can keep our numbers small by "casting out" 7's during the calculation!  Moreover, when working in modulus 7, the value 6 is equivalent to -1, and 5 is equivalent to -2; the arithmetically adept could employ those shortcuts as well.

Let's try a more efficient approach to the second example, by removing multiples of 7 at every opportunity:

Image

This systematic compression enables the running total to be kept to 6 or less at all times, thereby reducing the mental effort.  Of course, knowing the multiples of seven is very handy as well!

It also is helpful to file away in memory the combined code for the current year, which makes short work of any same-year calculation.  The code for 2004 is 5: 4 for the year, plus 1 for the leapyear adjustment.  So, December 31, 2004  is quickly calculated as 5 + 3 + 5 = 13 = 6 = Friday.

Happy dating!


* To go back past the last year of a century (such as 2000), add 2; to go forward into the last year of a century or beyond, subtract 2.  Change the 2 to a 1 if the end-of-century year being crossed is a leap year (that is, evenly divisible by 400) such as 2000 (yes, year 2000 was in the 20th century).  In short, add 1 for years 19xx; add 3 for years 18xx; subtract 2 for years 21xx.

Go Back

玻璃钢生产厂家蓬莱玻璃钢座椅雕塑情人节商场美陈图片北京定制玻璃钢雕塑方法抚州环保玻璃钢雕塑莱州玻璃钢雕塑玻璃钢雕塑模具成本南山玻璃钢雕塑造型5月商场美陈呼和浩特动物玻璃钢雕塑价格陕西玻璃钢仿真水果雕塑河南商场美陈公司有哪些北京玻璃钢雕塑工程萍乡特色玻璃钢雕塑多少钱党建文化玻璃钢雕塑费用是多少安义玻璃钢花盆花器巴中玻璃钢造型雕塑不锈钢仿古玻璃钢仿铜雕塑价格玻璃钢观音雕塑图片陆丰玻璃钢人物雕塑玻璃钢雕塑厂家有招工城市玻璃钢雕塑的价格内蒙古玻璃钢雕塑灯十二生肖玻璃钢雕塑制作南宁玻璃钢猪雕塑玻璃钢传统人物雕塑工厂店大型玻璃钢雕塑加工厂家江苏天筑玻璃钢雕塑厂潜江玻璃钢雕塑制作玻璃钢圣诞老人卡通雕塑茂名商场美陈雕塑香港通过《维护国家安全条例》两大学生合买彩票中奖一人不认账让美丽中国“从细节出发”19岁小伙救下5人后溺亡 多方发声单亲妈妈陷入热恋 14岁儿子报警汪小菲曝离婚始末遭遇山火的松茸之乡雅江山火三名扑火人员牺牲系谣言何赛飞追着代拍打萧美琴窜访捷克 外交部回应卫健委通报少年有偿捐血浆16次猝死手机成瘾是影响睡眠质量重要因素高校汽车撞人致3死16伤 司机系学生315晚会后胖东来又人满为患了小米汽车超级工厂正式揭幕中国拥有亿元资产的家庭达13.3万户周杰伦一审败诉网易男孩8年未见母亲被告知被遗忘许家印被限制高消费饲养员用铁锨驱打大熊猫被辞退男子被猫抓伤后确诊“猫抓病”特朗普无法缴纳4.54亿美元罚金倪萍分享减重40斤方法联合利华开始重组张家界的山上“长”满了韩国人?张立群任西安交通大学校长杨倩无缘巴黎奥运“重生之我在北大当嫡校长”黑马情侣提车了专访95后高颜值猪保姆考生莫言也上北大硕士复试名单了网友洛杉矶偶遇贾玲专家建议不必谈骨泥色变沉迷短剧的人就像掉进了杀猪盘奥巴马现身唐宁街 黑色着装引猜测七年后宇文玥被薅头发捞上岸事业单位女子向同事水杯投不明物质凯特王妃现身!外出购物视频曝光河南驻马店通报西平中学跳楼事件王树国卸任西安交大校长 师生送别恒大被罚41.75亿到底怎么缴男子被流浪猫绊倒 投喂者赔24万房客欠租失踪 房东直发愁西双版纳热带植物园回应蜉蝣大爆发钱人豪晒法院裁定实锤抄袭外国人感慨凌晨的中国很安全胖东来员工每周单休无小长假白宫:哈马斯三号人物被杀测试车高速逃费 小米:已补缴老人退休金被冒领16年 金额超20万

玻璃钢生产厂家 XML地图 TXT地图 虚拟主机 SEO 网站制作 网站优化