I am attempting to solve the following:

$$3075^2 + 3074^2 + 3073^2 +\dotsb+ 1^2$$

Does anyone have any advice for exactly how I could plug this into R or Python?

  • 2
    $\begingroup$ Do you mean $\sum_{k=1}^{3075} k^2$? $\endgroup$ – Lord Shark the Unknown Mar 15 '18 at 1:47
  • 1
    $\begingroup$ The information you have give is not the sum of $(3075!)^2$. $\endgroup$ – Mathew Mahindaratne Mar 15 '18 at 1:55

Remember the formula for the sum of the first $k$ squares:

$$\sum_{k=1}^n k^2 = 1^2+2^2+\dots+(n-1)^2+n^2={n(n+1)(2n+1)\over 6}$$


$$\sum_{k=1}^{3075} k^2 = 1^2+2^2+\dots+3074^2+3075^2={3075(3076)(6151)\over 6}$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.