Proper divisors: Difference between revisions

→‎{{header|Java}}: Change for the special case of n = 1
(→‎{{header|Perl}}: Modified for 0,1)
(→‎{{header|Java}}: Change for the special case of n = 1)
Line 70:
 
=={{header|Java}}==
{{incorrect|Java|1 has no proper divisors.}}
{{works with|Java|1.5+}}
<lang java5>import java.util.Collections;
Line 79 ⟶ 78:
public static List<Integer> properDivs(int n){
List<Integer> divs = new LinkedList<Integer>();
if(n == 1) return divs;
divs.add(1);
for(int x = 2; x < n; x++){
Line 105:
}</lang>
{{out}}
<pre>1: [1]
2: [1]
3: [1]
Anonymous user