Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
1
Task/Perfect-numbers/Scala/perfect-numbers-1.scala
Normal file
1
Task/Perfect-numbers/Scala/perfect-numbers-1.scala
Normal file
|
|
@ -0,0 +1 @@
|
|||
def perfectInt(input: Int) = ((2 to sqrt(input).toInt).collect {case x if input % x == 0 => x + input / x}).sum == input - 1
|
||||
2
Task/Perfect-numbers/Scala/perfect-numbers-2.scala
Normal file
2
Task/Perfect-numbers/Scala/perfect-numbers-2.scala
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
def perfect(n: Int) =
|
||||
(for (x <- 2 to n/2 if n % x == 0) yield x).sum + 1 == n
|
||||
Loading…
Add table
Add a link
Reference in a new issue