Abundant, deficient and perfect number classifications: Difference between revisions
Content added Content deleted
m (→{{header|PicoLisp}}: add comment) |
(→{{header|PicoLisp}}: simpler) |
||
Line 877: | Line 877: | ||
Key ) |
Key ) |
||
(de factor-sum (N) |
(de factor-sum (N) |
||
( |
(if (=1 N) |
||
0 |
|||
(let |
|||
(R NIL |
|||
D 2 |
|||
L (1 2 2 . (4 2 4 2 4 6 2 6 .)) |
|||
M (sqrt N) |
|||
N1 N |
|||
S 1 ) |
|||
(while (>= M D) |
|||
(if (=0 (% N1 D)) |
|||
(setq M |
|||
(accud 'R |
(sqrt (setq N1 (/ N1 (accud 'R D)))) ) |
||
(inc 'D (pop 'L)) ) ) |
|||
( |
(accud 'R N1) |
||
(not (cdr R)) |
|||
(= 1 (caar R)) ) |
|||
0 |
|||
(for I R |
(for I R |
||
(one D) |
(one D) |