Count in factors: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: added closing tags ---- }} ---- for the output section template.) |
(→{{header|Factor}}: edit whitespace, show all vocabs, style tweaks) |
||
Line 1,252: | Line 1,252: | ||
=={{header|Factor}}== |
=={{header|Factor}}== |
||
⚫ | |||
<lang factor> |
|||
sequences ; |
|||
⚫ | |||
IN: scratchpad "1: 1" print 2 20 [a,b] [ dup pprint ": " write factors [ number>string ] map " x " join print ] each |
|||
: .factors ( n -- ) |
|||
</lang> |
|||
dup pprint ": " write factors |
|||
[ " × " write ] [ pprint ] interleave nl ; |
|||
"1: 1" print 2 20 [a,b] [ .factors ] each</lang> |
|||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Line 1,261: | Line 1,265: | ||
2: 2 |
2: 2 |
||
3: 3 |
3: 3 |
||
4: 2 |
4: 2 × 2 |
||
5: 5 |
5: 5 |
||
6: 2 |
6: 2 × 3 |
||
7: 7 |
7: 7 |
||
8: 2 |
8: 2 × 2 × 2 |
||
9: 3 |
9: 3 × 3 |
||
10: 2 |
10: 2 × 5 |
||
11: 11 |
11: 11 |
||
12: 2 |
12: 2 × 2 × 3 |
||
13: 13 |
13: 13 |
||
14: 2 |
14: 2 × 7 |
||
15: 3 |
15: 3 × 5 |
||
16: 2 |
16: 2 × 2 × 2 × 2 |
||
17: 17 |
17: 17 |
||
18: 2 |
18: 2 × 3 × 3 |
||
19: 19 |
19: 19 |
||
20: 2 |
20: 2 × 2 × 5 |
||
</pre> |
</pre> |
||