Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
6-liner: use sum of triangular numbers series solution in Creative category for Saw the Stick by przemyslaw.daniel
def checkio(n):
k, r = int(2*n**0.5), range
for i, j in ((x, y) for x in r(k) for y in r(k)):
if j*(j+1)*(j+2) - i*(i+1)*(i+2) == 6*n:
return [x*(x+1)//2 for x in range(i+1, j+1)]
return []
Dec. 11, 2017