Created
April 4, 2012 02:00
-
-
Save kusold/2297100 to your computer and use it in GitHub Desktop.
CSE 680 Homework 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
def worthlessCalculator(n): | |
if n <= 3: | |
return 5 | |
output = (3 * worthlessCalculator(n-1) + 5 * worthlessCalculator(n-3) + 7 * worthlessCalculator(n-4) + 11) % 15490549 | |
return output | |
input = -1 | |
while input < 0: | |
input = int(raw_input("Please enter a value >= 0. ")) | |
start = time.time() | |
print("f(" + str(input) + ") = " + str(worthlessCalculator(input))) | |
executiontime = (time.time() - start) * 1000 | |
print "Elapsed Time:", (time.time() - start) * 1000, "millisecs" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment