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.4-43

Exercise 1.2.4-43

not stated yet in Lean solution written

RatingM23
MarkersM (mathematical)
KindK3, find a value: compute a number, a set or a closed form from the written solution
SectionSection 1.2.4 of Volume 1. Companion chapter: Integer functions and elementary number theory

The task

Evaluate ∑k=1n⌊k⌋\sum_{k=1}^n \lfloor \sqrt k \rfloor in closed form.

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 the summation by parts formula of Exercise 1.2.4-42 (a) with ak=⌊k⌋a_k = \lfloor \sqrt k \rfloor.

Hint 2

The difference ak+1−aka_{k+1} - a_k is 11 when k+1k + 1 is a perfect square and 00 otherwise.

Solution

Show the solution

Let m=⌊n⌋m = \lfloor \sqrt n \rfloor and ak=⌊k⌋a_k = \lfloor \sqrt k \rfloor. The value aka_k rises by 11 exactly when k+1k + 1 is a square j2j^2. Indeed k+1≤k+1\sqrt{k+1} \le \sqrt k + 1 shows that it rises by at most 11, and it rises when some square lies in (k,k+1](k, k+1].

For 1≤k≤n−11 \le k \le n - 1 the condition is k+1=j2≤nk + 1 = j^2 \le n with j≥2j \ge 2 (the value j=1j = 1 gives k=0k = 0). So 2≤j≤m2 \le j \le m, and ∑k=1n−1k(ak+1−ak)=∑j=2m(j2−1)=m(m+1)(2m+1)6−1−(m−1)=m(m+1)(2m+1)6−m.\sum_{k=1}^{n-1}k(a_{k+1} - a_k) = \sum_{j=2}^m (j^2 - 1) = \frac{m(m+1)(2m+1)}{6} - 1 - (m - 1) = \frac{m(m+1)(2m+1)}{6} - m. By Exercise 1.2.4-42 (a), ∑k=1n⌊k⌋=nm−m(m+1)(2m+1)6+m=(n+1)m−m(m+1)(2m+1)6,m=⌊n⌋.\sum_{k=1}^n \lfloor \sqrt k \rfloor = nm - \frac{m(m+1)(2m+1)}{6} + m = (n+1)m - \frac{m(m+1)(2m+1)}{6}, \qquad m = \lfloor \sqrt n \rfloor.

Check

For n=10n = 10: m=3m = 3 and the terms are 1,1,1,2,2,2,2,2,3,31, 1, 1, 2, 2, 2, 2, 2, 3, 3 with sum 1919. The formula gives 11⋅3−3⋅4⋅7/6=33−14=1911 \cdot 3 - 3 \cdot 4 \cdot 7/6 = 33 - 14 = 19. For n=3n = 3: m=1m = 1, formula 4−1=34 - 1 = 3. A run over 1≤n<3001 \le n < 300 confirms the formula.

Remarks

For n=m2n = m^2 the formula becomes m(4m2−3m+5)/6m(4m^2 - 3m + 5)/6: for m=3m = 3 this is 1616, the sum for n=9n = 9. The leading term is 23n3/2\tfrac23 n^{3/2}, as the integral of x\sqrt x suggests.

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

In Lean

not stated yet The exercise is not stated in Lean yet.

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

Something is wrong? Report it.