Douglas Hofstadter discovered that the 8th harmonic number equals e.
OK, not really. The following equation cannot possibly be true because the left side is rational and the right side is irrational.
However, Hofstadter showed that the equation does hold if you carry all calculations out to three decimal places.
1.000 0.500 0.333 0.250 0.200 0.167 0.143 0.125 ----- 2.718
The following Python code gets the same result using four-place decimal arithmetic.
Here’s Python code to verify it.
>>> from decimal import * >>> getcontext().prec = 4 >>> sum(Decimal(1)/Decimal(k) for k in range(1, 9)) Decimal('2.718')
One thought on “Harmonic e”
The sum of the LHS fractions is 2 + 201/280.
If you look at the first eight terms of the continued fraction expansion of
e = [2; 1, 2, 1, 1, 4, 1, 1]
you get 2 + 51/71 = 2 + 204/284.
Because 201/280 and 204/284 are very close, the LHS sum is close to the eight-term continued fraction approximation.
Of course, the continued fraction is the better approximation to e.