Lesson 7 of 18
p-Series
p-Series
A p-series has the form:
sum_{k=1}^{infty} rac{1}{k^p} = 1 + rac{1}{2^p} + rac{1}{3^p} + cdots
Convergence Test
The p-series converges if and only if .
| Series | Converges? | Limit | |
|---|---|---|---|
| harmonic | No | ||
| Basel | Yes | ||
| Apéry | Yes | ||
| Yes |
Why p=1 Diverges
Group the harmonic series:
ight) + left(rac{1}{5}+cdots+rac{1}{8} ight) + cdots$$ Each group sums to at least $rac{1}{2}$, so the total diverges. ### Why p=2 Converges The Basel problem — Euler showed the sum equals $rac{pi^2}{6}$ using the factorization of $rac{sin(x)}{x}$. Numerically, the partial sums converge slowly: $S_{1000} approx 1.6439$, approaching $1.6449$. ### Your Task Implement `double p_series(int p, int n)` that computes $sum_{k=1}^n rac{1}{k^p}$. Use a loop to compute $k^p$ without `math.h`.TCC compiler loading...
Loading...
Click "Run" to execute your code.