function [ n_data, n, tf ] = is_prime_values ( n_data )

%*****************************************************************************80
%
%% is_prime_values() returns some values of the is_prime() function.
%
%  Discussion:
%
%    is_prime(n) is TRUE if n is a prime number.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    27 December 2022
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Stephen Wolfram,
%    The Mathematica Book,
%    Fourth Edition,
%    Wolfram Media / Cambridge University Press, 1999.
%
%  Input:
%
%    integer n_data:  The user sets N_DATA to 0 before the first call.  
%    Thereafter, it should simply be the value returned by the previous call.
%
%  Output:
%
%    integer n_data:  On each call, the routine increments N_DATA by 1, and
%    returns the corresponding data; when there is no more data, the
%    output value of N_DATA will be 0 again.
%
%    integer n: a value to be queried.
%
%    logical tf: true if n is a prime.
%
  n_max = 22;

  n_vec = [ ...
          1, ...
          2, ...
         12, ...
          3, ...
         91, ...
         53, ...
        437, ...
        311, ...
       1333, ...
        719, ...
      16483, ...
       7919, ...
     223609, ...
      81799, ...
     873599, ...
     800573, ...
    5693761, ...
    7559173, ...
   90166053, ...
   69600977, ...
    6110601, ...
  145253029 ];

  tf_vec = [ ...
            false, ...
            true, ...
            false, ...
            true, ...
            false, ...
            true, ...
            false, ...
            true, ...
            false, ...
            true, ...
            false, ...
            true, ...
            false, ...
            true, ...
            false, ...
            true, ...
            false, ...
            true, ...
            false, ...
            true, ...
            false, ...
            true ];

  if ( n_data < 0 )
    n_data = 0;
  end

  n_data = n_data + 1;

  if ( n_max < n_data )
    n_data = 0;
    n = 0;
    tf = false;
  else
    n = n_vec(n_data);
    tf = tf_vec(n_data);
  end

  return
end
