Contribution for Puzzlet #023

From:  Patrick Curteis

I just had a go at 161, which is quite straight-forward. I haven't looked at your code apart from your answers, and I've discovered that we've each got one answer different. I've got a prime number of 4201 (which reverses to 1024 or 32 squared) which you haven't got in your list. Also you've got a prime of "0061" (which reverses to 1600 or 40 
squared), but is 61 a 4-digit prime?


Your solution 4201 is correct, and, after looking at my code, I can see why.  It searches a very narrow range for efficiency: only those 2-digit numbers whose square is a 4-digit number.  The range is 32 to 99, but, for some reason, I typed 33 to 99 in the code.  Since 4201 is 1024 reversed, with a root of 32, this one fell off the table. 

Your comments about 0061 are also correct.  This one slipped through because I was working with strings, and the string "0061" has four characters!

I've corrected the code and write-up now.  Thanks for putting me straight on this one . . .




Site design/maintenance: Dave Ellis E-mail me!
Last Updated: February 28th, 2007.