%mathpiper,def="ProperDivisors"

10 # ProperDivisors(_n) <--
[
        Check(IsPositiveInteger(n), "Argument", "ProperDivisors: argument must be positive integer");
	Divisors(n)-1;
];

%/mathpiper



%mathpiper_docs,name="ProperDivisors",categories="User Functions;Number Theory"
*CMD ProperDivisors --- the number of proper divisors
*STD
*CALL
	ProperDivisors(n)
*PARMS

{n}     -- positive integer

*DESC

{ProperDivisors} returns the number of proper divisors, i.e {Divisors(n)-1},
since {n} is not counted. 
An integer $n$ is prime if and only if it has 1 proper divisor.

*E.G.

In> ProperDivisors(180)
Result: 17;
In> ProperDivisors(37)
Result: 1;

*SEE DivisorsSum, ProperDivisors, ProperDivisorsSum, Moebius
%/mathpiper_docs