function value = is_prime1 ( n )

%*****************************************************************************80
%
%% is_prime1() reports whether an integer is prime.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    28 December 2022
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer n: the value to be tested.
%
%  Output:
%
%    logical value: true if n is a prime.
%
  if ( n ~= round ( n ) )
    error ( 'is_prime1(): input n is not an integer!' )
  end

  if ( n < 0 )
    value = false;
    return
  end

  if ( n == 0 || n == 1 )
    value = false;
    return
  end

  value = true;

  for i = 2 : n - 1
    if ( mod ( n, i ) == 0 )
      value = false;
      return
    end
  end

  return
end

