Proper divisors: Difference between revisions

m
(→‎{{header|Java}}: Change for the special case of n = 1)
Line 32:
 
=={{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.
Line 39 ⟶ 38:
 
<lang J>factors=: [: /:~@, */&>@{@((^ i.@>:)&.>/)@q:~&__
properDivisors=: factors -. -.&1:</lang>
 
Proper divisors of numbers 1 through 10:
 
<lang J> (,&": ' -- ' ,&": properDivisors)&>1+i.10
1 -- 1
2 -- 1
3 -- 1
6,962

edits