Tool for calculating the values of the harmonic numbers, ie the values of the nth partial sums of the harmonic series as well as their inverse. 1 + 1/2 + 1/3 + … + 1/n

Harmonic Number - dCode

Tag(s) : Series

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!

A suggestion ? a feedback ? a bug ? an idea ? *Write to dCode*!

Harmonic numbers are real numbers present in the harmonic series $ H_n $ (which uses the sum of the inverse of non-zero natural integers).

Apply the harmonic formula $$ H_n = \sum_{k=1}^n \frac{1}{k} = 1 + \frac{1}{2} + \frac{1}{3} + \cdots + \frac{1}{n} $$

__Example:__ $ H_2 = 1+\frac{1}{2} = \frac{3}{2} = 1.5 $

The following recurrence formula can also be applied to get a series:

$$ H_n = H_{n-1} + \frac{1}{n} $$

When $ n $ is very big, an approximation based on the natural logarithm can be useful to speed up the calculations:

$$ \lim_{n \to \infty} H_n = \ln n + \gamma $$

with $ \gamma \approx 0.577215665 $ the Euler–Mascheroni constant.

There is also a formula based on a integrate calculation: $$ H_n = \int_0^1 \frac{1 - x^n}{1 - x}\,dx $$

The first harmonic numbers are:

n | H(n) | ≈H(n) |
---|---|---|

1st harmonic number | 1/1 | 1 |

2nd harmonic number | 3/2 | 1.5 |

3rd harmonic number | 11/6 | 1.83333 |

4th harmonic number | 25/12 | 2.08333 |

5th harmonic number | 137/60 | 2.28333 |

6th harmonic number | 49/20 | 2.45 |

7th harmonic number | 363/140 | 2.59286 |

8th harmonic number | 761/280 | 2.71786 |

9th harmonic number | 7129/2520 | 2.82896 |

10th harmonic number | 2.92897 | |

100th harmonic number | 5.18738 | |

1000th harmonic number | 7.48547 | |

10000th harmonic number | 9.78761 | |

100000th harmonic number | 12.09015 | |

1000000th harmonic number | 14.39272 | |

10000000th harmonic number | 16.69531 | |

100000000th harmonic number | 18.99790 | |

1000000000th harmonic number | 21.30048 |

No, the harmonic series is an example of a divergent series, the sum of the terms of the series has no finite limit and tends towards infinity.

The Harmonic series with $ n \to \infty $ is a special case of the Riemann Zeta function ζ(s), when $ s = 1 $.

The algorithm for calculating harmonic numbers can use a summation loop `// Pseudo-code`

function harmonicNumber(N) {

harmonic = 0

for (i = 1; i <= N; i++) {

harmonic = harmonic + 1 / i

}

return harmonic

}

dCode retains ownership of the "Harmonic Number" source code. Except explicit open source licence (indicated Creative Commons / free), the "Harmonic Number" algorithm, the applet or snippet (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or the "Harmonic Number" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) and all data download, script, or API access for "Harmonic Number" are not public, same for offline use on PC, mobile, tablet, iPhone or Android app!

Reminder : dCode is free to use.

The copy-paste of the page "Harmonic Number" or any of its results, is allowed (even for commercial purposes) as long as you credit dCode!

Exporting results as a .csv or .txt file is free by clicking on the *export* icon

Cite as source (bibliography):

*Harmonic Number* on dCode.fr [online website], retrieved on 2024-09-09,

- Nth Harmonic Number Calculator
- Reciprocal Harmonic Value
- What is a harmonic number? (Definition)
- How to calculate a harmonic number?
- What are the first values of the Harmonic Series?
- Is the Harmonic Series convergent?
- What is the relationship between harmonic numbers and the Riemann Zeta function?
- How to implement the Harmonic series?

series,harmonic,number,inverse,summation,euler,mascheroni,gamma,zeta

https://www.dcode.fr/harmonic-number

© 2024 dCode — El 'kit de herramientas' definitivo para resolver todos los juegos/acertijos/geocaching/CTF.

Feedback