Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to find the following limit using Mathematica:


The problem is taken from here and is known to converge to $\displaystyle\frac{1}{e-1}$. However, using Limit in a straightforward manner returns unevaluated:

Limit[Sum[((k - 1)/n)^n, {k, 1, n}], n -> ∞]
(* Limit[Sum[((k - 1)/n)^n, {k, 1, n}], n -> ∞] *)

How can I explore this problem using Mathematica and obtain the limit?

share|improve this question
up vote 19 down vote accepted

Identifying the sum as ($N$ times) a Riemann sum should inspire us to look at the integral of the function $x^N$ for $0\le x \lt 1$, whose value is $1/(N+1)$, of which here are a few examples for $N=1,4,16,64$:

Plot[Evaluate@Table[x^n, {n, {1, 4, 16, 64}}], {x, 0, 1}, Filling -> Axis,  PlotStyle -> Thick]

Plots of x^n for n=1,4,16,64

Noticing that this area becomes more and more concentrated near $x \approx 1$, we should then suspect that virtually all of the sum's value is coming from the last few terms. Why not, then, use Mathematica to explore this?

Table[Limit[Sum[((k - 1)/n)^n, {k, n - i, n}], n -> \[Infinity]], {i, 0, 4}]


The pattern is clear. Mathematica will identify it:


$\frac{e^{-i} \left(e^i-1\right)}{e-1}$

That is, we can speculate from this evidence that

$$\lim_{n\to \infty } \, \sum_{k=n-i}^n\left(\frac{k-1}{n}\right)^n = \frac{e^{-i} \left(e^i-1\right)}{e-1}.$$

It looks good when we compare the sums to the limiting value of the right hand side, easily seen (or computed by Mathematica) to be $1/(e-1)\approx 0.581977$:

DiscretePlot[1/(E-1) - Sum[((k-1)/n)^n, {k, 1, n}], {n, 10, 1000, 20}, PlotStyle -> PointSize[0.015]]

Discrete plot of residuals

If we can mathematically justify taking the double limit--first with respect to $n$, then with respect to $i$--then we can conclude the right hand side converges to $1/(e-1)$. I leave that reasoning to the interested reader.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.