3

How to sum up all natural numbers (and their non-negative powers)

 1 year ago
source link: https://codeforces.com/blog/entry/113327
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

How to sum up all natural numbers (and their non-negative powers)

By adamant, history, 99 minutes ago,

Hi everyone!

This is the blog for infinite sums. For finite sums of power, see here.

As everybody knows, it is true that

Moreover, it is widely known that

Historically, it seems that the result was first discovered by Ramanujan, who described it in one of his letters to G. Hardy as

In this blog, I want to explain how this summation could be easily done with the competitive programmer's favorite tool: generating functions. Moreover, I will explain how to compute the infinite sums of form for any non-negative integer .

All your problems will go away with this simple genfunc trick. Just use...

Consider the exponential generating function

Expanding into infinite sum, we get

It doesn't converge at , where we typically analyze genfuncs, but should it bother us? The expression expands as a Laurent series

which means that

If you do some investigation on the sequence of denominators, you'll notice that it is OEISable and is related to the so-called Bernoulli numbers. On closer inspection, you may notice that, generally,

where is the -th Bernoulli number. But what does it have to do with the task at hand?

A complex problem, a complex solution...

Consider another way to define the sum of powers of natural numbers, using as a parameter:

The function converges for any , which, using some complex analysis magic, allows to find its unique analytic continuation on the whole complex plane , except for the point . In other words, there is a meaningful definition of

for any integer . Okay then, what are the values of such function? I don't really know, but Wikipedia says that

Well, that's nice to know! We have no idea about Bernoulli numbers, or any other properties of Riemann zeta functions , yet we obtained some meaningful result with seemingly completely wrong formal manipulations. So, if we ever want to compute the infinite sum

we should just expand the formal power series and the answer would be its -th coefficient, divided by .

By the way, Wikipedia also mentions that is the exponential generating function for the Bernoulli numbers.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK