I was exploring Jupyter notebooks , that combines live code, markdown and data, through Microsoft's implementation, known as MS Azure Notebooks , putting together a small library of R and F# notebooks . As Microsoft's FAQ for the service describes it as : ...a multi-lingual REPL on steroids. This is a free service that provides Jupyter notebooks along with supporting packages for R, Python and F# as a service. This means you can just login and get going since no installation/setup is necessary. Typical usage includes schools/instruction, giving webinars, learning languages, sharing ideas, etc. Feel free to clone and comment... In R Azure Workbook for R - Memoisation and Vectorization Charting Correlation Matrices in R In F# Charnownes Constant in FSharp.ipynb Project Euler - Problems 18 and 67 - FSharp using Dynamic Programming
Description
Thanks to the following for providing the insight required to solve this, based on combinatronics:
http://realultimateprogramming.blogspot.com/2009/03/project-euler-problem-15.html
let rec factorialBI (n:bigint) (acc:bigint) =
if n <= 1I then
acc
else
let newAcc = n * acc
factorialBI (n-1I) newAcc
let combine (sides:bigint) =
let factorial1 = factorialBI (sides * 2I) 1I
let factorial2 = factorialBI sides 1I
factorial1/(factorial2 * factorial2)
let UT_combine_2 = combine 2I
let UT_combine_20 = combine 20I
- Starting in the top left corner of a 2×2 grid, there are 6 routes (without backtracking) to the bottom right corner.
- How many routes are there through a 20×20 grid?
Thanks to the following for providing the insight required to solve this, based on combinatronics:
http://realultimateprogramming.blogspot.com/2009/03/project-euler-problem-15.html
let rec factorialBI (n:bigint) (acc:bigint) =
if n <= 1I then
acc
else
let newAcc = n * acc
factorialBI (n-1I) newAcc
let combine (sides:bigint) =
let factorial1 = factorialBI (sides * 2I) 1I
let factorial2 = factorialBI sides 1I
factorial1/(factorial2 * factorial2)
let UT_combine_2 = combine 2I
let UT_combine_20 = combine 20I
Comments
Post a Comment