What is h(41)-h(40), given the definition of h below?
def h(n):
s = 0
for i in range(1,n+1):
if n%i > 0:
s = s+1
return(s)
def h(n):
s = 0
for i in range(1,n+1):
if n%i > 0:
s = s+1
return(s)
n=41
print("h(",n,") - h(",n-1,") = ",h(n)-h(n-1))
Python output
h( 41 ) - h( 40 ) = 7
>>>
Comments
Leave a comment