In “21,” an M.I.T. math whiz joins a secret cabal of card-counters who fly to Vegas on the weekends to make a killing at the blackjack tables. That’s the hook, the part you might not have seen in a thousand other films. But the rest is as generic as the title (“21”? Really? That’s the best you could come up with?), a story about a nobody who becomes a somebody, forsakes his friends, and learns What’s Really Important.

Yawn is right. This is a prime example of a movie that isn’t bad, per se, just unnecessary, a competently made but wholly unremarkable trifle. It trades exclusively in cliches and stock characters — and yet, strangely, director Robert Luketic (“Legally Blonde”) seems to believe he has made something compelling and original. And I have to think, if I’VE seen lots of movies exactly like this one, then shouldn’t Luketic have done so as well?

Based apparently rather loosely on a true story, “21” begins with Ben Campbell (Jim Sturgess), an upstanding, Boston-bred, good-to-his-mother math nerd, trying to win a scholarship to Harvard medical school. Without the free ride, he has no hope of paying the $300,000 his post-secondary education will cost him. In the meantime, he works for $8 an hour at a men’s clothing store and finishes out his senior year at M.I.T., working on robotics projects with his dumpy comic-relief buddies.

After making a dazzling observation in an advanced math class, Ben is summoned by the professor, Mickey Rosa (Kevin Spacey), to a clandestine meeting. Led by Professor Rosa (but please, call him Mickey), a small group of students has mastered the science of counting cards, accurately working the probability statistics to all but ensure a win every time they play blackjack. It’s not illegal to count cards, and by most standards not even immoral or unethical. Of course, the casinos frown on it, but the nice thing about Mickey’s system of decoys and code words is that it’s practically undetectable!

Ben refuses to get involved, of course, then reconsiders after realizing he has no other way to pay for med school … and also after being flirted with by Jill (Kate Bosworth), the pretty girl on Mickey’s team. (I have to say, he’s an awfully easy mark. If you ever need someone to help you execute an ill-advised get-rich-quick scheme, target Ben Campbell, as he will put up almost no resistance.) The rest of the squad comprises jealous loose cannon Fisher (Jacob Pitts), kleptomaniac goofball Choi (Aaron Yoo), and nondescript Kianna (Liza Lapira).

The film, written by Peter Steinfeld and Allan Loeb and based on Ben Mezrich’s book, stalls for a while in the middle, with Ben and the crew having achieved unprecedented success in Vegas on the weekends while maintaining their ordinary, boring lives in Boston the rest of the week. Ben likes being a big-shot in Sin City, wishes he could be that guy 24/7. He puts the moves on Jill, whose affections for him waver frequently and without apparent provocation. He earns the trust and respect of Mickey. And meanwhile, a loss prevention expert named Cole Williams (Laurence Fishburne) watches the security tapes and tries to figure out why certain casinos are taking such big hits at the blackjack tables every Friday and Saturday night.

When the twists start to come in the final act, it’s enough to give the film a boost of energy but not enough to turn it into anything special. Jim Sturgess, recently seen in “Across the Universe” and here affecting an inconsistent American accent, could be a charismatic leading man if the story didn’t require him to make so many dumb decisions (what, there are no banks in Boston to store your huge piles of cash?) and just generally be a sap. Kevin Spacey, though, can use his snaky charm to sell almost anything, even a trite old tale like this one. I’d rather see a movie about his character.

C+ (1 hr., 58 min.; PG-13, a little profanity, brief partial nudity, some mild sexuality, a little violence.)