Proper divisors: Difference between revisions

Line 255:
[15120,79]</lang>
 
=={{header|Mathematica}} / {{header|Wolfram Language}}==
Proper divisors of n from 1 to 10
<lang Mathematica>Join[{{1, {}}}, Table[{n, Most@Divisors@n}, {n, 2, 10}]] // Grid</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}</pre>
Five numbers <=20000 with the most proper divisors
<lang Mathematica>Join[{{n, count}}, {#, Length@Most@Divisors@#} & /@
Ordering[Table[Length@Most@Divisors[n], {n, 20000}], -5]] // Grid</lang>
{{out}}
<pre>n count
18720 71
18900 71
19800 71
15120 79
18480 79</pre>
=={{header|Perl}}==
===Using a module for divisors===
Anonymous user