Enigmatic Code

Programming Enigma Puzzles

BrainTwister #24: Coin flips

From New Scientist #3495, 15th June 2024 [link] [link]

We can flip this triangle made of coins, from one pointing upwards to one pointing downwards, by moving three of the coins (coloured dark blue), as shown in the image below:

However, it is also possible to flip this triangle upside down by moving two coins. Can you find a way?

What about a triangle with four rows? What is the fewest number of coin moves needed to flip that triangle upside down?

How about bigger triangles? Is there a general rule?

[braintwister24]

9 responses to “BrainTwister #24: Coin flips

  1. Jim Randell 15 June 2024 at 7:36 am

    If we superimpose a red version and a green version of the two triangular arrangements, we can look for a maximal overlap.

    So, by relocating the green circles to occupy the positions of the red circles we can invert the arrangement by moving just 2 circles.


    With four rows we can achieve the following overlap.

    Which means we invert the arrangement by relocating 3 circles.


    For 5 rows:

    Which involves the relocation of 5 circles.

    And for 6 rows:

    Which involves the relocation of 7 circles.

    And 7 rows involves the relocation of 9 circles (three groups of 3).

    And we see a pattern emerging. At each stage we are relocating a triangular section that is one row larger than the previous stage so:

    n = 3 → tri(0) + tri(1) + tri(1) = 2
    n = 4 → tri(1) + tri(1) + tri(1) = 3
    n = 5 → tri(1) + tri(1) + tri(2) = 5
    n = 6 → tri(1) + tri(2) + tri(2) = 7
    n = 7 → tri(2) + tri(2) + tri(2) = 9
    n = 8 → tri(2) + tri(2) + tri(3) = 12
    n = 9 → tri(2) + tri(3) + tri(3) = 15
    n = 10 → tri(3) + tri(3) + tri(3) = 18

    n = k → tri(floor((k − 1)/3)) + tri(floor(k/3)) + tri(floor((k + 1)/3))
    n = k → floor(k(k + 1)/6)

    See also: OEIS A001840 [@oeis].

  2. Hugo 15 June 2024 at 10:50 am

    For a triangle of (n + 1) rows, sum n + (n – 3) + (n – 6) + . . . ,
    taking only positive terms.

  3. alkisp 15 June 2024 at 12:28 pm

    Re “by moving three of the coins (coloured dark blue)”:
    Three points are all there is! What happened to “all” or just “the”? 😀

    Then, what is the solution with moving only two coins? It seems quite impossible …

    • Lise Andreasen 15 June 2024 at 3:12 pm

      Moving 3 coins: move the blue coins from above the yellow coins to below the yellow coins.

      Moving 2 coins: The brown coins don’t move. The 2 remaining coins can be in either the green or the red positions.

    • Jim Randell 15 June 2024 at 4:11 pm

      @alkisp: Don’t worry about the different colours. They are just to indicate positions. The coins are all identical.

      The problem is to move some of the coins such that an upward pointing triangular arrangement becomes a downward pointing triangle.

      • alkisp 16 June 2024 at 7:43 pm

        Who cares about colors, @Jim Randell? I’m talking only about numbers.

        Then, I know what the problem is, @Jim Randell!
        What I asked was about the solution of moving two coins.

        What’s with you, today?

  4. Jim Randell 21 June 2024 at 2:47 pm

    Here is the published solution [link].

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.