Sunday Times Teaser 3338 – Any Way But Back
by Howard Williams
Published Sunday September 13 2026 (link)
For her research on insect migration, Sophie has constructed a rectangular flat box in which insects travel from the SW corner to the NE corner. Inside are obstacles, arranged in rows and columns running from West to East and South to North, that the insects have to travel around, moving North or East, or (via a tunnel) diagonally through, moving NE. On each obstacle there is the option of closing the tunnel.
The total number of possible pathways across the box, with all tunnels open, is too big for Sophie’s purposes, but closing just one of the obstacles’ diagonal passages reduces the total number of possible routes by seven eighty-ninths.
What is the smallest number of obstacles that can be in the box?
A mixture of Brian’s and Jim’s ideas.
I also tested your approach to computing D(m.n) but it didn’t make any difference to the speed on CPython. For reasons I don’t yet understand, your nc loop fails in my version.