Proper divisors: Difference between revisions
Content added Content deleted
(Extended C implementation.) |
No edit summary |
||
Line 1,314: | Line 1,314: | ||
10 has 3 proper divisors: 1,2,5 |
10 has 3 proper divisors: 1,2,5 |
||
15120 has 79 proper divisors |
15120 has 79 proper divisors |
||
</pre> |
|||
=={{header|Factor}}== |
|||
<lang Factor> |
|||
USING: math.primes.factors math.ranges ; |
|||
10 [1,b] [ divisors but-last ] map [ 1 + pprint bl . ] each-index |
|||
20000 [1,b] [ divisors but-last length ] map dup supremum |
|||
swap dupd index 1 + pprint " with " write pprint " divisors." print |
|||
</lang> |
|||
{{out}} |
|||
<pre> |
|||
1 { } |
|||
2 { 1 } |
|||
3 { 1 } |
|||
4 { 1 2 } |
|||
5 { 1 } |
|||
6 { 1 2 3 } |
|||
7 { 1 } |
|||
8 { 1 2 4 } |
|||
9 { 1 3 } |
|||
10 { 1 2 5 } |
|||
15120 with 79 divisors. |
|||
</pre> |
</pre> |
||