Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
If this list is p-0 + p-1 + ... + p-p, yes, you can.
It is the same as the sum of 0+1+...p. -
NoMad141764ySrsly?
P + p-1 + p-2 + ... +1
1 + 2 + ... + P
Add the two, and divide by two so you have:
P+1 + p+1 + ... + P+1 (exactly p times)
So it's p×(p+1) and then divide by two (cuz you have two series) so it's (p×(p+1))/2 -
Look up "arithmetic progressions (or series)" and "sum of arithmetic progressions (or series)". Also note when said formulae are valid. Validity conditions are super important when dealing with number series.
While you're at it, also look up "geometric progressions (or series)" and "sum of geometric progressions (or series)".
For even more fun, try harmonic series.
This particular sum diverges to -infinity if the series goes on to infinity, so you need to be *very* careful about what conclusions you draw when you use it. Series summation and infinities are tricky. Look up the whole "sum of natural numbers is -1/12" thing for a glimpse of why divergent series can be confusing.
It's even more fun if p is complex. -
NoMad141764y@RememberMe not entirely. If it goes to infinity, them the sum itself goes to the same infinity too. (Easy answer) It probably has an end limit tho, which is why the normal summation should work. (the one I mentioned above)
-
NoMad141764yI remember in advanced and engineering maths we have some fugly series tho, which were a pain to solve for.... Oh the memories.
-
herpaderp, just realized for the trivial case I can do p*(floor(p/2)+1)
good answer though. -
@NoMad I meant that the series has infinite terms(goes *on* to infinity). Bad terminology, my bad.
Also no, not really. If the terms flip flop between positive and negative, it can be even more fun characterizing the series. -
It’s weird that you deal with algorithms for fast prime factorization but didn’t know about this sum series 😄
There is a story where the teacher gives the students the task to calculate that sum starting from 100 and one of the students gives the answer immediately by using this shortcut. Was it Newton or Gauss? I don’t remember.
I need advice. Is there a quick way to get the sum of a series?
for example.
p + p-1 + p-2 + p-3 ...
and so on?
question