100 people are standing in a circle in an order 1 to 100.
No.1 has a sword. He kills next person (i.e.no. 2 )and gives sword to next to next (i.e no.3).
Every person does the same until only 1 person is alive.
Which number survives in the end?
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.
Hey! That is my question, why did you copy?
Log in to reply
That depends, is your problem original
Log in to reply
yes, it is original
Log in to reply
@Anuj Shikarkhane – Somebody asked me that as a puzzle 3 days ago... Really original or based on some thing you saw ? Because there can't be so many so-incidences, so maybe you made it after seeing some similar question somewhere and then you made it bit tougher to get the question ?
Log in to reply
@Aditya Raut – Actually I didn't saw this type of question anywhere, it was just a riddle that I got from whatsapp
Log in to reply
@Anuj Shikarkhane – Yeah that is possible. Riddles are not generally generated by people (like innovatively made it) , they're like listened from somewhere you don't remember. But from those riddles, if you are smart enough, you can make cool problems, just like you attempted :)
Happy problem solving.
Log in to reply
@Aditya Raut – BTW, congratulations for being the moderator.
Log in to reply
@Anuj Shikarkhane – Not yet, i was just contacted by Calvin sir, he said he will make me after 2-3 days, he said "thanks for the enthusiastic reply, I will guide you through how to become a good moderator once I am done with emailing people"
Did you think of a similar solution?
Log in to reply
No, I didn't use any program to do this. I wrote numbers 1 to 100 in an excel sheet and did it.
An intuitive, generalised form, that uses just maths, not Comp.Science
Let initial number of people be n , and the power of 2 just next to n be 2 k
(For example in this case, n = 1 0 0 and 2 k = 1 2 8 )
Then the person who survives is ( n − ( 2 k − n ) + 1 )
See that in this case, it's 1 0 0 − ( 1 2 8 − 1 0 0 ) + 1 = 1 0 0 − 2 8 + 1 = 7 3
It is depending on the power of 2 because , if there are n k people at the end of k t h round ,then in i t h round, ⌈ 2 n i − 1 ⌉ people will survive. This means, if the number n , if is itself a power of 2 , then the person who survives at end will be 1 . This you can check in mind. Everytime, half people die and sword comes to 1
Thus, the formula holds.
@Satvik Golechha , @Krishna Ar , @Ronak Agarwal , @Finn Hulse , @Sharky Kesa . Thoughts plz
Log in to reply
I like this.
@Aditya Raut That's exactly wah I did. I do't know anything in programming. BTW I've solved it 4 times.
U see that this question can be solved just by imagination. Let us start cutting the people . After one round , 2n-1 name of people lived. Now next round . Starting from 1 , here 4n-3 name people lived. So the one who was left should be of the form 4n-3 . 73 was that and so it was the answer . Now coming to real solution we will continue this process , everytime replacing n with next type of nos. Saved . So it will go next and finally the form will come in which we get 73 as only ans.
Might as well do it in c++.
#include <iostream>
main()
{
int n, hPower2;
std::cin >> n;
hPower2 =1; //Highest power of two
while( n > (hPower2 << 2))
hPower2 <<= 2;
std::cout << 2*(n-hPower2)+1 << "\n";
return 0;
}
Look ma, no recursion
I did it by eliminating the options.
First I eliminated option 98 as all the even numbered persons will die after the first round.
After the second go upto 100.
Then if we see the remaining numbers they form an arithmetic progression.
1,5,9,13,17,21.........
Any term in this will be given as
a+(n-1) d = nth term
Here a=1 and d=4,
So 1+(n-1)4= number
Analyzing it we see that the number which is in this A. P. will be a multiple of 4 after 1 is deducted from it.
Only 73 is the option which meet this criteria, hence the answer is 73.
I don't know how to explain the mental math solution.
I guess you should write all of the odd numbers on a paper since it started with no.1 (which is an odd number.)
Then continue cancelling numbers accordingly.
Not sure what's the formula for this without programming..
Problem Loading...
Note Loading...
Set Loading...
My Python 3.4.1 solution:
The program returns 73 as the answer.