Before anyone says anything, similar and similar. But this is not a dupe.
Some positive integers can be written as the sum of at least two consecutive positive integers. For example,
9=2+3+4=4+5. Write a function that takes a positive integer as its input and prints as its output the longest sequence of increasing consecutive positive integers that sum to it (any format is acceptable, though -5 bytes if the output is the increasing sequence separated by
+ as shown above. If there exists no such sequence, then the number itself should be printed.
This is code golf. Standard rules apply. Shortest code in bytes wins.
Samples (note that formatting varies)
Input: 9 Output: 2,3,4 Input: 8 Output: 8 Input: 25 Output: [3,4,5,6,7]