Ly, 1414 12 bytes
0ns[1fn[:1f/+l1f1-s]p]&+ Explaining Ly is tricky for me, but here goesFound a simpler way to do this... The code just keeps the accumulated value and the loop counter on the stack, and using the "backup cell" in Ly to avoid having to duplicate the loop counter before doing theoriginal was: 10ns[1f/n+l1-s]p math
And here's what it's doing.
0nsn ReadGet 'n' from the challenge (the number of iterations) from the input, then copies it to the backup cell with and push onto the s commandstack.
[...] Loops asAs long as the top of the stack (the decrementing loop counter) is not 0non-zero.
:1f/+ CalculatesDuplicate the top of the stack (the iteration counter), and compute 1/n where n it the loop counter (top of the stack). Then adds that to the previous value of the accumulator.
l1f1-s Pulls the loop counter from the backup cell, decrements it and saves it back. AfterwardsFlip the top oftwo entries on the stack isso that the next value of 1/n or 0calculation is second and the iteration counter is on the top. Then decrement the iteration counter.
p&+ When the loop,Once all that's left to do it pop the 0 loop counter ofvalues have been computed, sum the stack and the accumulated value will be printedprint.