Harmonic Number

Hello, can someone tell me how to find the harmonic number in R. I know how to find it on Wolfram Mathematica using command HarmonicNumber[n]. for eg, HarmonicNumber[-(3/4)]. But I don't know how to find it on R. I don't know which package or command should be used.

I know just enough math and also just enough r to give you the implementation of the common definition

as seen here:

the n-th harmonic number is the sum of the reciprocals of the first n natural numbers
Harmonic number - Wikipedia


harmonicnumber <- function(n){
  k <- seq_len(n)
 -sum((-1)^k*(1/k) * choose(n,k))
}

This doesn't cover -3/4 as that is not a natural number

Oh I see. Thank you so much ya.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.