wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
riddles >> hard >> Circular Jail Cell with 100 cells
(Message started by: Jesse on Feb 3rd, 2005, 8:49pm)

Title: Circular Jail Cell with 100 cells
Post by Jesse on Feb 3rd, 2005, 8:49pm
Does anyone know the solution to the ciruclar jail riddle? There's 100 cells, the jailer unlocks all of them, then locks every other one, then turns the key on every third, then every fourth, and so on. Which cells are unlocked when he turns the key on the 100th repitition?

Jesse

Title: Re: Circular Jail Cell with 100 cells
Post by Noke Lieu on Feb 3rd, 2005, 9:35pm
Yes. (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi?board=riddles_hard;action=display;num=1027864221;start=1)

Title: Re: Circular Jail Cell with 100 cells
Post by Nigel_Parsons on Feb 6th, 2005, 12:51pm
Jesse

You can work this one out quite easily and quickly.

Each door will be unlocked on circuit one.
The even doors will be re-locked on circuit two
After circuit three all doors divisible by either two or three (but not by six) will be locked.
::[hide]
For each number door 1 - 100, count the number of exact divisors it has (including itself and 1).
e.g. 100 can be divided by 100, 50, 25,20,10, 5, 4, 2 & 1 i.e it has 9 divisors, and so will have had the key turned nine times from its original position, and so will be unlocked.
All doors with an even number of divisors will be locked. Those with an odd number will be open.
Clearly all prime number doors will also be locked, having been opened on the first circuit, and locked on their own circuit.
[/hide]::
The rest I leave to you.

Title: Re: Circular Jail Cell with 100 cells
Post by Grimbal on Feb 9th, 2005, 1:36am
Hehe now I understand.
::[hide]
And the number of exact divisor is odd iff the door number is a perfect square.  Therefore, 10 prisonners will see their door open (no. 1, 4, 9, 16, ..., 100).  The others will see their door closed, whether or not they are still inside.
[/hide]::

Title: Re: Circular Jail Cell with 100 cells
Post by Laura101 on Aug 22nd, 2005, 11:24am
This problem is relatively easy once you do the 1st 13 rounds. You simply open all of them the first time around, close every other the second, switch every 3rd the 3rd time, and so on (it's pretty much only possible if it's drawn out). When you look at the pattern after the first few rounds, it looks like this.......occoccccoccccccocccccccco

If u see it, you can tell that an o (open) is placed at every perfect square (until 100 if you keep going on). So when they're added up, the answer is 10 open cells placed at #s 1,4,9,16,25,36,49,64,81,100

sometimes u have to see it to believe it

Title: Re: Circular Jail Cell with 100 cells
Post by mikedagr8 on Jul 19th, 2007, 2:33am
i did this puzzle when i was 8. it's nice when learning counting formualae e.g. squares, triangles, fibonnacci etc. bit easy though.

Title: Re: Circular Jail Cell with 100 cells
Post by zeroooooooooooo on Aug 14th, 2007, 10:53pm
I did it in Matlab.


Code:
status=zeros(100,1);

% 0 is locked, 1 is open.

for lap=1:100
    for cell=lap:lap:100
         if status(cell)==0;
              status(cell)=1;
         else
              status(cell)=0;
         end
    end
end

sum=0;
for n=1:100
    sum=sum+status(n);
end

sum

Title: Re: Circular Jail Cell with 100 cells
Post by Topcat on Oct 30th, 2007, 1:01pm
This one is actually easy to do without any iterations.  You just need to look at some basic facts.

1) A door is open if it is operated upon an even number of times.

2) A door is closed if it is operated upon an odd number of times.

3) Doors with an even number of factors are open and doors with an odd number of factors are closed.

4) All positive integers have an even number of factors unless they are squares.

Given those premises, the only doors which will be open are the squares.  Since 10^2 = 100, then the squares of the numbers 1 - 10 are the open doors.  That is ten numbers, therefore, there are ten open doors at the end.

Title: Re: Circular Jail Cell with 100 cells
Post by temporary on Jan 22nd, 2008, 9:44pm
[hide]All the perfect squares.[/hide]



Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board