Imagine you have 8 coins of equal weight, except for one. The odd one weighs less than the others because it is not made of pure gold. How many iterations are needed to find this counterfeit coin using a two plate scale?
Write a function that represents this logic puzzle and returns the minimum number of weightings it will take to measure n coins, without relying on luck at all. It can help to think recursively.
Good luck, have fun!
Want to propose a challenge idea for a future post? Email firstname.lastname@example.org with your suggestions!