You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
def harmonic_sum(n):
|
|
if n < 2:
|
|
return 1
|
|
else:
|
|
return 1 / n + (harmonic_sum(n - 1))
|
|
|
|
print(harmonic_sum(7))
|
|
print(harmonic_sum(4)) |