function [ n_data, n, gpf ] = i4_gpf_values ( n_data )

%*****************************************************************************80
%
%% i4_gpf_values() returns values of the greatest prime factor function.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    16 November 2022
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N_DATA.  The user sets N_DATA to 0 before the
%    first 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 positive integer.
%
%    integer GPF, the greatest prime factor of N.
%
  n_max = 86;

  n_vec = [ ...
     1,  2,  3,  4,  5,  6,  7,  8,  9, 10, ...
    11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...
    21, 22, 23, 24, 25, 26, 27, 28, 29, 30, ...
    31, 32, 33, 34, 35, 36, 37, 38, 39, 40, ...
    41, 42, 43, 44, 45, 46, 47, 48, 49, 50, ...
    51, 52, 53, 54, 55, 56, 57, 58, 59, 60, ...
    61, 62, 63, 64, 65, 66, 67, 68, 69, 70, ...
    71, 72, 73, 74, 75, 76, 77, 78, 79, 80, ...
    81, 82, 83, 84, 85, 86 ];

  gpf_vec = [ ...
     1,  2,  3,  2,  5,  3,  7,  2,  3,  5, ... 
    11,  3, 13,  7,  5,  2, 17,  3, 19,  5, ...
     7, 11, 23,  3,  5, 13,  3,  7, 29,  5, ...
    31,  2, 11, 17,  7,  3, 37, 19, 13,  5, ...
    41,  7, 43, 11,  5, 23, 47,  3,  7,  5, ...
    17, 13, 53,  3, 11,  7, 19, 29, 59,  5, ...
    61, 31,  7,  2, 13, 11, 67, 17, 23,  7, ...
    71,  3, 73, 37,  5, 19, 11, 13, 79,  5, ...
     3, 41, 83,  7, 17, 43 ];

  if ( n_data < 0 )
    n_data = 0;
  end

  n_data = n_data + 1;

  if ( n_max < n_data )
    n_data = 0;
    n = 0;
    gpf = 0;
  else
    n = n_vec(n_data);
    gpf = gpf_vec(n_data);
  end

  return
end
