The is a full analysis - about a chapters worth if I recall! - about exactly this problem in one of Martin Gardner's books. I believe it is called "Mathematical Puzzles and Diversions". Amongst other things, he discusses some of the mistakes people often make trying to solve this puzzle.