%divisors 
%   divisors(N) returns a vector containing 
%   the divisors of N.
%   See also PRIMES, ISPRIME, FACTOR
%   MB
function f = divisors2(n)
if prod(size(n))~=1, error('N must be a scalar.'); end
if (n < 0) | (floor(n) ~= n), error('N must be a positive integer.'); end
f=1; sqrtn=floor(sqrt(n));
if (n==1),  return; end
d=factor(n);  ld=length(d);
if ld==1,  f=[1 n]; return,  end
for  count=1:ld
	f1=f*d(count);
	f1(f1>sqrtn)='';
	f=unique([f f1]);
end
f1=n./f;
f1=fliplr(f1);
if  sqrtn^2==n,  f1(1)=[];  end
f=[f f1];
