We are the protectors of Asgard planet. Thor have provided us with a mighty number , which is to be used to obtain a sequence of natural numbers. The sequence of numbers is the key to the survival of the planet. Can you find the sequence with the help of the following information? The sequence is , where and number of elements in sequence is minimum possible k is minimum possible. We are assigned the task to find the number of terms in the sequence (we've to find k+1) when . Bonus : find all elements of the sequence Inspiration : code-forces
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
k = ⌊ l o g 2 n ⌋
First let a i = 2 i for i ≤ k − 1 and a k = n − 2 k + 1
Now just sort a i ascending