function collatz_test05 ( )

%*****************************************************************************80
%
%% collatz_test05() plots the Collatz max for starting values 1 to 100.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    10 March 2017
%
%  Author:
%
%    John Burkardt
%
  n = 100;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'collatz_test05():\n' );
  fprintf ( 1, '  Plot the Collatz max for starting values 1 to %d.\n', n );

  m = zeros ( 1, n );

  for key = 1 : n
    m(key) = collatz_max ( key );
  end

  data = [ (1:n)', m' ];

  filename = 'collatz_max.txt';
  save ( filename, 'data', '-ASCII' );
  fprintf ( 1, '  Data saved as "%s".\n', filename );

  bar ( 1:n, m ); 
% plot ( m, 'Linewidth', 2 )
  grid ( 'on' );
  xlabel ( 'Sequence Start' );
  ylabel ( 'Maximum Sequence Value' );
  title ( sprintf ( 'Maximum value in sequence, for starting values 1 to %d', n ) );
  filename = 'collatz_max.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s".\n', filename );

  return
end
