The Euler-Masheroni Constant
Let $H_n$ be the sum of the first $n$ terms of the harmonic series $$ H_n=\sum_{k=1}^n {1\over k} $$
function H(n)
r=0
for k=1:n
r=r+1/k
end
return r
end
H(10)
A simple Calculus argument shows that $$ \ln(1+n)\le H_n\le 1+\ln n $$
The upper bound may be obtained as
while the lower as
The Euler-Mascheroni constant $\gamma$ is given by the limit $$ \gamma=\lim_{n\to\infty}(H-n-\ln n) \approx 0.5772 $$
for j=1:20
n=2^j
println("n=$n, gamma=",H(n)-log(n))
end