# Project Euler 15: (Iron)Python

Posted
by Ben Griswold
on Johnny Coder
See other posts from Johnny Coder
or by Ben Griswold

Published on Wed, 22 Sep 2010 20:22:43 +0000
Indexed on
2010/12/06
16:59 UTC

Read the original article
Hit count: 331

In my attempt to learn (Iron)Python out in the open, here’s my solution for Project Euler Problem 15.

As always, any feedback is welcome.

# Euler 15 # http://projecteuler.net/index.php?section=problems&id=15 # Starting in the top left corner of a 2x2 grid, there # are 6 routes (without backtracking) to the bottom right # corner. How many routes are their in a 20x20 grid? import time start = time.time() def factorial(n): if n == 0: return 1 else: return n * factorial(n-1) rows, cols = 20, 20 print factorial(rows+cols) / (factorial(rows) * factorial(cols)) print "Elapsed Time:", (time.time() - start) * 1000, "millisecs" a=raw_input('Press return to continue')

© Johnny Coder or respective owner