
Gaston Tarry (27 September 1843 – 21 June 1913) was a French mathematician. Born in Villefranche de Rouergue, Aveyron, he studied mathematics at high school before joining the civil service in Algeria. He pursued mathematics as an amateur.
In 1895 Tarry published a systematic algorithm for traversing a maze without prior knowledge of its layout; this method is now recognized in graph theory as one of the earliest variants of a depth-first search (DFS) algorithm.
Tarry also made contributions to number theory and combinatorics, including work on the Prouhet–Tarry–Escott problem.
In 1900 Tarry confirmed Leonhard Euler's conjecture that no 6×6 Graeco-Latin square was possible (the 36 officers problem).