fix issue where calculating 0! never terminates
This commit is contained in:
parent
f11fdc77fc
commit
4acecad41a
1 changed files with 2 additions and 0 deletions
|
@ -13,6 +13,8 @@ defmodule Euler.Algebra do
|
|||
@doc """
|
||||
Computes n!
|
||||
"""
|
||||
def fact(0), do: 1
|
||||
def fact(1), do: 1
|
||||
def fact(n), do: fact(n - 1, n)
|
||||
|
||||
defp digit_sum(0, acc), do: acc
|
||||
|
|
Loading…
Add table
Reference in a new issue