function lf = mylogfactorial(m)
%MYLOGFACTORIAL - calculate logs of the first m factorials:
%                 log(1!), log(2!), ... log(m!), m >= 1
    lf = zeros(1, m);   % preallocate and intialize lf(1) = log(1!)
    for i = 2:m
        lf(i) = lf(i - 1) + log(i);
    end
end

