J
J
Jordan_Fride2020-05-21 17:53:25
Mathematics
Jordan_Fride, 2020-05-21 17:53:25

How to calculate the nth sum of a series?

Problem for algorithms.
Condition: Count
5ec6949c2b5b2468283732.png
Input: x, d, q, n.
Restrictions:
5ec69563af509701572737.png

By simple summation, it gives the Timelimit. Tell me how to be

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
galaxy, 2020-05-21
@Jordan_Fride

can be calculated analytically. I won’t deduce the formula in its entirety (it will even be written down here), but the idea is this: the
initial common term of the series a i = x*q i + i*d*q i
the first part is an ordinary geometric progression, the second is more interesting, up to a constant : i*q i
To find the sum of such a series, you can write it like this:
q
+
q 2 + q 2
+
q 3 + q 3 + q 3
+
...
+
q n + ... + q n
and sum not by rows, but by columns. Each column is a geometric progression with the sum (q n+1 - q k )/(q - 1)
This case must be summed over k - here is a constant + a common term of a geometric progression, everything is simple. Answer: (n*q n+1 - (q n+1 - q)/(q-1)) / (q-1)
Then put everything together with constants into one formula.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question