Earlier today I set you three puzzles that were interview questions at Paypal, the online payments company ran by a group of billionaire tech bros – Elon Musk, Peter Thiel, and David Sacks – now better known for their right wing politics. Here they are again with solutions.
1. Divide and conquer
Whole numbers either have an odd number of unique divisors or an even number. Which whole numbers have an odd number of divisors?
[A divisor of Z is a number that divides into Z. For example, the divisors of 24 are 1, 2, 3, 4, 6, 8, 12, 24. There are thus eight unique divisors of 24.]
Solution: The square numbers: 1, 4, 9, 16, 25,…
Outline proof: Let Z be a whole number, and D be a divisor of Z. If D is a divisor, then there is another divisor D* such that D x D* = Z. In the example of Z = 24, if D = 2, then D* = 12.
We can pair off each divisor D with its complement D*. All whole numbers therefore have an even number of divisors, unless the number is square, since in this case there is a divisor D = D*. The question asked for unique divisors. If D = D*, we only count D once when counting divosors. So the total number of divisors for a square number will be an even number + 1, i.e an odd number.
2. Rope-a-dope
There are two ropes each of which’s density varies along its length such that they burn at different rates at different positions along their lengths, but each takes one hour to burn fully. How would you use the two ropes to measure 45 minutes?
Solution: Light both ends of one rope, and one end of the other at the same time. The burning ends of the first rope will meet after half an hour. At this moment, there will be half an hour’s left of burn on the second rope, so light its second end. When the two burning ends of the second rope meet another 15 minutes will have elapsed, making a total of 45 minutes since the start.
3. Coin conundrum
There is a circular table of unspecified diameter. You and your opponent have a supply of identically-sized coins. The game is for you each to place a coin on the table in turn. No coin can be moved after placing and no coin can be placed wholly or partially on top of another. The first player unable to place a coin loses. What is your strategy to ensure you win?
Solution:
You go first and you place your coin in the centre of the table. When your opponent places a coin on the table, you place it in the position exactly opposite (i.e rotated 180 degrees around the table centre). There will always be a space in that position. Eventually, your opponent will run out of space.
These puzzles are abridged from The Founders by Jimmy Soni, a book about the Paypal Mafia – the tech bros associated with the online payments company.
I hope you enjoyed today’s puzzles. I’ll be back in two weeks.
I’ve been setting a puzzle here on alternate Mondays since 2015. I’m always on the look-out for great puzzles. If you would like to suggest one, email me.