Miodrag Milenkovic wrote: > There's an integer on each vertex of the pentagon. If there is a > negative integer, y on one of the vertices, flanked by x and z, > replace x, y, z by x+y, -y, z+y. Sum of all the numbers on the > pentagon is > 0. If there is more than one negative number, pick > whichever one you want. Does this procedure have to end?
First, here's an implementation of the above logic: negsel=: [:(=>:@[EMAIL PROTECTED]:@(-.&0))[:(*+/\) <&0 upd=: ] + ((1&|. + _2&* + _1&|.)@:* negsel) seq=: upd^:a:^:(0<+/) Second, note that the sum of the five numbers is always the same, both before and after the transformation. Third, for the procedure to not end, either: (a) It must be possible to reach the starting state after at least one step, or (b) The sequence must diverge with values approaching infinity. I think neither is possible. Each step in the process disperses the negative values, away from their original position. So some of this negativity must eventually collide with a positive value. Since this dispersion effect always centers on a negative value, some capability is lost every time negativeness combines with a positive value. There's probably a more formal way of expressing this, but essentially this means that values cannot diverge towards infinity, and that states are not repeated. -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
