Proper divisors: Difference between revisions
m
→{{header|J}}
(→{{header|Java}}: Change for the special case of n = 1) |
m (→{{header|J}}) |
||
Line 32:
=={{header|J}}==
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 -.
Proper divisors of numbers 1 through 10:
<lang J> (,&": ' -- ' ,&": properDivisors)&>1+i.10
1 --
2 -- 1
3 -- 1
|