Friday, December 30, 2011

2011/111) Between 1000 and 2000 you can get all but one integers as the sum of positive consecutive integers. What is this number that you cannot get ?


It must have an odd factor it is proved in yahoo ans
first we know that each odd number can be expressed as sum of 2 consecutive numbers as
2n + 1 = n + (n+1)
Any even number is a power of 2 or can be expressed as power of 2 multiplied by an odd number >1
Say it is 2^p(2n+1) where p is highest power of 2 which is a factor.
Now 2n+1 can be written as n+ (n+1)
Now we have 2 cases 2^p <= n or 2^p > n
Case 1) 2^p < n
This can occur 2^p times but there shall be 2^p copies of n and 2^p copies on n + 1

In the kth copy subtract k-1 from n and add k-1 to n+ 1
So we get the values n-(2^p-1) to n+ 2^2p
The sum shall be 2^p ( n + 1 +n).
And all numbers are consecutive ( 1st number >= 1) and positive
Case 2) 2^p > n
We take 2n+1 copies of 2^p
From the middle value at a distance of k we subtract k on from the left element and add k on the right element
So we have consecutive numbers 2^p-n to 2^p+ n
Sum = ½(2n+1)(2^p*2) = (2n+1) 2^p and as 2^p > n so all numbers are positive

Only power of 2 cannot be expressed as sum of consecutive number. Then the number is 1024 it has been proved in the link as above

No comments: