This is a classic type of puzzle from Henry Dudeney.
“This is a rough sketch of the finish of a race up a staircase in which three men took part. Ackworth, who is leading, went up three steps at a time, as arranged; Barnden, the second man, went four steps at a time, and Croft, who is last, went five at a time. Undoubtedly Ackworth wins. But the point is, how many steps are there in the stairs, counting the top landing as a step?
I have only shown the top of the stairs. There may be scores, or hundreds, of steps below the line. It was not necessary to draw them, as I only wanted to show the finish. But it is possible to tell from the evidence the fewest possible steps in that staircase. Can you do it?”
See the Staircase Race