function [g] = eulergamma (n) % Compute Euler's gamma by 1 + 1/2 + 1/3 + ... + 1/n - log(n) h=0; %running sum for j=1:n h = h + 1/j; end g = h - log(n); end