I am having trouble starting a function to compute the nth partial sum of the harmonic series 1/k.

What's wrong with that? Isn't it as simple as the following?

```
f <- function(n) {
sum(1 / (1:n))
}
f(n = 10)
#> [1] 2.928968
```

^{Created on 2019-08-29 by the reprex package (v0.3.0)}

Thank you, I was having trouble deciding how to implement the k and n variable as the problem is k = 1 to infinity of the function 1/k n times

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.