On Tue, 26 Mar 2002, Adam Spiers wrote: > Keith C. Ivey ([EMAIL PROTECTED]) wrote a superset of: > > Stephen Turner <[EMAIL PROTECTED]> wrote: > > > > > I could only manage 31, but Gareth has a 29-stroke solution. > > Jasper and I were warming up last week and got posed an > almost-identical but slightly more interesting problem by a cow-orker, > so it only took a few seconds for us to come up with a 28-stroke > solution to this. >
Ah yes, I've got 28 now. > The almost-identical problem is to implement a filter for finding > "prime" words, where a prime word is one whose letters' ASCII values > sum up to form a prime number. Obviously this means that > capitalisation matters. Same rules about input/output. My best is > 43. Any improvements? > I'm stuck on 46 here. > And if that doesn't take your fancy, try this one: > > Input: a positive integer (i.e. /^\d+$/) as $ARGV[1] > Output: its prime decomposition, with factors in increasing order, > e.g. `./solution.pl 84` should produce "2 x 2 x 3 x 7\n". > > 72 is the current best, although I have something potentially much > better. > I have 72 too if I have to treat 0 and 1. If all inputs are at least 2, as per Jasper's mail, I can do 66. -- Stephen Turner, Cambridge, UK http://homepage.ntlworld.com/adelie/stephen/ "This is Henman's 8th Wimbledon, and he's only lost 7 matches." BBC, 2/Jul/01