“The place is like a castle in the jungle, remarkable in that it’s managed to be quite free of government restrictions,” said Stephen Smale, 84, a professor emeritus at the University of California, Berkeley, who spent time at the institute in 1960 doing research in Rio that led to his own Fields Medal in 1966. In a reflection of the ties that the institute has forged with top universities around the world, Mr. Smale noted that his doctoral students at Berkeley included Jacob Palis, a former director of the institute, and César Camacho, its current director.

The compound, built in the late 1970s and early ’80s with heavy amounts of reinforced concrete, in a nod to the somber architectural styles prevailing during Brazil’s military dictatorship, has a vibe that is at once laid-back and intense.

The students who come to study here, some of whom wander the halls in shorts and flip-flops, exude a nerdy style like that of the code writers on “Silicon Valley,” the HBO comedy series. Much of the institute, known as IMPA, is eerily quiet, as the scholars within its confines explore the boundaries of mathematics and pure reason, often without focusing on how their knowledge can be used in the real world.

“IMPA is an extremely demanding environment,” said Inocencio Ortiz, 29, a Paraguayan doctoral student clad in a Led Zeppelin T-shirt. “But it’s worth it since a degree from here brings with it prestige and strong chances of getting a job in mathematics in Brazil or elsewhere.”

In recent years, the institute, which recruits promising math students into its programs while some are still in high school (as it did with Mr. Ávila, the Fields recipient), has maintained a publication rate among its faculty that compares favorably with large American universities like Princeton and Stanford, according to the American Mathematical Society.