function [ l, u ] = lehmer_lu ( n )

%*****************************************************************************80
%
%% lehmer_lu() returns the LU factors of the LEHMER matrix.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    28 October 2021
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Emrah Kilic, Pantelimon Stanica,
%    The Lehmer matrix and its recursive analogue,
%    Journal of Combinatorial Mathematics and Combinatorial Computing,
%    Volume 74, August 2010, pages 193-205.
%
%  Input:
%
%    integer N, the order of the matrix.
%
%  Output:
%
%    real L(N,N), U(N,N), the LU factors.
%
  l = zeros ( n, n );
  for j = 1 : n
    l(j,j) = 1.0;
    for i = j + 1 : n
      l(i,j) = j / i;
    end
  end

  u = zeros ( n, n );
  for j = 1 : n
    for i = 1 : j
      u(i,j) = ( 2 * i - 1 ) / ( i * j );
    end
  end

  return
end
