Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
|
|
@ -1,3 +1,8 @@
|
|||
def is_perfect(x) do
|
||||
[1 | lc x inlist :lists.seq(2, div(n, 2)), rem(n, x) == 0, do: x] |> :lists.sum() == n
|
||||
defmodule RC do
|
||||
def is_perfect(1), do: false
|
||||
def is_perfect(n) when n > 1 do
|
||||
(for i <- 1..div(n,2), rem(n,i)==0, do: i) |> Enum.sum == n
|
||||
end
|
||||
end
|
||||
|
||||
IO.inspect (for i <- 1..10000, RC.is_perfect(i), do: i)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue