They asked Katherine Johnson for the moon, and she gave it to them.

Wielding little more than a pencil, a slide rule and one of the finest mathematical minds in the country, Mrs. Johnson, who died at 101 on Monday at a retirement home in Newport News, Va., calculated the precise trajectories that would let Apollo 11 land on the moon in 1969 and, after Neil Armstrong’s history-making moonwalk, let it return to Earth.

A single error, she well knew, could have dire consequences for craft and crew. Her impeccable calculations had already helped plot the successful flight of Alan B. Shepard Jr., who became the first American in space when his Mercury spacecraft went aloft in 1961.

The next year, she likewise helped make it possible for John Glenn, in the Mercury vessel Friendship 7, to become the first American to orbit the Earth.

Yet throughout Mrs. Johnson’s 33 years in NASA’s Flight Research Division — the office from which the American space program sprang — and for decades afterward, almost no one knew her name.