3
$\begingroup$

Hi. I have a feeling this is kinda a known thing, but I don't know it, so hopefully you can help me out. I'm a lowly software developer.

For a given n and k, is there a short-cut way of calculating (or approximating) the value of this expression?

$\sum_{n}^{k}\frac{1}{n}$

It's a matter of computational efficiency: I have a lot of these expressions i want to calculate.

$\endgroup$
3
  • $\begingroup$ There are better places for getting an answer to questions such as yours; please see the faq. BTW you get crude estimates by replacing the sum with an integral. For better results, google for Euler and MacLaurin summation. $\endgroup$ May 17, 2011 at 10:49
  • 1
    $\begingroup$ math.stackexchange is likely the right forum for your question. As is it's a little vague and perhaps pretty basic -- how good an approximation do you want? $\sum_{n=1}^k \frac{1}{n}$ is between $\ln(k+1)$ and $\ln(k)+1$. $\endgroup$ May 17, 2011 at 10:54
  • 1
    $\begingroup$ If one really needs to compute them 'well' I am not sure this is so simple a question. $\endgroup$
    – user9072
    May 17, 2011 at 10:58

1 Answer 1

3
$\begingroup$

If you mean that the sum starts at 1 these are exactly the Harmonic numbers, see http://en.wikipedia.org/wiki/Harmonic_number

There are well-known asymptotic expansions (see the above mentioned page for a start, and below).

For actual computation, there is a nice blogpost on computing them by Fredrik Johansson: http://fredrik-j.blogspot.com/2009/02/how-not-to-compute-harmonic-numbers.html

$\endgroup$
1
  • $\begingroup$ Thanks everyone: I appreciate it. Investigating harmonic series/Euler summation I found a good article on exactly what I needed (I should have said the sum for n=1 to k). For future google travellers, turns out the approximation I need is ln(n)+.5772156649... (Euler's constant) via: jimloy.com/algebra/hseries.htm $\endgroup$ May 17, 2011 at 11:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.