Abundant, deficient and perfect number classifications: Difference between revisions

Content added Content deleted
m (→‎{{header|PicoLisp}}: add comment)
Line 877: Line 877:
Key )
Key )
(de factor-sum (N)
(de factor-sum (N)
(let
(if (=1 N)
(R NIL
0
D 2
(let
L (1 2 2 . (4 2 4 2 4 6 2 6 .))
(R NIL
M (sqrt N)
D 2
N1 N
L (1 2 2 . (4 2 4 2 4 6 2 6 .))
S 1 )
M (sqrt N)
(while (>= M D)
N1 N
(if (=0 (% N1 D))
S 1 )
(setq M
(while (>= M D)
(sqrt (setq N1 (/ N1 (accud 'R D)))) )
(if (=0 (% N1 D))
(inc 'D (pop 'L)) ) )
(setq M
(accud 'R N1)
(sqrt (setq N1 (/ N1 (accud 'R D)))) )
(if # my dirty hack against N = 1
(inc 'D (pop 'L)) ) )
(and
(accud 'R N1)
(not (cdr R))
(= 1 (caar R)) )
0
(for I R
(for I R
(one D)
(one D)