Skip to content

problem_15 done in R #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions R/15.Lattice_paths/servindc.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Solution to Euler problem 15
Lattice_paths <- function(n){
n <- as.integer(n)
p <- 0
for (i in 0:n){
p <- p + (factorial(n)/(factorial(n-i)*factorial(i)))^2
}
print(p)
}
cat("Routes through a 20x20 grid: ", Lattice_paths(20))
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,16 @@ Happy Contributing! 😃
| 08 | [Largest product in a series](https://projecteuler.net/problem=8) | | | | :white_check_mark: | | | | | | | | |
| 09 | [Special Pythagorean triplet](https://projecteuler.net/problem=9) | :white_check_mark: | | | :white_check_mark: | | | | | | | | |
| 10 | [Summation of primes](https://projecteuler.net/problem=10) | | | | :white_check_mark: | | | :white_check_mark: | | | | | |
| 11 | [Largest product in a grid](https://projecteuler.net/problem=11) | | | | :white_check_mark: | | | :white_check_mark: | | | | | |
| 11 | [Largest product in a grid](https://projecteuler.net/problem=11) | | | | :white_check_mark: | | | :white_check_mark: | | | | | |
| 12 | [Highly divisible triangular number](https://projecteuler.net/problem=12) | | | | | | | :white_check_mark: | | | | | |
| 13 | [Large sum](https://projecteuler.net/problem=13) | :white_check_mark: | | | :white_check_mark: | | | | | | | | |
| 14 | [Longest Collatz sequence](https://projecteuler.net/problem=14) | | | | | | | | | | | | |
| 15 | [Lattice paths](https://projecteuler.net/problem=15) | | | | | | | | | | | | |
| 16 | [Power digit sum](https://projecteuler.net/problem=16) | | :white_check_mark:| | :white_check_mark: | | | | | | | | |
| 17 | [Number letter counts](https://projecteuler.net/problem=17) | | | |:white_check_mark: | | | | | | | | |
| 15 | [Lattice paths](https://projecteuler.net/problem=15) | | | | :white_check_mark: | | | | | | | | |
| 16 | [Power digit sum](https://projecteuler.net/problem=16) | | :white_check_mark: | | :white_check_mark: | | | | | | | | |
| 17 | [Number letter counts](https://projecteuler.net/problem=17) | | | | | | | | | | | | |
| 15 | [Lattice paths](https://projecteuler.net/problem=15) | | | | | | | | | | :white_check_mark: | | |
| 16 | [Power digit sum](https://projecteuler.net/problem=16) | | :white_check_mark: | | :white_check_mark: | | | | | | | | |
| 17 | [Number letter counts](https://projecteuler.net/problem=17) | | | | :white_check_mark: | | | | | | | | |
| 18 | [Maximum path sum I](https://projecteuler.net/problem=18) | | | | | | | | | | | | |
| 19 | [Counting Sundays](https://projecteuler.net/problem=19) | | | | | | | | | | | | |
| 20 | [Factorial digit sum](https://projecteuler.net/problem=20) | | | | :white_check_mark: | | | | | | | | |
Expand Down