Consecutive Numbers Sum

Given a positive integer n, return the number of ways to express n as a sum of one or more consecutive positive integers.

Formally, count pairs (start, length) such that:

  • start >= 1
  • ...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: