The Martian is probably the most fun you will ever have watching a bunch of nerds solve math problems.

From its very first scene, when a team of NASA astronauts on a mission to Mars must make an emergency evacuation ahead of a violent dust storm, character and story take a backseat to problem solving. One of the crew, botanist Mark Watney (Matt Damon), gets struck by debris on the way to their spaceship; presumed dead, he’s left behind. But Mark survives, and then must figure out how to live alone on Mars with limited supplies — possibly for years — until a rescue can be mounted. As Mark himself says later, at that point he had two choices: He could give up or he could get to work solving problems. If he solves enough of them, he gets to go home.

Lucky for Mark, he’s a bit of a genius. The Martian, which is directed by Ridley Scott and based on a best-selling novel by Andy Weir, has drawn comparisons to Cast Away, the 2000 film about Tom Hanks struggling to survive alone on a desert island, but that’s not quite right. Hanks’ Cast Away character was a regular guy; just figuring out how to start a fire was a huge struggle. The Martian is more like Cast Away if the Tom Hanks character was played by Bear Grylls.

In addition to his botany skills, Mark seems to be an expert in physics, geometry, cartography, electrical engineering, computer hacking, and even performing emergency surgery on himself. Stranded millions of miles of home, faced with an impossibly bleak situation, forced to grow food in a desolate landscape and find water on a planet that has none, he barely breaks a sweat. That’s not to say an astronaut in Mark’s position wouldn’t be this resourceful — but watching someone this resourceful is less dramatic than watching an average person in a similar situation. Mark’s brilliance is what makes the movie work; without it, his character would die instantly. But his brilliance is also what keeps the movie from working even more than it does.

Mark’s experiences on Mars — which are stunningly visualized by cinematographer Dariusz Wolski and an army of visual effects artists — are cross-cut with the efforts of the NASA administrators and scientists back on Earth who are trying to rescue him. Director Teddy Sanders (Jeff Daniels) worries that if the rest of Mark’s crew (played by Jessica Chastain, Kate MaraMichael Peña, Sebastian Stan, and Aksel Hennie) learn he’s still alive they won’t be able to complete the rest of their mission; his subordinates Vincent Kapoor (Chiwetel Ejiofor) and Mitch Henderson (Sean Bean) disagree and fight to change his mind. The rest of the supporting cast is peppered with comic actors: Kristen Wiig plays NASA’s head of public relations; Donald Glover plays an astrodynamics expert; Peña is the Martian crew’s pilot. Their presence (and the frequent wisecracks provided by screenwriter Drew Goddard) keep The Martian from ever getting too dark, even when Mark’s predicament starts to look grim.

But maybe a bit more gravitas wouldn’t have hurt. Blessed with reams of sassy Goddard dialogue, Damon’s performance is all charm. The only man onscreen for long stretches of The Martian, Damon holds the viewer’s attention as effortlessly as Mark harvests space potatoes. He’s incredibly endearing and every bit a movie star, but his character seems so unfazed by predicament that The Martian never turns into a real nail-biter. It’s fun to watch as he figures out how to plant crops in Mars’ barren soil, and extend the battery life of a rover dozens of times beyond its maximum range. But he’s so smart and capable, none of his quests become particularly suspenseful. Even against the longest odds any man has ever faced for survival, there’s never one single second where it seems like Mark might actually die on Mars.

On the other hand, the best thing about The Martian might be the fact that Scott and Goddard don’t introduce a sneering government bureaucrat to inject some artificial tension or bemoan the enormous financial resources expended to save the life of one man. The Martian simply takes space exploration as an essential public good. Practical matters like budgets and politics barely come up; the entire scenario’s recurring themes of teamwork and selflessness serve to remind audiences of what’s possible when people refuse to succumb to despair, and work together to achieve a common goal. All of that’s admirable and quite enjoyable — even if its series of scientific brain teasers never quite congeals into much more than an incredible beautiful episode of MacGyver set on Mars.