Subscribe to EDN

Friday puzzle: countries

July 10, 2009

Last week was the monkey puzzle. Monkeys go along a corridor shutting doors that are open and opening ones that are shut. It doesn’t take too much thought about this to realize that the doors left open will be those with an odd number of factors (and not just prime factors, all factors including 1). Almost all numbers have an even number of factors. If A divides N then N/A is also a factor, so they come in pairs. The one exception is perfect squares where both N and N/A are the same number so only get counted once. The third monkey doesn’t both open and shut door number 9 to take account of the fact that 3 is a factor of 9 twice over. So the answer is that the doors left open are the perfect squares, 1,4,9,16,25…961.

Today a country puzzle:

Name 9 countries that begin and end in A (in English). I’ll give you one just because it’s dubious: Antigua and Barbuda. You know the other 8 though. If you want a hint for another of the hard ones, watch the "Tour de France" today.

Here’s another country puzzle: pick a number from 1 to 10. Multiply by 9. Subtract 5. Add the digits. Add the digits again until you have a one-digit number. Whatever number that is, pick that letter of the alphabet (A=1, B=2 etc).

Now think of a country that begins with that letter.

Now think of an animal that begins with the last letter of that country.

What country is that animal from?

Australia. Oh, look, it begins and ends with A! Only 7 to go.

Posted by Paul McLellan on July 10, 2009 | Comments (1)

July 12, 2009
In response to: Friday puzzle: countries
AjitM commented:

A crude way to get these. main() { int i; int j; int doors_open[1000]; // All doors closed initially for(i=1; i<= 1000; i++) { doors_open[i] = 0; } // j = monkey number // i = door number for(j=1; j<=1000; j++) { for(i=1; i<=1000; i++) { if(j*i <= 1000) { if(doors_open[j*i] == 0) { //printf("Monkey no %d opening the door %d \n", j, j*i); doors_open[j*i] = 1; } else if(doors_open[j*i] == 1) { doors_open[j*i] = 0; //printf("Monkey no %d closing the door %d \n", j, j*i); } } } } // print all open doors printf(" All open doors are \n"); for(i=0; i<=1000; i++) { if(doors_open[i] == 1) { printf("%d ", i); } } printf("\n"); } The o/p of this program is All open doors are 1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256 289 324 361 400 441 484 529 576 625 676 729 784 841 900 961

POST A COMMENT
Display Name
captcha

Before submitting this form, please type the characters displayed above. Note the letters are case sensitive:

Advertisement
Advertisement
Advertisement
About EDN   |   Site Map   |   Contact Us   |   Subscription   |   RSS
© 2012 UBM Electronics. All rights reserved.
Use of this Web site is subject to its Terms of Use | Privacy Policy

Please visit these other UBM Canon sites

UBM Canon | Design News | Test & Measurement World | Packaging Digest | EDN | Qmed | Pharmalive | Appliance Magazine | Plastics Today | Powder Bulk Solids | Canon Trade Shows