Skip to content

Instantly share code, notes, and snippets.

@kusold
Created April 4, 2012 02:00
Show Gist options
  • Save kusold/2297100 to your computer and use it in GitHub Desktop.
Save kusold/2297100 to your computer and use it in GitHub Desktop.
CSE 680 Homework 1
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