Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
6
Task/Perfect-numbers/SASL/perfect-numbers.sasl
Normal file
6
Task/Perfect-numbers/SASL/perfect-numbers.sasl
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
|| The function which takes a number and returns a list of its factors (including one but excluding itself)
|
||||
|| can be written
|
||||
factors n = { a <- 1.. n/2; n rem a = 0 }
|
||||
|| If we define a perfect number as one which is equal to the sum of its factors (for example 6 = 3 + 2 + 1 is perfect)
|
||||
|| we can write the list of all perfect numbers as
|
||||
perfects = { n <- 1... ; n = sum(factors n) }
|
||||
Loading…
Add table
Add a link
Reference in a new issue