Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
subfunction for more clear solution solution in Clear category for Count Consecutive Summers by fishsouprecipe
def count_consecutive_summers(num):
def is_summable(start):
nonlocal num
s = 0
for i in range(start, num + 1):
s += i
if s == num:
return True
return False
return sum(is_summable(i) for i in range(1, num + 1))
March 6, 2020