Red, 5253 bytes
f: func[n][i: 0 until[0 >>= n: n -(1.0 /(i: i + 1))]i]
Simple iterative solution.
Red, 78 bytes
f: func[n /a i][either a[either n > 0[f/a n -(1.0 / i)i + 1][i - 1]][f/a n 1]]
I know this is way longer than other recursive solutions, but I wanted to post it because of the fact that Red functions have fixed arity. In order to simulate default values for the additional parameters, we need to use a refinement
- here it's /a
- whenever we need the value of the i
parameter.