Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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 tried to calculate the following limit $$\lim_{n\to\infty}n\sin(2\pi en!)$$ Mathematica gets

In[1]:= Limit[n*Sin[2 Pi*n!*Exp[1]], {n -> Infinity}]

Out[1]= {Interval[{-\[Infinity], \[Infinity]}]

But by the following link the answer is $2\pi$. I'm confused.

I think the limit is zero.

ListPlot[Table[n Sin[2 Pi E Factorial[n]], {n, 0, 300}]]
share|improve this question
Plot[n Sin[2 Pi E Factorial[n]], {n, 0, 15}] – BoLe Mar 13 '14 at 9:53
Limit give the limit of the expression as a real function (its divergent, thus the [-inf;inf] ), and not the limit of a sequence. See and for some strategies to evaluate limits of sequence (spoiler : they don't work here, you have to do the math) – William Briand Mar 13 '14 at 10:03
@WilliamBriand I think the limit is zero. ListPlot[Table[n Sin[2 Pi E Factorial[n]], {n, 0, 300}]] – alex Mar 13 '14 at 12:50
Try that plot using N[n*Sin[2 Pi E n!],1000]. – Daniel Lichtblau Mar 13 '14 at 13:28

I know the answer is a bit late, but - from a mathematician's point of view, I'm not that much of an expert when it comes to Mathematica - why don't you just replace every occurence of $n$ by $\lceil n\rceil$?

If $(a_n)_{n\in\mathbb N}$ is a convergent real sequence, then $f:\mathbb R_{>0}\to\mathbb R,\ f(x):=a_{\lceil x\rceil}$ will be a convergent real function having the exact same limit.

share|improve this answer

In the call to Limit, there doesn't seem to be any way to restrict the function to integers.

When I try

Limit[Ceiling[n] Sin[2 Pi E Factorial[Ceiling[n]]], n -> ∞]

as @Sora suggested, it just hangs (and I'm too impatient to wait more than 10 minutes). Since the factorial is only defined for nonnegative integers, the limit is indeed $2\pi$ as suggest in the linked post.

You can see that when you allow the factorial to take real numbers as input, by using the gamma function, then the result oscillates with monotonically increasing amplitude

 Plot[n Sin[2 Pi E Factorial[n]], {n, 1, 10}, PlotPoints -> 300],
 ListPlot[# Sin[2 Pi E Factorial[#]] & /@ Range[1, 10], 
  PlotStyle -> {PointSize[Large], Red}]]

enter image description here

So the limit with n as a real number really is +/- ∞. But over integers? You can see here that as n gets larger it appears to go to $2\pi$, but for n greater than 50, it goes to zero

Show[{ListPlot[Table[n Sin[2 Pi E Factorial[n]], {n, 0, nm, 1}]], 
  Plot[2 π, {x, 0, nm}, PlotStyle -> Red]}]

enter image description here

I think this is simply because Mathematica is trying to take the Sin of an extremely large number, and it switches to another algorithm once the number is large enough. As Daniel Lichtblau pointed out, it even fails for much smaller numbers when they are taken as floating points instead of integers.

Show[{ListPlot[Table[n Sin[2 Pi E Factorial[n]], {n, 0, nm, 1.0}]], 
  Plot[2 π, {x, 0, nm}, PlotStyle -> Red]}]

enter image description here

For numbers so large, $20! \approx 10^{18}$, the Sin function is apparently very sensitive to even the smallest variation in precision.

So the limit truly is $2\pi$, not zero, but I don't know how to get Mathematica to show it.

share|improve this answer
Having taken a look at the documentation, there is a nice way to evaluate a limit over the integers: if you consider the sequence $f(n)=(-1)^{2n}(1+\frac1n)$, Limit[f[n],n->Infinity] will tell you the expression diverges (as a real function), but using Limit[f[n],n->Infinity,Assumptions->{Element[n,Integers]}] will give you the correct value of 1. However, as you have already mentioned, in this case it fails due to the huge factorial expressions Mathematica's sine function can't handle properly. Still haven't found a real Mathematica solution for that either. – Sora. Nov 19 '15 at 1:27

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.