Who gets lucky in life

Crack this

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?

98 59 73 15

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.

6 solutions

Mark Mottian
Sep 5, 2014

My Python 3.4.1 solution:

def numLeft(people,y):
    return 0 if people == 1 else (numLeft(people-1,y)+y)%people

print (numLeft(100,2) + 1)

The program returns 73 as the answer.

Hey! That is my question, why did you copy?

Anuj Shikarkhane - 6 years, 9 months ago

Log in to reply

That depends, is your problem original

Trevor Arashiro - 6 years, 9 months ago

Log in to reply

yes, it is original

Anuj Shikarkhane - 6 years, 9 months ago

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 ?

Aditya Raut - 6 years, 9 months ago

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

Anuj Shikarkhane - 6 years, 9 months ago

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.

Aditya Raut - 6 years, 9 months ago

Log in to reply

@Aditya Raut BTW, congratulations for being the moderator.

Anuj Shikarkhane - 6 years, 9 months ago

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"

Aditya Raut - 6 years, 9 months ago

Did you think of a similar solution?

Mark Mottian - 6 years, 9 months ago

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.

Anuj Shikarkhane - 6 years, 9 months ago
Aditya Raut
Sep 12, 2014

An intuitive, generalised form, that uses just maths, not Comp.Science

Let initial number of people be n n , and the power of 2 2 just next to n n be 2 k 2^k

(For example in this case, n = 100 n=100 and 2 k = 128 2^k=128 )

Then the person who survives is ( n ( 2 k n ) + 1 ) \biggl(n-(2^k-n)+1\biggr)

See that in this case, it's 100 ( 128 100 ) + 1 = 100 28 + 1 = 73 100-(128-100)+1=100-28+1=\boxed{73}

It is depending on the power of 2 because , if there are n k n_k people at the end of k t h k^{th} round ,then in i t h i^{th} round, n i 1 2 \lceil \dfrac{n_{i-1}}{2} \rceil people will survive. This means, if the number n n , if is itself a power of 2 2 , then the person who survives at end will be 1 1 . This you can check in mind. Everytime, half people die and sword comes to 1 1

Thus, the formula holds.

Log in to reply

I like this.

Finn Hulse - 6 years, 9 months ago

@Aditya Raut That's exactly wah I did. I do't know anything in programming. BTW I've solved it 4 times.

Satvik Golechha - 6 years, 9 months ago
Utsav Singhal
Sep 5, 2014

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.

Daniel Dominguez
Sep 7, 2014

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

Ujjwal Gupta
Dec 8, 2014

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..

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...