function perm1_cycle_max_test ( )

%*****************************************************************************80
%
%% perm1_cycle_max_test() tests perm1_cycle_max().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    13 November 2022
%
%  Author:
%
%    John Burkardt
%
  n = 9;
  p1 = [ 2, 3, 9, 6, 7, 8, 5, 4, 1 ];

  fprintf ( 1, '\n' );
  fprintf ( 1, 'perm1_cycle_max_test():\n' );
  fprintf ( 1, '  perm1_cycle_max() finds the length of a longest cycle\n' );
  fprintf ( 1, '  in a permutation of 1 through N.\n' );

  perm1_print ( n, p1, '  The standard index form permutation:' );
 
  p2 = perm1_index_to_cycle ( n, p1 );

  perm1_print ( n, p2, '  The permutation in cycle form:' );

  cycle_max = perm1_cycle_max ( p1 );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  The longest cycle length is %d\n', cycle_max );
 
  return
end
