Skip to content

Instantly share code, notes, and snippets.

View jmonasterio's full-sized avatar

Jorge Monasterio jmonasterio

View GitHub Profile
@jmonasterio
jmonasterio / gist:1813867
Created February 13, 2012 05:14
Project Euler #81 - Shortest Path in F#
// Project Euler #81 - Shortest Path in F#
// Doesn't seem very functional, but my first shot at it.
// Using Dijkstra's algorithm from wikipedia.
let matrix =
File.ReadAllLines(@"Matrix.txt") |> Array.map( fun line -> line.Split(",".ToCharArray()) |> Array.map( Int32.Parse));
@jmonasterio
jmonasterio / Project Euler #80.fs
Created January 1, 2012 16:07
My solution to project Euler #80 in F#
// Project Euler #80.
let DECIMAL_DIGITS = 100;
// Return square root of x as a big rational, with digits of accuracy
let sr x digits =
let mutable mean = x/2N;
let limit = pown (10N/1N) digits;