|
||
Title: Circular Jail Cell Post by NickH on Jul 28th, 2002, 6:50am Ten prisoners found their door open after 100 rounds of the drunken jailor. They were the ones whose cell number is a perfect square. Each door is opened or closed once for each factor of its cell number, including 1 and the cell number itself. For example, for cell 12: 1, 2, 3, 4, 6, 12. Most whole numbers have an even number of factors. This is because each factor f can be paired with n/f. The exceptions are the perfect squares, where f = n/f for precisely one factor. |
||
Title: Re: Circular Jail Cell Post by horseisahorse on Aug 7th, 2002, 6:00pm Actually, I think the real-world answer would be zero, since each prisoner would have booked out of the prison as soon as the jailor opened his door during the first round. |
||
Title: Re: Circular Jail Cell Post by Ivan on Dec 18th, 2002, 10:20pm I got the same answer as NickH. Since I like doing things the hard way, I wrote a python program (the formatting here ain't great, look at it at http://linuxhelp.hn.org/jail-cell.py if you're interested. (with proper block spacing)): Code:
|
||
Powered by YaBB 1 Gold - SP 1.4! Forum software copyright © 2000-2004 Yet another Bulletin Board |