Question #303034

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)







Expert's answer

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

>>> 


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS