Harmonic numbers and such
Finding near integer approximations
If 0 < m < n, the sum of the reciprocals of the numbers m through n cannot be an integer. But it can come close to being an integer if m and n are large enough. I explore this in this post.
The most interesting part of the post, in my opinion, is the algorithm used to explore the sums. It’s more efficient than the most obvious algorithm in a couple ways.
Harmonic numbers are a special case of the sums above, with m = 1. When n > 1, the nth harmonic number cannot be an integer. But as before, it can be close to an integer.
So given a target integer m, how do you find n so that the nth harmonic number is the closest one to m? I give an algorithm in this post.
Hope you find these posts fun to read. Have a good evening.

