编写一个递归函数,计算下列级数
m(i)=1/3+2/5+3/7+...+i/(2i+1)
def m(i):
s = 0
for j in range(1, i + 1):
s += j / (2 * j + 1)
return s
result = m(10)
print(result)
递归函数 有用请采纳
def getRes(i):
if i == 1:
return 1 / 3
return 1 / (2 * i + 1) + getRes( i - 1 )
print(getRes(2))