function value = i4vec_gcd ( v )

%*****************************************************************************80
%
%% i4vec_gcd() returns the greatest common divisor of an I4VEC.
%
%  Discussion:
%
%    An I4VEC is a vector of I4's.
%
%    The value GCD returned has the property that it is the greatest integer
%    which evenly divides every entry of V.
%
%    The entries in V may be negative.
%
%    Any zero entries in V are ignored.  If all entries of V are zero,
%    GCD is returned as 1.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    07 April 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer V(:), the vector.
%
%  Output:
%
%    integer VALUE, the greatest common divisor of V.
%
  n = length ( v );

  value = abs ( v(1) );

  for i = 2 : n
    value = gcd ( value, v(i) );
  end

  return
end
