summaryrefslogtreecommitdiffstats
path: root/015.lua
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2009-05-14 19:51:41 -0500
committerJesse Luehrs <doy@tozt.net>2009-05-14 19:51:41 -0500
commitc3ff98ee4aa79bcaa07c8a478e96539c2a512e73 (patch)
tree0b1a04ee7e5b05ec23dcfa274d4258f8acbcdf9d /015.lua
parent394121b98178246a0b1063e9104f8878cf2a17e5 (diff)
downloadprojecteuler-c3ff98ee4aa79bcaa07c8a478e96539c2a512e73.tar.gz
projecteuler-c3ff98ee4aa79bcaa07c8a478e96539c2a512e73.zip
rename files for better sorting
Diffstat (limited to '015.lua')
-rw-r--r--015.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/015.lua b/015.lua
new file mode 100644
index 0000000..8450302
--- /dev/null
+++ b/015.lua
@@ -0,0 +1,13 @@
+function combinations(n, r)
+ local numerator = 1
+ local denominator = 1
+ for i = n, n - r + 1, -1 do
+ numerator = numerator * i
+ end
+ for i = r, 1, -1 do
+ denominator = denominator * i
+ end
+ return numerator / denominator
+end
+
+print(combinations(40, 20))