For a triangle with five rows is it four?

Imagine a triangle of coins on a table so that the first row has one coin in it and the second row has two coins in it and so on. If you can only move one coin at a time, how many moves does it take to make the triangle point the other way?

For a triangle with two row it is one, for a triangle with three rows it is two, for a triangle with four rows it is three.

For a triangle with five rows is it four?

Answer

It takes 5 moves to make the triangle with 5 rows point the other way.

0 = a coin that has not been moved.
X = the old position of the moved coin
8 = the new position of the moved coin.

________X
_______X X
____8 0 0 0 8
_____0 0 0 0
____X 0 0 0 X
_______8 8
________8


For triangle of any number of rows, the optimal number of moves can be achieved by moving the vertically symmetrical coins i.e. by moving same number of coins from bottom left and right, and remaining coins from the top.


For a triangle with an odd number of rows, the total moves require are :
(N2/4) - (N-4) Where N = 4, 6, 8, 10, ...

For a triangle with even number of rows, the total moves require are :
((N2-1)/4) - (N-4) Where N = 5, 7, 9, 11, ...

No comments:

Your Title

My Blog List