You are viewing a single comment's thread. Return to all comments →
Explanation: this, in general, returns the amount of integers between two numbers (+1 for inclusive).
Ex: a=24, b=47 >> floor(7) - ceil(4.90) + 1 = 7-5+1 = 3
Ex: a=24, b=24 >> floor(4.90) - ceil(4.90) + 1 = 4-5+1 = 0
Python 3
def squares(a, b): return math.floor(pow(b, 0.5)) - math.ceil(pow(a, 0.5)) + 1
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and Squares
You are viewing a single comment's thread. Return to all comments →
Explanation: this, in general, returns the amount of integers between two numbers (+1 for inclusive).
Ex: a=24, b=47 >> floor(7) - ceil(4.90) + 1 = 7-5+1 = 3
Ex: a=24, b=24 >> floor(4.90) - ceil(4.90) + 1 = 4-5+1 = 0
Python 3