-
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
8a476cd
commit b2f3199
Showing
9 changed files
with
139 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Lua Implementation of Problem 15 | ||
================================ | ||
|
||
View source code :source:`lua/src/p0015.lua` | ||
|
||
Includes | ||
-------- | ||
|
||
- `math <./lib/math.html>` | ||
|
||
Solution | ||
-------- | ||
|
||
.. lua:function:: solution() | ||
:return: The solution to problem 15 | ||
:rtype: number | ||
|
||
.. literalinclude:: ../../../lua/src/p0015.lua | ||
:language: Lua | ||
:linenos: | ||
|
||
.. tags:: large-numbers |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
-- Project Euler Problem 11 | ||
-- Project Euler Problem 13 | ||
-- | ||
-- Problem: | ||
-- | ||
|
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 @@ | ||
-- 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? | ||
|
||
local n_choose_r = loadlib("math").n_choose_r | ||
|
||
return { | ||
solution = function() | ||
return n_choose_r(40, 20) | ||
end | ||
} |
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