In the infinite series 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 5... each positive integer k appears k times in consecutive order.
Write a formula for the sum of the first n terms of the series.
Building on my previous post, k is the largest number that actually appears k times.
k = int((-1+sqrt(1+8n))/2)
The sum of the first n terms is
k*(k+1)(2k+1)/6 + (k+1)(n - k(k+1)/2)
|
Posted by Jer
on 2007-05-15 12:07:13 |