Solution to problem 15 in Julia

This commit is contained in:
David Doblas Jiménez 2021-07-25 12:09:48 +02:00
parent 48dae803d8
commit 9c0c031509

28
src/Julia/Problem015.jl Normal file
View File

@ -0,0 +1,28 @@
using Base: Integer
#=
Created on 25 Jul 2021
@author: David Doblas Jiménez
@email: daviddoji@pm.me
Solution for Problem 15 of Project Euler
https://projecteuler.net/problem=15
=#
function Problem15()
#=
Starting in the top left corner of a 2×2 grid, and only being able to
move to the right and down, there are exactly 6 routes to the bottom
right corner.
How many such routes are there through a 20×20 grid?
=#
n = 20
return Integer(factorial(big(2n)) / (factorial(big(n)) * factorial(big(2n - n))))
end
println("Time to evaluate Problem 15:")
@time Problem15()
println("")
println("Result for Problem 15: ", Problem15())