Handbook
Glossary
(sum-divisors) ( n -- sum )
Vocabulary
project-euler
.
common
.
private
Inputs
n
an
object
Outputs
sum
an
object
Definition
USING:
kernel
make
math
math.functions
project-euler.common
ranges
sequences
;
IN:
project-euler.common.private
:
(sum-divisors)
( n -- sum )
dup
sqrt
>integer
[1..b]
[
[
2dup
divisor?
[
2dup
/
+
,
]
[
drop
]
if
]
each
dup
perfect-square?
[
sqrt
>fixnum
neg
,
]
[
drop
]
if
]
{
}
make
sum
;