-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ca9de7e
commit 0c5479a
Showing
9 changed files
with
151 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Fortran Implementation of Problem 15 | ||
==================================== | ||
|
||
View source code :source:`fortran/src/p0015.f90` | ||
|
||
Includes | ||
-------- | ||
|
||
- `math.f90 <./lib/math.html>`_ | ||
|
||
Problem Solution | ||
---------------- | ||
|
||
.. f:module:: Problem0015 | ||
.. f:function:: integer Problem0015/p0015() | ||
.. literalinclude:: ../../../fortran/src/p0015.f90 | ||
:language: Fortran | ||
:linenos: | ||
|
||
.. tags:: combinatorics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
! Project Euler Problem 15 | ||
! | ||
! Turns out this is easy, if you think sideways a bit | ||
! | ||
! You can only go down or right. If we say right=1, then you can only have 20 1s, since otherwise you go off the grid. | ||
! You also can't have fewer than 20 1s, since then you go off the grid the other way. This means you can look at it as a | ||
! bit string, and the number of 40-bit strings with 20 1s is 40c20. | ||
! | ||
! Problem: | ||
! | ||
! 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? | ||
|
||
module Problem0015 | ||
use constants | ||
use math | ||
implicit none | ||
contains | ||
integer(i18t) function p0015() result(answer) | ||
answer = n_choose_r(40, 20) | ||
end function p0015 | ||
end module Problem0015 |