A similar anecdote about Turing appears in Neal Stephenson's "Cryptonomicon", except without the clever solution or the "absent-minded professor" stereotype.
A student came up to Von Neumann on campus and decided to prank the great scientist. "Two trains are on the same track 50 miles apart and they hurtle towards each other at 50 mph. As they start, a really fast fly on the nose of one train flies towards th eother at 60mph. When it reaches the other train it immediately flies back to the first, then back to the second, and so on until the fly is crushed in the crash. How far will the fly fly?
Von Neumann thought for a moment, and then replied, "30 miles!" The student grinned. "I thought you'd know this one! The trains take half an hour to hit each other, therefore the fly will fly 30 miles."
Von Neumann started. "I didn't think of that, I summed the series."
———
Source: "The Prisoner's Dilemma" by William Poundstone
A tennis match between two players, A and B, has finished. You are given the complete sequence of points played, in order. Each point is recorded as the letter of the player who won it.
Write a program that reads this sequence and works out which player won the match.
there are multiple ways to compute this but not obvious way is to look at the end of the list and see who scored last point.
Yes, and this (knowing a priori how tennis in particular is scored being useful for solving a problem) is the exact example that gets used as to why the SAT used to be somewhat biased in favor of people with the "right" background/upbringing/culture.
A student came up to Von Neumann on campus and decided to prank the great scientist. "Two trains are on the same track 50 miles apart and they hurtle towards each other at 50 mph. As they start, a really fast fly on the nose of one train flies towards th eother at 60mph. When it reaches the other train it immediately flies back to the first, then back to the second, and so on until the fly is crushed in the crash. How far will the fly fly?
Von Neumann thought for a moment, and then replied, "30 miles!" The student grinned. "I thought you'd know this one! The trains take half an hour to hit each other, therefore the fly will fly 30 miles."
Von Neumann started. "I didn't think of that, I summed the series."
———
Source: "The Prisoner's Dilemma" by William Poundstone
https://archive.org/details/prisonersdilemma0000poun