*Inverse Summations solution in Clear category for Count Consecutive Summers by JimmyCarlos
waysFound = 0
for n1 in range(target_number):
n2 = (2*(target_number+(0.5*n1*(n1+1))) + 0.25)**0.5 - 0.5
if n2.is_integer(): waysFound += 1
# The sum 1+2+3+....+n can be expressed as T(n), the same as ½*n*(n+1)
# The sum x₁+...+x₂ can be expressed as T(n₂)-T(n₁), where n₂ is x₂ and n₁ is one less than x₁.
# ∴ T(n₂) = target_number + T(n₁)
# ∴ T⁻¹(n) = sqrt(2y + ¼) - ½ (Found by completing the square for T(n))
# As this solution doesn't add lots of terms together this will run in better complexity time.
April 17, 2019