Proper divisors: Difference between revisions
Content added Content deleted
(Add ref.) |
(1 has no proper divisors.) |
||
Line 3: | Line 3: | ||
For example the proper divisors of 6 are 1, 2, and 3. The proper divisors of 100 are 1, 2, 4, 5, 10, 20, 25, and 50. |
For example the proper divisors of 6 are 1, 2, and 3. The proper divisors of 100 are 1, 2, 4, 5, 10, 20, 25, and 50. |
||
'''Note''' that 1 has no proper divisors. |
|||
;Task: |
;Task: |
||
Line 15: | Line 17: | ||
=={{header|D}}== |
=={{header|D}}== |
||
{{incorrect|D|1 has no proper divisors.}} |
|||
{{trans|Python}} |
{{trans|Python}} |
||
Currently the lambda of the filter allocates a closure on the GC-managed heap. |
Currently the lambda of the filter allocates a closure on the GC-managed heap. |
||
Line 32: | Line 35: | ||
=={{header|J}}== |
=={{header|J}}== |
||
{{incorrect|J|1 has no proper divisors.}} |
|||
The proper divisors of an integer are the [[Factors of an integer]] without the integer itself. |
The proper divisors of an integer are the [[Factors of an integer]] without the integer itself. |
||
Line 69: | Line 73: | ||
=={{header|Java}}== |
=={{header|Java}}== |
||
{{incorrect|Java|1 has no proper divisors.}} |
|||
{{works with|Java|1.5+}} |
{{works with|Java|1.5+}} |
||
<lang java5>import java.util.Collections; |
<lang java5>import java.util.Collections; |
||
Line 116: | Line 121: | ||
=={{header|Perl}}== |
=={{header|Perl}}== |
||
{{incorrect|Perl|1 has no proper divisors.}} |
|||
===Using a module for divisors=== |
===Using a module for divisors=== |
||
{{libheader|ntheory}} |
{{libheader|ntheory}} |
||
Line 160: | Line 166: | ||
=={{header|Python}}== |
=={{header|Python}}== |
||
{{incorrect|Python|1 has no proper divisors.}} |
|||
===Python: Literal=== |
===Python: Literal=== |
||
A very literal interpretation |
A very literal interpretation |