function pell_basic_test ( )

%*****************************************************************************80
%
%% pell_basic_test() tests pell_basic().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'pell_basic_test():\n' );
  fprintf ( 1, '  pell_basic() solves the basic Pell equation.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '       D       X        Y         R\n' );
  fprintf ( 1, '\n' );

  for d = 2 : 20

    [ q, r ] = i4_sqrt ( d );

    if ( r ~= 0 )

      [ x0, y0 ] = pell_basic ( d );

      r = x0^2 - d * y0^2;

      fprintf ( 1, '  %7d  %7d  %7d  %7d\n', d, x0, y0, r );

    end

  end

  return
end
