february as 12 integer part of x rounded down

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: date falls, using the Julian calendar. The formula (as given in http://en.wikipedia.org/wiki/Determination_of_the_day_of_the_week) is Assuming that YR = year ­1, for month = 1 (January) or 2 (February), and YR = year, for all other months, 1 CS 116 Fall 2012 Assignment 05 Due at 4:00 pm on Monday, October 22nd y = last 2 digits of YR, c = first 2 digits of YR, d = day (between 1 and the number of days in the month), m = shifted month (renumber March as 1, April as 2, ..., February as 12), ! =integer part of x (rounded down). Complete the Python function day_of_the_week, that consumes three positive integers, year, month (1=January, 2=February, etc.), day (between 1 and 31, depending on the month), corresponding to a valid date, and produces a string (one of "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"). For example, day_of_the_week(2012,9,30) => "Sunday". You may find the function math.floor useful. (Note that the Gaussian formula only applies after a certain date in the Julian calendar. For simplicity purposes, assume it can be used for any year > 0.) 3. The Collatz conjecture proposes that, if we start with any positive integer c0, and generate cj+1 as follows: !! !" !! !"!"!# !!!! =  2  3!! + 1!" ...
View Full Document

This document was uploaded on 01/19/2014.

Ask a homework question - tutors are online