function collatz_test03 ( )

%*****************************************************************************80
%
%% collatz_test03() tests collatz_write().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    25 February 2006
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'collatz_test03():\n' );
  fprintf ( 1, '  collatz_write() writes a Collatz sequence to a file.\n' );

  file_name = 'collatz_27.txt';
  key = 27;
  s = collatz ( key );
  n = length ( s );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Write the Collatz sequence with key %d to "%s".\n', key, file_name );

  collatz_write ( n, s, file_name );
  
  file_name = 'collatz_count.txt';
  
  n = 100;
  for key = 1 : n
    c(key) = collatz_count ( key );
  end
  
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Write the Collatz count sequence from 1 to %d to "%s".\n', n, file_name );

  collatz_write ( n, c, file_name );

  return
end
