Continuing my series of basic concepts with middle school math will be tricky when we’re doing a Sunday Function. But let’s give it a shot, and see if we can keep it to that beginning level.

This function is pretty simple. You add reciprocals until you get reach whatever number n you’ve picked, then you stop. Formally the function has a name – the harmonic series. As you pick bigger and bigger n, the sum will be bigger and bigger. There’s no limit to how big it will get, but clearly its growth will be pretty slow. If you want f(n) = 100, n is going to have to be pretty stinking huge.

How huge? Well, let me digress for a moment to explain logarithms. Let’s say you have a statement like this one 2 * 2 * 2 * 2 = 16. You have to multiply 2 by itself 4 times to get 16. A logarithm is just how many times you have to multiply your chosen number (called a *base*) by itself to get the result. The base 2 logarithm of 16 is 4. The base 3 logarithm of 243 is 5, because 3 * 3 * 3 * 3 * 3 = 243. Don’t worry about calculating these by hand, any decent handheld calculator can do them for you.

Now imagine that instead of 2 or 3 as your base, you use a number called *e*. That number happens to be about 2.71828, though like pi the digits go on forever in an irregular pattern. Why that number? It’s a long story, which you’ll start catching pieces of in high school. But the story won’t really make all that much sense until calculus. The base e logarithm of a n is often denoted ln(n).

So accepting that little bit of weirdness, here’s an unusual truth:

The approximately equals sign means that the larger n is, the better the approximation will be. So if you want to add all the reciprocals of the numbers between 1 and 1000, you don’t have to actually perform every addition. You can find the logarithm of 1000 (how many times you have to multiply e by itself to get 1000) and add that correction factor. The result will be approximately f(100). The correction factor, by the way, is the Euler-Mascheroni constant. Proving this handy approximation is not difficult, but it too requires calculus so I’ll save it for a future installment.

What do the numbers turn out to be for adding all the reciprocals up to 1/1000 , by the way? Here’s what I get.

The actual answer: 7.48547

Our approximation: 7.48497

Not bad.

It’s a little beyond our scope here to do the algebra to invert and find n given f(n). But it can be done using elementary high school algebra, and for instance if you want to add enough numbers to get f(n) = 100, n will have to be about 1.5 x 10^{43}. Which I think you’d find to be an intractable problem of addition if you didn’t know the shortcut we’ve done today.