Teams fill the gym, ready to begin the game. A colorful maze covers the floor. The buzzer sounds, and kids race to a table to grab cards. They dash back to their teams to solve math problems that will lead them through the maze.

The game is called Flagway. Bob Moses, an educator and civil rights activist, invented the game in 1992 to get kids to get physically active with math. “You can take math problems and just adding movement makes it a game,” says Maisha Moses, the inventor’s daughter. She heads the Young People’s Project, which runs Flagway competitions nationally.

Flagway’s math is modeled after the Möbius function, which helps mathematicians study integers, or whole numbers. In Flagway teams find the prime factors of the numbers on cards, called flags. A number’s prime factors are the prime numbers that you multiply together to get that number.

First you grab a flag and factor the numbers on it. Next you match colors to each number based on its prime factors. Then, it’s time to get moving! The colors are a code for how to navigate the maze’s pathways.

After you run your path, you place your flag at the path’s endpoint. Then start over again. The buzzer sounds when the round is done, and referees check your math. Your team earns points for every flag you code correctly. The team with the most points after several rounds wins.

The game doesn’t just help students practice math skills. In many math classes, students work independently. But in Flagway, they work as a team to solve problems and see how they can improve, says Raphael Bonhomme. He’s a math teacher at Turner Elementary School in Washington, D.C. His team of fifth-graders competed at the third national Flagway tournament, in Washington, D.C., in May.

Bonhomme’s team started playing Flagway only a few months before the tournament. Unfortunately, the team came in ninth place. But that didn’t stop Jakobe Stallworth, 10, from having a good time. His advice to aspiring mathletes: “Even if you lose, don’t give up, because you can have fun while losing or winning.”

Teams fill the gym. A colorful maze covers the floor. A unique game is about to start! The buzzer sounds, and kids race to a table to grab cards. They dash back to their teams. Solving the math problems on the cards will lead them through the maze.

The game is called Flagway. Bob Moses, an educator and civil rights activist, invented it in 1992. He wanted to mix math and physical activity. “You can take math problems and just adding movement makes it a game,” says Maisha Moses, Bob’s daughter. She heads the Young People’s Project, which runs national Flagway competitions.

The math in Flagway is based on the Möbius function. That’s a function that helps mathematicians study integers, or whole numbers. In Flagway, teams pick up “flags,” or cards, with numbers on them. Each team races to find the prime factors of the numbers on a flag. A number’s prime factors are the prime numbers that you can multiply together to get that number.

Once you find the factors, you use them to solve a puzzle. You match colors to each number based on what its prime factors are. Then it’s time to get moving! The colors are a code for how to navigate through the maze on the floor.

You run through the maze along the path your team calculated. Then you place your flag at the end of the path. Next, you grab a new flag and start over. The buzzer sounds when the round is done.

Referees check your math. Your team earns points for every flag you placed correctly. The team with the most points after several rounds wins!

The game doesn’t just help students practice math skills. It also helps them work together. In many math classes, students work by themselves. But in Flagway, they have to solve problems as a team, says Raphael Bonhomme. He’s a math teacher at Turner Elementary School in Washington, D.C. His team of fifth-graders competed at the national Flagway tournament in Washington, D.C., in May.

Bonhomme’s team started playing Flagway only a few months before the tournament. Unfortunately, the team came in ninth place. That didn’t stop Jakobe Stallworth, 10, from having a good time. He has some advice for potential mathletes: “Even if you lose, don’t give up, because you can have fun while losing or winning.”