# $\sum_{k=1}^{\infty }\left\lfloor\frac{5}{5^k}\right\rfloor$ giving wrong answer?

Bug introduced in 7.0 or earlier and fixed in 11.0.1

When I try to evaluate the following:

$$\sum_{k=1}^{\infty }\Bigg\lfloor\frac{5}{5^k}\Bigg\rfloor$$

using

Sum[Floor[5/5^k], {k, 1, ∞}]


Mathematica provides an answer of $0$ when it clearly should be $1$. Using any finite limit for the summation, however, provides the correct answer. Why does this happen?

• What is the code you are using to get your result? – Leucippus Dec 24 '15 at 3:27
• Interesting: stackoverflow.com/questions/8690884/… – smörkex Dec 24 '15 at 6:12
• Fascinating. Sum[Floor[5/5^k], {k, 0, \[Infinity]}] gives the expected 6, while Sum[Floor[5/5^k], {k, a, Infinity}] gives 0 for all larger a I've tested. – Patrick Stevens Dec 24 '15 at 12:51
• The reason why a finite limit gives a good result is that in that case Mathematica computes the result directly: calculate each term, sum them up. Using a symbolic limit also results in 0. I don't have any insight into why it misses the k == 1 case when doing it symbolically. Tagging as bug. – Szabolcs Dec 24 '15 at 13:16
• @Szabolcs, i.e. such finit limit Sum[Floor[5/5^k], {k, 1, 10^20}] gives 0. But Sum[Floor[5/5^k], {k, 0.99999999, Infinity}] gives 1. Definitely bug – garej Dec 24 '15 at 13:34

This bug has been fixed in the just released Mathematica 11.0.1.

Sum[Floor[5/5^k], {k, 1, Infinity}]

(* 1 *)


This is certainly a bug, but one the user is warned about. The help section on "Possible Issues" provides a couple of examples where Sum gives "an unexpected result" (read: a wrong one). It's always related to using some discrete function that cannot be evaluated symbolically, like PrimeQ or Plus@*IntegerDigits, and ends up oversimplified at the attempt. I strongly believe your case is no different because [5/5^k] is zero in all points inside [1,+∞), so perhaps Mathematica simplifies the summand to zero when trying to perform its symbolic methods. The remedy advised by the official help is to "prevent symbolic evaluation" by specifying a Method (none of the official list works, which should be a hint) or by making the sum finite.

• Good guess, and in fact it was my initial guess when I first saw this. But it turns out to be an actual bug insofar as there is explicit code to handle this type of problem, and it is going awry somewhere. – Daniel Lichtblau Mar 3 '16 at 23:34

## protected by J. M. will be back soon♦Apr 3 '17 at 16:45

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).