taocp

This site has no text of the book. Keep your own copy of TAOCP next to it. See what is checked.

Exercise · Volume 1 · 1.2.7-5

Exercise 1.2.7-5

proved in Lean solution written

Rating15
KindK3, find a value: compute a number, a set or a closed form from the written solution
SectionSection 1.2.7 of Volume 1. Companion chapter: Harmonic numbers

The task

Find H10000H_{10000} to 15 decimal places, using eq. (3) and the values of γ\gamma and ln⁡10\ln 10.

The exact wording is in your copy of the book.

Hints

Open one hint at a time. Try the exercise again after each.

Hint 1

Use eq. (3) with n=10000n = 10000. Decide how many terms of the series are large enough to matter at the 15th place.

Hint 2

Get ln⁡10000=4ln⁡10\ln 10000 = 4\ln 10 from the tables.

Solution

Show the solution

Take n=104n = 10^4 in eq. (3). The terms are

ln⁡n=4ln⁡10=9.210340371976183,γ=0.577215664901533,\ln n = 4\ln 10 = 9.210340371976183, \qquad \gamma = 0.577215664901533,

12n=0.00005,112n2=8.33333333333×10−10,1120n4=8.3×10−19.\frac{1}{2n} = 0.00005, \qquad \frac{1}{12n^2} = 8.33333333333\times 10^{-10}, \qquad \frac{1}{120n^4} = 8.3\times 10^{-19}.

The last term, and the error ϵ<1252n6<10−26\epsilon < \frac{1}{252n^6} < 10^{-26}, are less than 10−1810^{-18}. They matter only if the sum lies within 10−1810^{-18} of a rounding boundary, so compute with 1818 digits: ln⁡10000=9.210340371976182736\ln 10000 = 9.210340371976182736 and γ=0.577215664901532861\gamma = 0.577215664901532861. The sum of these two is 9.7875560368777155979.787556036877715597. Adding 12n=0.00005\frac{1}{2n} = 0.00005 gives 9.7876060368777155979.787606036877715597. Subtracting 112n2=0.000000000833333333\frac{1}{12n^2} = 0.000000000833333333 gives 9.7876060360443822649.787606036044382264. The next term adds less than 10−1810^{-18} and does not change these digits. The result is 9.7876060360443829.787606036044382 to 15 places, and the next digits are 2626, far from a rounding boundary.

Check

An exact computation with python, summing 1/k1/k for k≤10000k \le 10000 with 4040 digits, gives H10000=9.787606036044382264178…H_{10000} = 9.787606036044382264178\ldots. This agrees with the value above to all the digits shown there.

Remarks

The rounded value is 9.7876060360443829.787606036044382. The terms of eq. (3) beyond 112n2\frac{1}{12n^2} give the last digits only, so they are needed only for more than 1818 places.

This solution is checked, and a person has not reviewed it yet. The source.

In Lean

proved The statement and its proof are in Lean. The kernel accepts the proof, and it uses the standard axioms only.

The status is computed from the Lean build. The node of the map.

Something is wrong? Report it.