Count in factors: Difference between revisions

Content added Content deleted
(Allow 1 in result)
(Simplified)
Line 128: Line 128:
(let (D 2 L (1 2 2 . (4 2 4 2 4 6 2 6 .)) M (sqrt N))
(let (D 2 L (1 2 2 . (4 2 4 2 4 6 2 6 .)) M (sqrt N))
(while (>= M D)
(while (>= M D)
(ifn (=0 (% N D))
(if (=0 (% N D))
(inc 'D (pop 'L))
(setq M (sqrt (setq N (/ N (link D)))))
(link D)
(inc 'D (pop 'L)) ) )
(setq M (sqrt (setq N (/ N D)))) ) )
(link N) ) ) )
(link N) ) ) )