Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Saw the Stick by coells
def checkio(jose_jalapeno):
m, n = 0, jose_jalapeno
while m < n:
m += 1
k = jose_jalapeno * 6 + m * (m * m - 1)
n = round(k ** (1/3))
if k == n * (n * n - 1):
return [i * (i + 1) // 2 for i in range(m, n)]
return []
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
assert checkio(64) == [15, 21, 28], "1st example"
assert checkio(371) == [36, 45, 55, 66, 78, 91], "1st example"
assert checkio(225) == [105, 120], "1st example"
assert checkio(882) == [], "1st example"
April 7, 2014
Comments: