Count in factors: Difference between revisions

Added PicoLisp
(Draft task, initial example. I'm not a Perl 6 expert. The code can probably use some love.)
 
(Added PicoLisp)
Line 76:
19: 19
20: 2 x 2 x 5</pre>
 
=={{header|PicoLisp}}==
Use the 'factor' function from [[Prime decomposition#PicoLisp]].
<lang PicoLisp>(for N 20
(prinl N ": " (or (glue " * " (factor N)) 1)) )</lang>
Output:
<pre>1: 1
2: 2
3: 3
4: 2 * 2
5: 5
6: 2 * 3
7: 7
8: 2 * 2 * 2
9: 3 * 3
10: 2 * 5
11: 11
12: 2 * 2 * 3
13: 13
14: 2 * 7
15: 3 * 5
16: 2 * 2 * 2 * 2
17: 17
18: 2 * 3 * 3
19: 19
20: 2 * 2 * 5</pre>
Anonymous user