The following puzzle/trick came up on Futility Closet, one of my favourite sites for recreations. Here’s how they describe it:

Arrange cards with values ace through 9 in a row, in counting order, with the ace on the left.

Take up a card from one end of the row — left or right, your choice.

Do this twice more, each time taking up the leftmost or the rightmost card in the remaining row.

When you have three cards, add their values and divide the total by six. Count the cards that remain on the table from left to right.

The card in the nth position will be the 4.

Naturally, I wanted to understand: why?

In fact, there were two whys: why is card 4 in the given position, and why is the number of picked-up cards divisible by six?

This puzzle isn’t too hard to brute-force – there are only four possible ways to pick three cards from the ends as described:

  • A-2-3 (summing to 6; divide by 6 to get 1; the 4 is in first position

  • A-2-9 (summing to 12; divide by 6 to get 2; the 4 is in second position

  • A-8-9 (summing to 18; divide by 6 to get 3; the 4 is in third position

  • 7-8-9 (summing to 24; divide by 6 to get 4; the 4 is in fourth position

That the three cards always have a sum divisible by six isn’t too surprising – the sum of any three consecutive numbers is a multiple of three, and since there must be two odd and one even card picked up, their sum also has to be even.

The trick itself comes from a pattern you might have spotted in the answer there: each card you take from the end of the row adds six to the total, compared to taking one from the beginning. (If you took one card in the same pattern, the difference would be 8; taking two cards, your total is seven more for each card you take from the end.)

The ‘base case’ of taking three cards from the left clearly leaves card 4 in the first position. Taking one card from the end instead of the beginning nudges the total up by 6, and pushes 4 forward one place – and similarly for every extra card you take from the end.

I believe the trick would work for any odd multiple of 3 (assuming your cards go high enough). Rather than dividing by 6 in general, you’d divide by (number of cards - 3).