Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
16
Task/Amicable-pairs/REBOL/amicable-pairs.rebol
Normal file
16
Task/Amicable-pairs/REBOL/amicable-pairs.rebol
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
;- based on Lua code ;-)
|
||||
|
||||
sum-of-divisors: func[n /local sum][
|
||||
sum: 1
|
||||
; using `to-integer` for compatibility with Rebol2
|
||||
for d 2 (to-integer square-root n) 1 [
|
||||
if 0 = remainder n d [ sum: n / d + sum + d ]
|
||||
]
|
||||
sum
|
||||
]
|
||||
|
||||
for n 2 20000 1 [
|
||||
if n < m: sum-of-divisors n [
|
||||
if n = sum-of-divisors m [ print [n tab m] ]
|
||||
]
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue