WC 2.2 Coin Game

You and your friend are playing an interesting game.
Your friend has arranged n same coins in single line.
Each coin is given a number in the order in which they are placed.
Your friend then removes all the coins that are present at an odd position.


Initially, coins have numbers - 1,2,3,4,5...
After first pass, coins left are - 2,4,...
After second pass - 4,....
And so on.

You have to select the coin which is present till last pass.

Example:-
For n=5,you need to select 4th coin;
Explanation :- given above.


Output Specifications:

Give your answer as sum of positions of coins for these 'n' :

10
100
1000000
1000000000
12345654321
9999999999999999
Note: Give your answer modulo 1000000007(10^9 + 7) as it can be a large number.
Read more about modulo operation(%) here.


Click to view hint

This challenge is worth 80 points.

You must be logged in to submit a solution

View ranklist for this challenge
About scoring and submission

Contact Us


Krish Shah : 9323115454

Kaustubh Khavnekar : 9769408039



Privacy Policy