Blog Archives

Lightoj Problem-Sum of Consecutive Integers

Problem Link: Here Explanation: Let, k be the number of consecutive integers starting from x whose sum equals N.So we can write, x+(x+1)+……..+(x+k-1)=N ——–(1) or, kx+k*(k-1)/2=N or, 2kx+k^2-k=2N or, k(2x+k-1)=2N ———-(2) From equation (2) we can say, k is a

Posted in Lightoj, Math, Number Theory