Skip to main content
1 of 2
DLosc
  • 40.7k
  • 6
  • 87
  • 142

Brachylog, 7 bytes

⟦₁s.+?∧ 

Try it online!

Explanation

⟦₁s.+?∧ ⟦₁ Inclusive range from 1 to the input number s A consecutive sublist (trying longest sublists first) . is the output + Its sum ? is the input ∧ Break unification with the output 
DLosc
  • 40.7k
  • 6
  • 87
  • 142