Any curious mathematician has come accross the formula

and I would bet it caused him/her both a deep shock and a terrible curiosity. As a matter of fact, such expression doesn't fit in any way into the usual notion of convergent sum. For instance, we use to say that

since the partial sums

get closer and closer to 2 in a way explained in detail in any Calculus course.

(OK, so far it wasn't too difficult, was it?)

However, the partical sums of the natural numbers behave in quite a different way

They grow and grow without an end in sight, so that the sum diverges. And now one comes and tells us we're too naive and this sum is actually $-\dfrac{1}{12}$. Amazing what a dimwit, right?

Well, not so much.

It's true of course that the sum of the natural numbers diverges in the standard sense of convergence, but maybe it's useful to look at this sum from a different angle. Let me explain this with an example.

The previous sum $1+\dfrac{1}{2}+\dfrac{1}{4}+\dfrac{1}{8}+\dfrac{1}{16}+\cdots=2$ is actually just a particular case of a geometric sum: if $|x|< 1$, how much is $1+x+x^2+x^3+x^4+\cdots$?

thus arriving to the beautiful formula

Perfect! For $x=\dfrac{1}{2}$, we get $S=\dfrac{1}{1-\frac{1}{2}}=2$.

But what if $|x|$ isn't less than 1? For instance, taking $x=2$, it turns out that $1+2+4+8+16+\cdots=-1$. That's awful! However, it still keeps appealing to us. A boring mathematician would say

The formula $1+x+x^2+x^3+x^4+\cdots=\frac{1}{1-x}$ only makes sense when $|x|< 1$ and it shouldn't be considered outside its validity range.

show(plot(1/(1-x),(x,-1,1), detect_poles=True, thickness=3, rgbcolor=(0.9,0,0.4)), xmin=-5, xmax=5, ymin=-2, ymax=3, axes_labels=[r'$x$',r'$\frac{1}{1-x}$'])

While a kamikaze mathematican (I sincerely hope you all are in this class!) would say:

Taking such a cool function as $\frac{1}{1-x}$ only within $(-1,1)$ doesn't go. It's really mind-blowing saying that $1+x+x^2+x^3+x^4+\cdots=\frac{1}{1-x}$ for any $x$, no matter how shocking the conclusions are!

show(plot(1/(1-x),(x,-1,1), detect_poles=True, thickness=3, rgbcolor=(0.9,0,0.4)) + plot(1/(1-x),(x,-5,-1), detect_poles=True, thickness=3, rgbcolor=(0.1,0.4,0.9)) + plot(1/(1-x),(x,1,5), detect_poles=True, thickness=3, rgbcolor=(0.1,0.4,0.9)), xmin=-5, xmax=5, ymin=-2, ymax=3, axes_labels=[r'$x$',r'$\frac{1}{1-x}$'])

What the kamikaze mathematician has just done is what we call an analytical continuation (the concepts kamikaze and rigorous are not opposed, but rather complement each other!).

Something like this is what happens with $1+2+3+4+5+\cdots=-\dfrac{1}{12}$.

In 1859, the German mathematician Bernhard Riemann introduced the ever-ubiquitous zeta function:

which, despite converging in a suitable way only for $s>1$ (more precisely, for $\text{Re}(s)>1$ in the complex plane), can also be analytically continued.

show(plot(zeta(x),(x,1,5), detect_poles=True, thickness=3, rgbcolor=(0.9,0,0.4)) + plot(zeta(x),(x,-5,1), detect_poles=True, thickness=3, rgbcolor=(0.1,0.4,0.9)), xmin=-5, xmax=5, ymin=-2, ymax=3, axes_labels=[r'$x$',r'$\zeta(x)$'])

(Did anyone imagine it would be kindergarten stuff?)

show(plot(zeta(x),(x,1,25), thickness=3, rgbcolor=(0.9,0,0.4)) + plot(zeta(x),(x,-25,1), thickness=3, rgbcolor=(0.1,0.4,0.9)), xmin=-25, xmax=25, ymin=-25, ymax=25, axes_labels=[r'$x$',r'$\zeta(x)$'])

Unfortunately, in this case the process of analytical continuation is tremendously complicated... but nevertheless contains the precious gold nugget:

In fact, this makes plausible our initial statement. But... may we do some trick to avoid having to do the analytical continuation of the $\zeta$-function? Let's see what can be done. We should proceed as in the beginning:

On the other hand

and, evaluating at $x=-1$

So we can summarize everything we have seen so far in the following accurate terms.

We don't know what the hell can mean that $1+2+3+4+5+\cdots=-\frac{1}{12}$, but all people willing to associate a finite sum to this series end up saying it adds up to $-\frac{1}{12}$.

Anyway, some boring mathematician (yes, it's sad, they exist and are far from unique...) can tell us: 'What's the point in all this, if it deals with things that do not make sense'. Well, as extraordinary as it may seem, we can answer back conclusively: the expression $1+2+3+4+5+\cdots=-\frac{1}{12}$ has visible physical implications, for instance in areas like quantum mechanics or string theory. Specifically, we can refer to the Casimir effect and the renormalization of zero-point energy, or to the computation of the critical dimension in bosonic string theory. Of course, these phenomena are difficult to explain... but not impossible to understand. Cheer up! All the beauty in the cosmos is open to the good mathematician.