## Squaring a triangle

Posted on: March 1st, 2014 by
5

A triangle is formed by arranging 1+3+5+7+...(2n-1) = n^2 coins as shown in the figure below.

What is the minimum number of coins that you need to move so that you can form a square that uses all the coins?

- via Algorithmic puzzles

#### 5 Responses to Squaring a triangle

If the nth row has 2n-1 coins in it you need to move 2n-2 coins. Keep the central coin in the row fixed and fill in all the holes with the remaining ones in the nth row. (The cental coin and the apex will be the endpoints of a diagonal of the square formed.

You can do faster if you make a square which is rotated 45 degrees from horizontal.

Click for Solution.

The right answer depends on your interpretation of what it means to use all the coins to form a square, but the solution I have moves $\lfloor {n\over 2}\rfloor\times \lfloor {n\over 2}\rfloor$ coins as shown in the figure below. '+' indicates a coin placed at that location and '-' indicates a coin removed from that location. '.' indicates an unmoved coin. It will be interesting to see your detailed explanation.