# Puzzle | Heads or Tails

50 coins are lined up on a table (initially all heads facing upwards). 50 people pass from the coins one by one in the following manner:

The first person comes and visit the coins numbered 1, 2, 3, 4, …. and flips the coins until an opposite face comes(For ex-if it was head initially, he/she flips it until tail comes and vice versa.)

The second person comes and visits the coins numbered 2, 4, 6, 8….. and flips the coins.

Similarly, the third person comes and visits (3, 6, 9, 12, ……) and does the same.

The task is to find the final states of all the coins after 50th person passes i.e. whether a coin is facing heads or tails upwards?

**Solution:** The trick is to identify if a coin is being visited by people even or odd number of times.

Pay attention on the coin number.

Only perfect squares have odd no. of factors, and every other number has even number of factors.

For all those coins which have odd number of factors will be facing tails upwards and for all those coins which have even no. of factors will be facing heads upwards.

So, coins numbered 1, 4, 9, 16, 25…. will have tails and 2, 3, 5, 6, 7, 10, 11, … will have heads facing upwards.

## Recommended Posts:

- Puzzle 43 | Muddy Heads
- Puzzle | Can 2 persons be with same number of hairs on their heads?
- Expected number of coin flips to get two heads in a row?
- Puzzle 51| Cheryl’s Birthday Puzzle and Solution
- Puzzle 15 | (Camel and Banana Puzzle)
- Puzzle 81 | 100 people in a circle with gun puzzle
- Puzzle 85 | Chain Link Puzzle
- Puzzle | 3 Priests and 3 devils Puzzle
- Puzzle 34 | (Prisoner and Policeman Puzzle)
- Puzzle 39 | (100 coins puzzle)
- Puzzle 24 | (10 Coins Puzzle)
- Puzzle 28 | (Newspaper Puzzle)
- Puzzle 36 | (Matchstick Puzzle)
- Puzzle 33 | ( Rs 500 Note Puzzle )
- Puzzle | Elevator Puzzle

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.