Count in factors: Difference between revisions

Explicitly including the factor function
(→‎{{header|Perl 6}}: Added comments for function groupings.)
(Explicitly including the factor function)
Line 123:
 
=={{header|PicoLisp}}==
UseThis is the 'factor' function from [[Prime decomposition#PicoLisp]].
<lang PicoLisp>(forde Nfactor 20(N)
(make
(let (D 2 L (1 2 2 . (4 2 4 2 4 6 2 6 .)) M (sqrt N))
(while (>= M D)
(ifn (=0 (% N D))
(inc 'D (pop 'L))
(link D)
(setq M (sqrt (setq N (/ N D)))) ) )
(or (= 1 N) (link N)) ) ) )
 
(for N 20
(prinl N ": " (or (glue " * " (factor N)) 1)) )</lang>
Output:
Anonymous user