The small Romanian town of Busteni is known for its skiing and stunning sights. But for some, the sight of 147 teenaged girls doing math in the main hall of the town’s Sports Hall earlier this April may be even more stunning. Aren’t girls supposed to hate math? Or at least, as Barbie once told us, find it “tough”?

Not these girls. Thirty nine teams from 39 countries, including the United States, Ecuador, Russia, and the United Kingdom, participated in this year’s European Girls Math Olympiad, up from 30 teams in 2015. This is an encouraging development, considering the week-long Olympiad, which started in 2012, was intended to encourage more girls to participate in math competitions in the first place, said Geoff Smith, the mathematics professor at the University of Bath who came up with the idea.

“There’s a problem in international mathematics competitions that the proportion of girls participating is very low,” Smith said, noting that it’s particularly low at world championships such as the International Math Olympiad, where only one in 10 contestants are female and many teams have no girls at all. (Last year’s Team USA, which took gold for the first time in 21 years, was all male.)

Smith noticed that, once China started having an annual contest only for girls in 2002, the country began adding girls to its co-ed international team. While he hesitates to say this was the direct cause, he decided it might be a good idea for European girls to have their own Olympiad, too—one whose questions would be just as challenging as those at male-dominated events.

But not everyone loved the idea. “Some were doubtful and suspicious, some were enthusiastic,” he said. “There are two ways to view the separate competition for girls. One is that it’s a feminist act attempting to promote opportunities for young women with a view to eventually the competition abolishing itself because it would have achieved its goals. The other is that it’s an insult to women because it says that the girls are simply not strong enough to get into the open competitions.”

But many women who have actually participated in the European Girls Math Olympiad disagree. Jenny Iglesias, the leading coach for this year’s Team USA, sees it as an opportunity for girls who enjoy math to not just gain vital competition experience, which increases their confidence to try other events, but also network, mingle, and “not to be the only girl in the room.” Iglesias, who is working on her math doctorate at Carnegie Mellon University, participated in the Chinese Girls Math Olympiad, and got a lot out of it, including a chance to travel.

But if the European Olympiad’s growing popularity is a sign that girls are, indeed, interested in math competitions, why does the gender gap remain at the International Olympiad? A 2009 study on gender and math competitions by the economists Glenn Ellison and Ashley Swanson found fewer American girls than boys took the exams needed to qualify for events like the International Olympiad. Also, the girls who did take those exams most came from small group of elite schools; the boys, meanwhile, were from all over, leading the authors to conclude that most schools are failing to encourage girls in math.

Only one in five test-takers who scored 100 points on American Math Contest 12, the most difficult exam, were female. Scores above that (a perfect score is 150, or 25 questions worth six points each ) showed an even bigger gap, with only one out of 10 coming from a girl. While the authors cited systemic sexism and stereotype threat as possible reasons—and rejected Larry Summers’s infamous “innate” differences argument—they refused to make any definite conclusions, saying the field needed “more study.”

* * *

This, said Maria Charles, a sociology professor at UC Santa Barbara who has studied the math gender gap globally, may have a lot to do with the educational culture in the U.S., which emphasizes personal growth over practical pursuits. “One thing that changes in very affluent societies is that our understanding of the nature and purpose of careers and education changes from being more practical, an investment in material security, to self-expression,” Charles said.

For more than a century, the country has embraced progressive education, which encourages students to pursue their individual passions. But the general population’s lack of interest in STEM, and its ingrained math phobia, may be due to the fact that even before the progressives existed, this country did not have a strong math culture. The European settlers who established the first schools were far more focused on literacy for the good of one’s soul than on numeracy. Math was seen as necessary only for practical tasks, and it wouldn’t be until the 19th century that the U.S. produced its first internationally renowned mathematician—the Harvard professor Benjamin Peirce. (Speaking of Harvard: It didn’t appoint a math professor until almost a century after its founding—a professor who, perhaps tellingly, was a “confirmed drunkard.”) Interest in the subject increased in the 19th century as the Industrial Revolution took hold, but it would take another century for American mathematicians to really encroach on the world stage.

Charles found that, when given the choice to pursue one’s educational passions, girls today in industrialized countries like the U.S. all too often rely on gender stereotypes that say math is for boys—stereotypes that start as early as second grade—because they are still learning about themselves . Many girls lose confidence in their math abilities in middle school.

“If you [ask] a young girl, ‘what do you want to do?’ most don’t know what they want to do, what they enjoy, what they’re going to be really good at,” Charles said. That makes it easy to absorb stereotypes,” according to Charles, as opposed to in poorer countries where girls are encouraged to at least try math because a STEM career pays better and will increase the family’s coffers.

This also appears to be the case in certain populations in the U.S. immigrants from China, India, South Korea, Japan, and Iran, to name a few, tend to encourage their girls into mathematical professions, like STEM or medicine, particularly if their children are first-generation citizens.

Where the U.S.’s stereotypes about girls come from, however, is interesting, because they’ve changed, even in the last 60 years. In her article, “What Gender is Science?” Charles writes that more 19th-century girls took physics, astronomy, and chemistry classes than boys, because it was good training for housework and was seen as requiring less capacity for higher reasoning than the humanities.

In the early 20th century, arithmetic and coding were considered menial clerical tasks, which is why so many of the “human computers” and computer coders were often female. These fields finally became male-dominated starting in the ‘50s, when they became lucrative. This makes sense, since the Space Race and the Cold War both led to a massive tech boom. Silicon Valley’s rise in the ‘70s and ‘80s further cemented the computer tech field as a brilliant boys’ club.

But when trying to solve the math gender gap in this and other countries, it may be most useful to look at the girls who didn’t absorb the stereotypes, like Iglesias, the European Olympiad’s Team USA coach;  Sherry Gong, a doctoral student at MIT who also coaches the team; and two of its competitors, Celine Liang and Demi Guo, both high-school seniors from California. All four have at least one parent who works in a STEM or medical field. And all four say they were encouraged by teachers, at different school levels, to pursue math competitions. These factors have been shown to make a difference when it comes to encouraging students to pursue STEM.

And then there’s self-confidence. “It would be a little disappointing when you can’t do a problem, but don’t be discouraged if you can’t do a problem,” Liang said, directing her advice at middle-schoolers.

But confidence can waver even in the most dedicated. Gong, who in 2007 was the second American girl in International Math Olympiad history to get the gold medal, recalled getting a pep talk during a competition from her coach, Melanie Wood (who was the first American girl to ever get on Team USA). “I thought I was doing really badly, but ... she said girls tend to underestimate how well they are doing,” Gong said.

And while current participants hope the U.S. team will continue competing in the European Girls Math Olympiad for years to come, these young mathematicians aren’t dismayed by the thought of a future where it isn’t needed.

“It’s a good thing to have a chance for more girls,” Guo said. “It’s necessary for now because there aren’t other alternatives.”