Yes, you are right, it is 4 in that case. It seems that f is always
even. It is possible for 44 chameleons to be one color, but then there
is only one left and it cannot change to that color. Any time there
are 43 chameleons of one color, the other two are the same color.
 It is true that all the chameleons can never be the same color, but I
agree that his "proof" is not valid.
Don

On Sep 5, 9:08 pm, wujin chen <wujinchen...@gmail.com> wrote:
> hi Don, i think f(15,14,16) =|15-14|+|14-16|+|16-15| = 1+2+1=4, hou do you
> get f(15,14,16) = 5?
>
> 2011/9/6 Don <dondod...@gmail.com>
>
>
>
>
>
>
>
> > No, f(15,14,16) = 5.
> > Don
>
> > On Sep 5, 8:33 pm, wujin chen <wujinchen...@gmail.com> wrote:
> > > hi all, i encountered this puzzle (http://www.crackpuzzles.com/?p=236):
>
> > > At one point, a remote island's population of chameleons was divided as
> > > follows:
> > > - 13 red chameleons
> > > - 15 green chameleons
> > > - 17 blue chameleons
> > > Each time two different colored chameleons would meet, they would change
> > > their color to the third one. (i.e.. If green meets red, they both change
> > > their color to blue.) Is it ever possible for all chameleons to become
> > the
> > > same color? Why or why not?"
>
> > > and the solution provided by auther is like this:
> > > *Solution: *
> > > Lets define a function f(red, blue, green) = |red - blue| + |blue -
> > green| +
> > > |green - red|
> > > When two chameleons of different colours meet and convert to the third
> > one,
> > > the value of function f will always change by 0 or 3 or 6 (i.e. a
> > multiple
> > > of 3). In the initial situation f is 8.
> > > If all of them get converted into a single colour then f would be 90 =
> > > 2*(red+blue+green)
> > > So we are basically looking for a solution to the equation: 8 + 3x = 90,
> > > which has no integer solutions. Hence it is not possible.
>
> > > well, my problem is this:
>
> > > f(13,15,17)=8,
> > > f(15,14,16)=2
> > > so , we can see that " the value of function f will always change by 0 or
> > 3
> > > or 6″ is not true, i am wondering~!
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/algogeeks?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to