<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2654.45">
<TITLE>Puzzle: 100 Monkeys (More prizes update)</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2>Because O'Reilly has given us so many excellent books, I'm going to add another prize category to this month's puzzle.</FONT>
</P>
<P><FONT SIZE=2>First prize: fastest</FONT>
<BR><FONT SIZE=2>Second prize: shortest</FONT>
</P>
<P><FONT SIZE=2>* There will be 2 winners (no single person can get 1st and 2nd)</FONT>
<BR><FONT SIZE=2>** I will not be participating for a prize</FONT>
</P>
<P><FONT SIZE=2>And again, because I forgot to update it in the text below. The prize is the winner's choice of one of the following:</FONT>
</P>
<P><FONT SIZE=2>o Computer Science & Perl </FONT>
<BR><FONT SIZE=2>o Creating Web Applications with Mozilla </FONT>
<BR><FONT SIZE=2>o Designing Embedded Hardware </FONT>
<BR><FONT SIZE=2>o Perl CD Bookshelf, Version 3.0 </FONT>
<BR><FONT SIZE=2>o Perl Graphics Programming </FONT>
<BR><FONT SIZE=2>o Perl in a Nutshell, 2nd Edition </FONT>
<BR><FONT SIZE=2>o Programming Web Services with Perl </FONT>
</P>
<BR>
<P><FONT SIZE=2> 100 Monkeys </FONT>
<BR><FONT SIZE=2> 2003-01-14 </FONT>
<BR><FONT SIZE=2>Note: This puzzle came to me unattributed by way of a </FONT>
<BR><FONT SIZE=2> co-worker. If anyone chances by the source, please </FONT>
<BR><FONT SIZE=2> let me know so I can give credit. </FONT>
</P>
<P><FONT SIZE=2>There are 100 doors, all closed. In a nearby cage are 100 </FONT>
<BR><FONT SIZE=2>monkeys. The first monkey is let out, and runs along the </FONT>
<BR><FONT SIZE=2>doors opening every one. The second monkey is then let out, </FONT>
<BR><FONT SIZE=2>and runs along the doors closing the 2nd, 4th, 6th,... all </FONT>
<BR><FONT SIZE=2>the even-numbered doors. The third monkey is let out. He </FONT>
<BR><FONT SIZE=2>attends only to the 3rd, 6th, 9th,... doors (every third </FONT>
<BR><FONT SIZE=2>door, in other words), closing any that is open and opening </FONT>
<BR><FONT SIZE=2>any that is closed. The fourth monkey does the same for the </FONT>
<BR><FONT SIZE=2>4th, 8th, 12th, 16th,... doors, opening the closed ones and </FONT>
<BR><FONT SIZE=2>closing the open ones. The fifth monkey does the same to </FONT>
<BR><FONT SIZE=2>the 5th, 10th, 15th,... doors, and so on. After all 100 </FONT>
<BR><FONT SIZE=2>monkeys have done their work in this way, which doors are </FONT>
<BR><FONT SIZE=2>left open? </FONT>
</P>
<P><FONT SIZE=2>Format: m/^\d+(?:\s\d+)*$/ # scalar must match this regex </FONT>
</P>
<BR>
<P><FONT SIZE=2>Goal:</FONT>
<BR><FONT SIZE=2>o fastest script to calculate the answer</FONT>
<BR><FONT SIZE=2>o shortest script to calculate the answer</FONT>
</P>
<BR>
<P><FONT SIZE=2>Prize: Your choice of O'Reilly book </FONT>
</P>
<P><FONT SIZE=2>o Computer Science & Perl </FONT>
<BR><FONT SIZE=2>o Creating Web Applications with Mozilla </FONT>
<BR><FONT SIZE=2>o Designing Embedded Hardware </FONT>
<BR><FONT SIZE=2>o Perl CD Bookshelf, Version 3.0 </FONT>
<BR><FONT SIZE=2>o Perl Graphics Programming </FONT>
<BR><FONT SIZE=2>o Perl in a Nutshell, 2nd Edition </FONT>
<BR><FONT SIZE=2>o Programming Web Services with Perl </FONT>
</P>
<P><FONT SIZE=2>Deadline: Answers must be submitted at least 24 hours </FONT>
<BR><FONT SIZE=2> before the next kc.pm meeting (February 11th) </FONT>
</P>
<P><FONT SIZE=2>-- </FONT>
<BR><FONT SIZE=2>Garrett Goebel </FONT>
<BR><FONT SIZE=2>IS Development Specialist </FONT>
<BR><FONT SIZE=2>ScriptPro Direct: 913.403.5261 </FONT>
<BR><FONT SIZE=2>5828 Reeds Road Main: 913.384.1008 </FONT>
<BR><FONT SIZE=2>Mission, KS 66202 Fax: 913.384.2180 </FONT>
<BR><FONT SIZE=2>www.scriptpro.com garrett at scriptpro dot com </FONT>
<BR><FONT SIZE=2> </FONT>
</P>
</BODY>
</HTML>