Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Consecutive Digits To Form Sum

source: Codewars

Prompt

Positive integers have so many gorgeous features. Some of them could be expressed as a sum of two or more consecutive positive numbers.

Consider an example:

10 could be expressed as the sum of 1 + 2 + 3 + 4.

Given Positive integer, N, return true if it could be expressed as a sum of two or more consecutive positive numbers, otherwise return false.

Constraints

2 ≤ N ≤ (2^32) -1

Examples

consecutive_ducks(9) => true # 9, could be expressed as a sum of (2 + 3 + 4) or
(4 + 5).

consecutive_ducks(64) => false

consecutive_ducks(42) => true # 42, could be expressed as a sum of
(9 + 10 + 11 + 12).