%MATCOM% Dmode

function r=isp(x)
% isp(x) returns 1 if x is a prime
% Trial division is used.
%
% (c) Copyright Yaron Keren 1995-1996
%


r=0;

if (x/2)==ceil(x/2) & (x>2) | (x<0) | (x~=ceil(x))
  return;
end

q=ceil(sqrt(x));
for d=3:2:q
  t=x/d;
  if t==ceil(t)
    return
  end
end

r=1;
return
