function fermat_factor_test ( )

%*****************************************************************************80
%
%% fermat_factor_test() tests fermat_factor().
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    09 April 2025
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../fermat_factor' );

  timestamp ( );

  fprintf ( 1, '\n' );
  fprintf ( 1, 'fermat_factor_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version: %s\n', version ( ) );
  fprintf ( 1, '  fermat_factor() factors an integer using the Fermat method.\n' );

  for n = [ 39, 25951, 2025090001, 2027651281 ]

    [ f1, f2 ] = fermat_factor ( n );

    fprintf ( 1, '\n' );
    fprintf ( 1, '  Seeking factors of n = %d\n', n );
    fprintf ( 1, '  %d * %d = %d\n', f1, f2, f1 * f2 );

  end
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'fermat_factor_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  timestamp ( );

  rmpath ( '../fermat_factor' );

  return
end
function timestamp ( )

%*****************************************************************************80
%
%% timestamp() prints the YMDHMS date as a timestamp.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 November 2022
%
%  Author:
%
%    John Burkardt
%
  t = now ( );
  c = datevec ( t );
  s = datestr ( c, 0 );
  fprintf ( 1, '%s\n', s );

  return
end

