Tuesday, September 30, 2014

Orbiting Logic

Colonel Tom Carpenter, during his fifth space mission, was being kept awake by the blabbering of the Cape Canaveral Control Centre operator, who offered him the following puzzle.

"Here's a deck of 52 cards, Tom. I'm taking the Aces and the Royals out of the deck. Do you copy that, Tom?"
cards riddle

"Roger," the yawning voice of the astronaut answered.

"Of the 36 remaining cards, I've drawn 5 of them. These 5 cards have the following properties:
(a) all four suits are represented here;
(b) there is no more than 2 consecutive ranks for each sequence (ie a 2 followed by a 3, or a 7 by an 8, or both, but not 2, 3, 4);
(c) the sum of the even ranks and the sum of the odd ranks produce two numbers: the difference between these two numbers is 9, but I won't specify whether it's the sum of odds being greater than the sum of evens, or viceversa.
(d) the sum of ranks of the red cards is exactly twice the sum of ranks of the black cards.
You awake, Tom?"

After a pause, Tom managed a faint "Roger."
"Ok, you should also know that:
(e) a hearts is a multiple of a clubs;
(f) the rank of a diamond is greater than that of a hearts;
(g) there are no 2 cards with the same rank.

Which cards did I draw? Tom, are you listening? Which cards have I got?"

Deduce which five cards he necessarily holds.

Orbiting Logic Puzzle Solution

During the next orbit, the sleepy but correct answer came forth from the astronaut: 2 of clubs, 5 of hearts, 7 of diamonds, 9 of spades, and 10 of hearts.

Following from (g) - no two cards are the same rank - and (b), the strongest combination (ie highest ranks) possible is 10, 9, 7, 6, 4, which adds up to 36. If we write down all combinations of 2 numbers that have a difference of 9, and a maximum sum of 36, we'll have:
  • 2, 11
  • 3, 12
  • 4, 13
  • 5, 14
  • 6, 15
  • 7, 16
  • 8, 17
  • 9, 18
  • 10,19
  • 11, 20
  • 12, 21
  • 13, 22
The number of odd ranks in the 5-card combination could be 1 or 3 (not 2 and not 4 because their sum would be an even number, and a difference of 9 between two even numbers is inexistent). If there was only 1 odd rank, then there would be 4 even ranks, and the weakest combination of evens would be 2, 4, 6, 8 which add up to 20: the difference, 9, would result in a single number, 11, which does not exist in the deck of cards (the Royals were excluded). Therefore we have 3 odd ranks. The sum of the weakest 3 odd ranks (excluding the Aces) is 15, ie 3 + 5 + 7. So, from the combinations above, we can exclude all combinations that contain an odd number less than 15. We are left with
  • 6, 15
  • 8, 17
  • 10, 19
  • 12, 21
The first one (6, 15) must be excluded because the 3 odd numbers (3, 5, 7) would be joined by the only 2 even numbers which would add up to 6 (2,4), and therefore we would have a sequence of 5 consecutive numbers, which doesn't match the constraint set by (b). We are left with 3 combinations:
  • 8, 17 (and the 5 ranks would be 2, 3, 5, 6, 9)
  • 10, 19 (and the 5 ranks would be 3, 4, 6, 7, 9)
  • 12, 21 (and the 5 ranks would be 2, 5, 7, 9, 10)
But (d) states that the sum of red cards is twice of the sum of black cards, so the first 2 combinations must be excluded, because it's not possible to find 2 sets of numbers, one of which is twice the other; therefore the 5 ranks can only be 2, 5, 7, 9, 10. The red cards must be 5, 7, 10.

Following (e), rank 2 must be clubs and 10 must be hearts, so rank 9 must be spades; following (f), rank 7 has got to be diamonds and rank 5 must be hearts.