As the academic year starts up again, we’ll be hearing a lot about those schools that work miracles in unforgiving places: educational outliers that manage to produce college-bound graduates despite the poverty, crime and drugs that dominate the neighborhoods around them. But what about those schools that start out lucky, full of students from prosperous, educated families? It turns out that these schools have their outliers, too. According to a new study, even among schools that are “demographically similar” in their affluence, a small handful produce superstar students at a much higher-than-expected rate.

The authors of the study, Glenn Ellison and Ashley Swanson of MIT, identified the high-flying schools by analyzing data from the American Mathematics Competition (AMC), an annual contest in which more than 100,000 U.S. high school students participate. In their study of more than 2,000 schools that sent students to the AMC, Ellison and Swanson found “large differences among seemingly similar schools” and concluded that high-achieving students are “very far from evenly distributed.” Four percent of the schools the authors looked at produced top math students at a rate at least three times the average of all schools studied, and two percent boasted a rate five times the average. A very few were churning out math phenoms at a rate 10 times the average.

Which schools were the math powerhouses? Lynbrook High School in San Jose, Calif., Naperville North High School in Naperville, Ill., Vestavia Hills High School in Vestavia, Ala., H.M. Gunn High School in Palo Alto, Calif., and New Trier High School in Winnetka, Ill. lead the list of those schools producing an exceptional numbers of high-scorers, as reported in Education Week. (Because all the schools the authors examined were public, and none were magnet or charter schools, elite private schools and selective public schools, like New York’s Stuyvesant High School and Massachusetts’s Boston Latin, were excluded from the analysis.)

What the study shows, Ellison and Swanson suggest, is that a school’s expectations and environment matter even for students who arrive with every advantage. The difference seems to lie in whether a school focuses on basic competence or encourages exceptional achievement. While almost all the schools saw it as their responsibility to cover the math knowledge necessary to do well on the SATs, the authors noted that “there is much less uniformity in whether schools encourage gifted students to develop more advanced problem solving skills and reach the higher level of mastery of high school mathematics.”

Among high-functioning schools, the communities created around learning also make a difference. Math teams and clubs that operate outside the classroom provide an important opportunity for students to excel — and this may be especially true for girls. An earlier study by Ellison and Swanson found that while boys who qualified for elite math competitions came from a broad range of schools all over the country, the majority of the girls chosen for such contests came from only about 20 schools. The support and camaraderie found among the budding mathematicians at these schools may be particularly critical for female students, who must push back against the cultural stereotype that girls aren’t good at math.

The fact that the highest achieving girls in the U.S. are concentrated in a very small set of schools, the authors write, indicates “that almost all girls with the ability to reach high math achievement levels are not doing so.” Indeed, observe Ellison and Swanson in their most recent paper, “Our results suggest that the high-achieving math students we see today in U.S. high schools may be just a small fraction of the number of students who have the potential to reach such levels.” It’s time we fully tapped this talent.