Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
O(sqrt(N)) solution in Speedy category for Count Consecutive Summers by David_Jones
def count_consecutive_summers(num):
result = 0
for i in range(int(((8 * num + 1) ** .5 - 1) / 2) + 1):
a = 2 * num / (i + 1) - i
result += a > 0 and a % 2 == 0
return result
May 12, 2019