Project Euler in F#: Problem 15

Starting in the top left corner of a 20×20 grid, how many routes are there (without backtracking) to the bottom right corner?

I’ve been trying to avoid solving these problems using math-oriented solutions, in order to get myself to actually do some programming and learn F#, but brute forcing this problem is so ridiculous that I couldn’t do it.

module Problem15 =
    let ans = ({21I .. 40I} |> Seq.reduce(*)) / ({1I .. 20I} |> Seq.reduce(*))
Advertisements
Project Euler in F#: Problem 15

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s