16 lines
421 B
Text
16 lines
421 B
Text
@(next :args)
|
|
@(do
|
|
(defun factor (n)
|
|
(if (> n 1)
|
|
(for ((max-d (isqrt n))
|
|
(d 2))
|
|
()
|
|
((inc d (if (evenp d) 1 2)))
|
|
(cond ((> d max-d) (return (list n)))
|
|
((zerop (mod n d))
|
|
(return (cons d (factor (trunc n d))))))))))
|
|
@{num /[0-9]+/}
|
|
@(bind factors @(factor (int-str num 10)))
|
|
@(output)
|
|
@num -> {@(rep)@factors, @(last)@factors@(end)}
|
|
@(end)
|