Zibb

EDA GRAFFITI, WITH EDA VETERAN PAUL MCLELLAN, DIGS INTO THE WORLD OF DESIGN TO FIND OUT HOW WE GOT HERE, WHERE WE ARE GOING, AND WHY EDA IS DIFFERENT.



   Advertisement

Friday, July 10, 2009

Friday puzzle: countries

Jul 10 2009 11:00AM | Permalink |Comments (1) |


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.


Reader Comments



at 7/12/2009 11:10:27 PM, AjitM said:
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

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


ADVERTISEMENT

©1997-2009 Reed Business Information, a division of Reed Elsevier Inc. All rights reserved.
Use of this Web site is subject to its Terms of Use | Privacy Policy

Please visit these other Reed Business sites