function isp = isprime(X)
%ISPRIME True for prime numbers.
%   ISPRIME(X) is 1 for the elements of X which are prime, 0 otherwise.
%
%   See also FACTOR, PRIMES.

%   Copyright (c) 1984-98 by The MathWorks, Inc.
%   $Revision: 1.8 $  $Date: 1997/11/21 23:45:40 $

if isempty(X), isp = logical(zeros(size(X))); return, end

isp = logical(X);
n = max(X(:));
p = primes(n);
for k = 1:prod(size(isp))
   isp(k) = any(X(k) == p);
end
