function collatz_test01 ( )

%*****************************************************************************80
%
%% collatz_test01() tests collatz().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    25 February 2006
%
%  Author:
%
%    John Burkardt
%
  test_num = 5;
  key_test = [ 5, 6, 19, 27, 95 ];

  fprintf ( 1, '\n' );
  fprintf ( 1, 'collatz_test01():\n' );
  fprintf ( 1, '  collatz() computes the Collatz sequence for a given key.\n' );

  for test = 1 : test_num

    key = key_test(test);

    s = collatz ( key );
    n = length ( s );

    fprintf ( 1, '\n' );
    fprintf ( 1, '  key: %d\n', key );
    fprintf ( 1, '  Sequence length: %d\n', n );
    fprintf ( 1, '\n' );

    for i = 1 : 10 : n
      for j = i : min ( i + 9, n )
        fprintf ( 1, '  %8d', s(j) );
      end
      fprintf ( 1, '\n' );
    end

  end

  return
end
