[Kc] O'Reilly books (Puzzle: 100 Monkeys)

Garrett Goebel garrett at scriptpro.com
Mon Jan 27 07:58:47 CST 2003


I've just received another very generously provided batch of books from
O'Reilly.

Slightly off-topic: I've had a somewhat busy weekend which included the
birth of my 2nd son and my daughter's 5th birthday party on the same day ;)

So while I don't have all the books assembled before me, I'll do my best to
recall the sum inventory of books received which have not yet been claimed
for book reviews, presentations, or monthly puzzle prizes:

o  Computer Science & Perl
    http://www.oreilly.com/catalog/tpj1/

o  Creating Web Applications with Mozilla
    www.oreilly.com/catalog/mozilla/

o  Designing Embedded Hardware
    www.oreilly.com/catalog/dbhardware/

o  Perl CD Bookshelf, Version 3.0
    www.oreilly.com/catalog/perlcdbs3/

o  Perl Graphics Programming
    www.oreilly.com/catalog/perlgp/

o  Perl in a Nutshell, 2nd Edition
    www.oreilly.com/catalog/perlnut2/

o  Programming Web Services with Perl
    www.oreilly.com/catalog/pwebserperl/


And speaking of prizes for monthly puzzles. I'll take this opportunity to
restate the current month's puzzle. There are some extremely good books
available for puzzle winners. The Perl CD Bookshelf alone contains 7 of
O'Reilly's most popular Perl titles and has a list price of $119.95.

                         100 Monkeys 
                          2003-01-14 
Note: This puzzle came to me unattributed by way of a 
      co-worker. If anyone chances by the source, please 
      let me know so I can give credit. 

There are 100 doors, all closed.  In a nearby cage are 100 
monkeys.  The first monkey is let out, and runs along the 
doors opening every one.  The second monkey is then let out, 
and runs along the doors closing the 2nd, 4th, 6th,...  all 
the even-numbered doors.  The third monkey is let out.  He 
attends only to the 3rd, 6th, 9th,... doors (every third 
door, in other words), closing any that is open and opening 
any that is closed.  The fourth monkey does the same for the 
4th, 8th, 12th, 16th,... doors, opening the closed ones and 
closing the open ones.  The fifth monkey does the same to 
the 5th, 10th, 15th,... doors, and so on.  After all 100 
monkeys have done their work in this way, which doors are 
left open? 

Format:   m/^\d+(?:\s\d+)*$/ # scalar must match this regex 

Goal:     fastest script to calculate the answer 

Prize:    Your choice of O'Reilly's 
          o  Perl in a Nutshell, 2nd Edition 
          o  Creating Applications with Mozilla 

Deadline: Answers must be submitted at least 24 hours 
          before the next kc.pm meeting (February 11th) 

-- 
Garrett Goebel 
IS Development Specialist 
ScriptPro                   Direct: 913.403.5261 
5828 Reeds Road               Main: 913.384.1008 
Mission, KS 66202              Fax: 913.384.2180 
www.scriptpro.com          garrett at scriptpro dot com 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/kc/attachments/20030127/20b469e6/attachment.htm


More information about the kc mailing list