1 1 2 1 4 1 N Sum Formula
As with any infinite series the infinite sum is defined to mean the limit of the sum of the first n terms as n approaches infinity.
1 1 2 1 4 1 n sum formula. Given a positive integer n write a function to compute sum of the series 1 1. In your example the finite sums were 1 2 1 1 3 2 2 1 2 7 4 2 1 4 15 8 2 1 8 and so on. If inverse of a sequence follows rule of an a p i e arithmetic progression then it is said to be in harmonic progression in general the terms in a harmonic progression can be denoted as. If the function does converge to 0 then the sums might more tests are needed.
Multiplying s n by 2 reveals a useful relationship. Of course one reason for creating the digamma function is to make formulae like this true. Subtracting s n from both sides. .
Thus the value of the infinite sum is a 1 r and this also proves that the infinite sum exists as long as r 1. Sum of the reciprocals sum r 1 n 1 r h n where h n is the nth harmonic number. The nth finite sum is 2 1 2 n. Lim 1 n n inf 0.
A simple solution solution is to initialize sum as 0 then run a loop and call factorial function inside the loop. One can write 1 frac12 frac13 cdots frac1n gamma psi n 1 where gamma is euler s constant and psi is the digamma function. I won t go into a full explanation as it too complex. Following is the implementation of simple solution.
Regardless of anything else the function itself must converge to 0 as n inf for the sum to converge. These are partial sums of the harmonic series. Ln n 1 le sum i 1 n frac1i le ln n 1 this is a rather tight upper limit and lower limit you can use to approximate your answer. This converges to 2 as n goes to infinity so 2 is the value of the infinite sum.
Sum of the reciprocals of the squares sum r 1 n 1 r 2 pi 2 6 sum r 1 n beta k n 1 k where beta x y is the beta function. 1 a 1 a d 1 a 2d 1 a 3d. As n approaches infinity s n tends to 1. Math 1 frac 1 2 frac 1 3 frac 1 4 cdots infty math that sum is normally explored in college level mathematics where you learn more appropriate.
Since this is a power series the test for convergence of the sum is very easy.