In mathematics, the Nth harmonic number is defined to be 1 1/2 1/3 1/4 ... 1/N. So, the first harmonic number is 1, the second is 1.5, the third is 1.83333... and so on. Assume that n is an integer variable whose value is some integer N greater than 1. Assume also that hn is a double variable whose value is the Nth harmonic number. Write an expression whose value is the (N-1)th harmonic number.

Respuesta :

Answer:

h(n-1) = h(n) - 1.0/n

Explanation:

When

n = 1, h(n) = 1

n = 2, h(n) = 1 + ½

n = 3, h(n) = 1 + ½ +⅓ =

n = 4, h(n) =1 + ½ + ⅓ + ¼

h(n) = 1 + ½ + ⅓ + ... + 1/n

In the expression above.

Subtract h(4) from h(3)

i.e.

h(3) - h(4) = (1 + ½ +⅓)- (1 + ½ + ⅓ + ¼)

h(4-1) - h(4) = (1 + ½ +⅓)- (1 + ½ + ⅓ + ¼)

Let n = 4

h(n-1) - h(n) = (1 + ½ +⅓)- (1 + ½ + ⅓ + 1/n) ---- open the bracket

h(n-1) - h(n) = 1 + ½ +⅓ - 1 - ½ - ⅓ - 1/n

h(n-1) - h(n) = -1/n

h(n-1) = h(n) - 1/n

Assume also that hn is a double variable, then h(n-1) is also a double variable.

So, h(n-1) = h(n) - 1.0/n