function value = prime_pi2 ( n )

%*****************************************************************************80
%
%% prime_pi2() evaluates prime(n), the number of primes less than or equal to n.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    31 December 2022
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer n: the value to be tested.
%
%  Output:
%
%    integer value: the value of pi(n).
%
  value = 0;

  if ( n ~= round ( n ) )
    error ( 'prime_pi2(): input n is not an integer!' )
  end

  for i = 1 : n
    value = value + isprime ( i );
  end

  return
end

