While it's quiet

While it's quiet

Re: While it's quiet Posted by flashman on Mon May 17th 2004 at 11:19pm
flashman
65 posts
Posted 2004-05-17 11:19pm
flashman
member
65 posts 7 snarkmarks Registered: Apr 16th 2004 Location: Bradford.
You have been sentenced to death along with, say, another eleven prisoners.The method of execution is as follows:

Each of you are allocated a number and ordered to stand in a circle - in sequence.

Starting at no.1 and moving clockwise, the executioner shoots every other man in turn until only one is left - he is reprieved.

If you could choose your number, what would it be?
What if there were thirty-seven prisoners?
Or ninety-three?

What if there were X no.

A tenner to the Charity designated by the person who posts the briefest correct answer to the last.
Re: While it's quiet Posted by 7dk2h4md720ih on Mon May 17th 2004 at 11:23pm
7dk2h4md720ih
1976 posts
Posted 2004-05-17 11:23pm
1976 posts 198 snarkmarks Registered: Oct 9th 2001
edit: didn't read properly lol
Re: While it's quiet Posted by Leperous on Mon May 17th 2004 at 11:24pm
Leperous
3382 posts
Posted 2004-05-17 11:24pm
Leperous
Creator of SnarkPit!
member
3382 posts 1635 snarkmarks Registered: Aug 21st 2001 Occupation: Lazy student Location: UK
x-1 ?
Re: While it's quiet Posted by Kage_Prototype on Mon May 17th 2004 at 11:32pm
Kage_Prototype
1248 posts
Posted 2004-05-17 11:32pm
1248 posts 165 snarkmarks Registered: Dec 10th 2003 Occupation: Student Location: Manchester UK
I think lep got it.
Re: While it's quiet Posted by mazemaster on Mon May 17th 2004 at 11:35pm
mazemaster
890 posts
Posted 2004-05-17 11:35pm
890 posts 438 snarkmarks Registered: Feb 12th 2002
no, he shoots every EVEN person and keeps going around the circle.
Re: While it's quiet Posted by Leperous on Mon May 17th 2004 at 11:39pm
Leperous
3382 posts
Posted 2004-05-17 11:39pm
Leperous
Creator of SnarkPit!
member
3382 posts 1635 snarkmarks Registered: Aug 21st 2001 Occupation: Lazy student Location: UK
Ok, so you want to be x-1'th if there's an odd number of people, and x'th if there are an even number of people.
Re: While it's quiet Posted by 7dk2h4md720ih on Mon May 17th 2004 at 11:45pm
7dk2h4md720ih
1976 posts
Posted 2004-05-17 11:45pm
1976 posts 198 snarkmarks Registered: Oct 9th 2001
x-1 was my first answer so I was half right I guess. :smile:
Re: While it's quiet Posted by 7dk2h4md720ih on Mon May 17th 2004 at 11:47pm
7dk2h4md720ih
1976 posts
Posted 2004-05-17 11:47pm
1976 posts 198 snarkmarks Registered: Oct 9th 2001
http://www.lepra.org.uk/ Is my charity of choice, so send a fiver! :biggrin:
Re: While it's quiet Posted by flashman on Mon May 17th 2004 at 11:48pm
flashman
65 posts
Posted 2004-05-17 11:48pm
flashman
member
65 posts 7 snarkmarks Registered: Apr 16th 2004 Location: Bradford.
No. Sorry. The sequence would run (in the case of 12 people)

1 x 3 x 5 x 7 x 9 x 11 x 2 x 6 x 10 x 4 x 12 - leaving 8
Shoot one-miss one-shoot one-miss one...
Re: While it's quiet Posted by fraggard on Tue May 18th 2004 at 3:58am
fraggard
1110 posts
Posted 2004-05-18 3:58am
fraggard
member
1110 posts 220 snarkmarks Registered: Jul 8th 2002 Occupation: Student Location: Bangalore, India
flashman said:
What if there were thirty-seven prisoners?
Or ninety-three?
This is the classic Josephus problem, isn't it? There's a formula I used to use for this one... I think it is:

Survivors position = 1 + 2X - 2^floor(1+lg(X))

lg(X) is to the base 2.

For 37, it's 11. For 93, it's 123. (Edit: Should be 58. I'm stupid)
Re: While it's quiet Posted by flashman on Tue May 18th 2004 at 8:41am
flashman
65 posts
Posted 2004-05-18 8:41am
flashman
member
65 posts 7 snarkmarks Registered: Apr 16th 2004 Location: Bradford.
? posted by fraggard

Survivors position = 1 + 2X - 2^floor(1+lg(X))

lg(X) is to the base 2.

For 37, it's 11. For 93, it's 123.

The answer is always an even number - All odd numbers are taken out in the first circuit.
Re: While it's quiet Posted by Leperous on Tue May 18th 2004 at 9:08am
Leperous
3382 posts
Posted 2004-05-18 9:08am
Leperous
Creator of SnarkPit!
member
3382 posts 1635 snarkmarks Registered: Aug 21st 2001 Occupation: Lazy student Location: UK
Ok, so 2n - 2^floor(1+log<SUB>2</SUB>(n)) for n>2 then :razz:
Re: While it's quiet Posted by fraggard on Tue May 18th 2004 at 11:24am
fraggard
1110 posts
Posted 2004-05-18 11:24am
fraggard
member
1110 posts 220 snarkmarks Registered: Jul 8th 2002 Occupation: Student Location: Bangalore, India
Leperous said:
Ok, so 2n - 2^floor(1+log<SUB>2</SUB>(n)) for n>2 then :razz:
What he said.

And the number for 93 is wrong... It should be 58. (59 by the forumla, 58 for your answer)
Re: While it's quiet Posted by mazemaster on Tue May 18th 2004 at 11:56am
mazemaster
890 posts
Posted 2004-05-18 11:56am
890 posts 438 snarkmarks Registered: Feb 12th 2002
Awesome riddle.
1....1

2....2

3....2
4....4

5....2
6....4
7....6
8....8

9....2
10...4
11...6
12...8
13...10
14...12
15...14
16...16

17...2
18...4
[...]
31...30
32...32

33...2
[...]
64...64

65...2
[...]
128..128
Re: While it's quiet Posted by fraggard on Tue May 18th 2004 at 3:24pm
fraggard
1110 posts
Posted 2004-05-18 3:24pm
fraggard
member
1110 posts 220 snarkmarks Registered: Jul 8th 2002 Occupation: Student Location: Bangalore, India
I was looking around, and found another solution...

Apparently, if you convert X to binary, and then rotate all the bits left by 1 place, you get the final position to be in.

If X = X1[size=13]X2[size=13]X3[size=13]X4[size=13]X5...[size=13]Xn-1Xn [/size][/size][/size][/size][/size]In binary, then Rotating it to become [size=10][size=10][size=13]X2[size=13]X3[size=13]X4...[size=13]XnX1 [/size][/size][/size][/size][/size][/size]gives you the final position. (For this particular case, you have to subtract 1 from that value, I think.)