## FF. Hostile Flowers

This is a beautiful puzzle that appears in many different forms.

Arp and Bif are playing with a line of 100 flowers. Each flower is originally open. When an open flower is touched it closes, and when a closed flower is touched, it opens. First they touch every flower in the line, then they touch every other flower in the line, then they touch every third flower, etc.

When done, which flowers are open, which flowers are closed?

1. ### 0x616c said,

March 5, 2009 at 3:01 am

Nice!
[spoiler]
Any flower whose number is a perfect square is closed.

Not a proof, but to quickly verify:
ruby -e ‘a=100;b=Array.new(a+1,1);1.upto(a){|c|c.step(a,c){|d|b[d]^=1}};1.upto(a){|e|print”flower #{e} is “;puts 1==b[e]?”open”:”closed”}’
[/spoiler]

2. ### avgbody said,

March 6, 2009 at 12:49 pm

[spoiler] With the hint of looking at the first 10, it seems to be that the square numbers are the ones left closed. [/spoiler]

3. ### strauss said,

March 8, 2009 at 1:45 am

The real issue here is:

[spoiler] What characterizes numbers with an odd number of divisors? [/spoiler]

This can be thought of as:

[spoiler] If p is a prime, then how many factors does p^n have?[/spoiler]
[spoiler] If A and B are relatively prime, then the number of factors of A times the number of factors of B = the number of factors of A B (why? Try it out for 2^3 3^3 to see what’s going on) [/spoiler]

4. ### dfollett76 said,

March 8, 2009 at 12:08 pm