I remember once while in graduate school at the University of Wisconsin staying at my office until 4 a.m. Stumbling through the hall bleary-eyed on my way home, I came upon a little gnome of a man who, as if it were the middle of the day, began questioning me about my results in a kindly yet most energetic way. Who should be haunting those empty halls at that hour, except janitors? I was awake enough to realize that it was Paul Erdos, one of the most curious (in both senses), prolific and insightful mathematicians of this century. It's not surprising that Erdos would often remark that a mathematician was a machine for turning coffee into theorems. Toward the end of his life he even partook of amphetamines to keep his mental machinery churning into the wee hours.

Such eccentricity in the men who study circles and numbers is only part of the story of mathematicians Erdos and John Nash, the subjects of the new biographies "My Brain Is Open," "The Man Who Loved Only Numbers" and "A Beautiful Mind." But for many, the eccentricity may be the most intriguing part.

Science writer Bruce Schechter's "My Brain Is Open" is a mathematical biography of Erdos, born in 1913 in Hungary to academic parents. Erdos was cosseted by a mother who had just lost her other two children to scarlet fever and educated by a father who early on taught him about prime numbers and infinite sets. Both influences were life-defining. In later years he related how he independently discovered the notion of negative numbers at the age of 3 but didn't butter his own toast until he was 20.

Schechter sets the background to his story by mentioning the enormous contributions of other Hungarians, among them John von Neumann, Leo Szilard and Edward Teller, to 20th century science. Most, like Erdos, were (nonobservant) Jews. He describes how the very young Erdos met regularly with his intellectual pals at Budapest's Statue of the Anonymous to discuss mathematics, an early communal habit that presaged Erdos' collaborationist approach to writing mathematical papers. Later, he would cut such a broad swath across 20th century mathematics that mathematicians all over the world refer to their "Erdos number"--1 if they collaborated with him on a paper, 2 if they collaborated with someone who collaborated with him and so on.

One of the ambitions of Schechter's book is to describe the mathematical accomplishments of this short, celibate, seemingly frail man and to integrate them into the history of mathematics (and, to an extent, of the times generally). Thus Schechter discusses the proofs of the infinitude of primes and the irrationality of the square root of 2 before bringing up Erdos' generalization of Chebyschev's theorem, which won him his doctorate as a second-year undergraduate.

As are most of the problems that Erdos considered, the theorem is easy to state. The Russian mathematician Pafnuty Lvovitch Chebyschev had shown that between any number (N) and twice the number (2N) there was always a prime number. Erdos simplified the proof and showed that (provided N is at least 7) there were always at least two primes between N and 2N and that they had certain other properties as well. His concern with clarity in a proof led him to his notion of the Book Proof, the one that revealed the essence of the matter in as elegant and transparent a manner as possible.

Although the strategy of combining details of Erdos' life and work with mathematical generalities is sometimes successful, it often makes for bumpy transitions. In a few pages the book may skip between Pythagoras, some incident in Budapest, a precocious proof by the young Carl Friedrich Gauss (a great 19th century mathematician) and an anecdote involving the wife of one of Erdos' countless hosts.

Smoother, albeit less comprehensive, "The Man Who Loved Only Numbers," by Paul Hoffman, former editor of Discover magazine, tells essentially the same story as the Schechter book. He cites many of the same informants, among them the mathematicians Andrew Vasonyi, Erdos' boyhood friend, and Ron Graham, his de facto steward and friend.

The considerable appeal of both these books derives in large part from the anecdotes about Erdos that have circulated for decades in the mathematical community. Among these are his idiosyncratic vocabulary ("epsilons" for small children, "bosses" for wives and "Supreme Fascist" for God, in whom he did not believe); his lightning-fast perspicacity (overhearing a discussion of a problem in an unknown field of mathematics and coming back with the solution in a few minutes); his peripatetic lifestyle (without a permanent academic appointment, house, car or bank, he traveled the world constantly with two small suitcases, rarely staying anywhere for longer than a week or two); his befriending and encouraging of young mathematicians; his deportation problems with the State Department during the McCarthy era; his worldly helplessness; and, of course, his unrelenting obsession with mathematics.

Schechter and Hoffman ably describe a number of Erdos' theorems and ideas but, given his wandering lifestyle and his eclectic mathematical interests, the notions of random graphs and phase transitions might be deemed typical. Imagine a country with thousands of isolated cities and a crazy highway commissioner who picks a pair of cities at random and connects them with a road and then picks another pair at random and builds another road. He repeats this procedure and after a while small clusters of cities form that are interconnected. The size of these clusters grows slowly until the number of roads approaches half the number of cities. Suddenly, with the addition of a few more roads, the isolated clusters become interconnected and coalesce to form an immense cluster that includes almost all the cities. The abrupt way this interconnectedness comes about is an instance of a phase transition. It also hints at another of Erdos' preoccupations, Ramsey theory, one of whose primary lessons is that order of some sort is almost inevitable in large structures.

Throughout his life Erdos was fascinated by problems in number theory, probability, graph theory and infinite combinatorics. Preferring miniaturist gems, Erdos showed considerably less interest in theories of a general architectonic nature. Theories may have appeared rigid and totalitarian to someone who referred to Russia as Joe and the United States as Sam.

Erdos emerges from all the anecdotes, theorems and travel as quirky, generous, single-minded and incapable of being regimented. Nevertheless, and I may be expecting too much here, I don't get a visceral sense of Erdos the man. This may be because Erdos, who died in Warsaw in 1996, was not the kind of person about whom one can develop a visceral sense. I strongly suspect, however, that his personality amounted to more than a compendium of anecdotes, endearing though they are. In any case, Sam and the world are poorer without what Hoffman calls this "mathematical monk."

Near the end of Hoffman's book is a brief discussion of madness and mathematicians. Georg Cantor, who founded modern set theory; Kurt Godel, who proved the incompleteness theorems; and a number of other eminent mathematicians were at times and to a greater or lesser degree out of touch with reality.

Sylvia Nasar's "A Beautiful Mind" is the absorbing story of one such mathematical genius, John Forbes Nash Jr., who proved some great theorems as a young man, sank into paranoid schizophrenia and a delusional world of voices, numerology and grandiosity for almost three decades, then gradually returned to normalcy. Oh yes, he also won the Nobel Prize in economics in 1994.

Nash grew up in West Virginia and early on demonstrated both mathematical promise and emotional stuntedness. As an undergraduate at Carnegie Tech (now Carnegie Mellon) just after World War II, he proved himself a whiz at problem-solving yet, despite his size and good looks, elicited teasing and taunting because of his strange remoteness. He went on to Princeton and tackled several of the hardest problems in mathematics, invariably in a very creative and idiosyncratic style.

The three broad arcs of Nash's life--before, during and after his 30-year illness--are depicted by Nasar, an economics correspondent for the New York Times, in painstaking detail. The portrait of the Princeton intellectual scene is, for mathematicians, worth the price of the book alone. (Gossip holds a certain fascination for almost everyone, even mathematicians.) Each of the dozens of people mentioned throughout the book is provided with a trenchant squib by Nasar, and collectively they form a most engaging backdrop to the drama of Nash's life.

What is it that he did to merit such biographical treatment? The short answer is that in a slim 1950 doctoral thesis, he extended the applicability of the game theory invented and developed by John von Neumann and Oskar Morgenstern during World War II. He developed the notion of what is called the "Nash equilibrium for noncooperative games," and this work and these ideas have formed the basis for parts of mathematical economics, auctions in particular.

The flavor of game theory can be tasted by consideration of the so-called prisoner's dilemma in which two men suspected of a major crime are apprehended in the course of committing some minor offense. They're separated and interrogated, and each is given the choice of confessing to the major crime and thereby implicating his partner or remaining silent. If they both remain silent, they'll each get one year in prison. If one confesses and the other doesn't, the one who confesses will be rewarded by being let go, while the other one will get a five-year term. If they both confess, they can both expect to spend three years in prison. The cooperative option is to remain silent, while the noncooperative option is to confess.

The charm of the dilemma has nothing to do, of course, with any interest one might have in the criminal justice system. Rather, it provides the logical skeleton for many situations we face in everyday life. Whether we're businessmen in a competitive market, spouses in a marriage or nations in an arms race, our choices can often be phrased in terms of the prisoner's dilemma. If both parties pursue their own interests, the outcome is worse for both of them than if they cooperate. (Adam Smith's invisible hand ensuring that individual pursuits bring about group well-being is, at least in these situations, quite arthritic.)

Although Nasar doesn't spend much time on the arcana of game theory or on the other theorems proved by Nash (which, mathematically at least, are much more impressive than his game theory results), she does provide an impressionistic sense of Nash's scientific accomplishments. The bulk of the book is taken up with biographical minutiae that she weaves into a narrative of compelling power. She tells of his parents and childhood bookishness, his homosexual experiments, his out-of-wedlock son, his marriage to a physics student at MIT and of his other son, brilliant but troubled. She writes of the raucous camaraderie and cutthroat competitiveness of Nash's years in graduate school, the game "So Long Sucker" he and others devised requiring players to form coalitions to advance but forcing them to double-cross their partners to win, his professorship at age 23 at MIT and his trick of putting unsolved problems on his final exams.

Clearly pointing out how arrogant, self-centered, stingy and inconsiderate the young Nash often was, "A Beautiful Mind" captures his appeal without romanticizing him. His rapid descent into paranoid schizophrenia, beginning in 1960, is also evoked in a straightforward way: his many hospitalizations and treatments, the temporary remissions during which he did some mathematics, the attempts to renounce his U.S. citizenship in Europe, his assuming of the mantle of emperor of Antarctica, the deranged letters in many-colored inks he would send and the nonsense he would scribble on blackboards in Princeton's Fine Hall ("Mao Tse-Tung's Bar Mitzvah was 13 years, 13 months, and 13 days after Brezhnev's circumcision"). Yet with the help of his ex-wife and sympathetic colleagues, Nash maintains through it all a certain impressive dignity. "A Beautiful Mind" culminates in a brief account of his recovery, his continued work in mathematics and the politics of his being awarded the Nobel prize in economics despite considerable opposition.

The juxtaposition of Erdos and Nash suggests again the obvious question: What is it with these mathematicians? There is no doubt a grain of truth to stereotypes of the mathematical personality. (What is the definition of an extroverted mathematician? He's one who looks at your shoes while speaking to you.) And perhaps immersion in the self-created world of mathematics is a too welcome diversion from the drabness of everyday life.

Still, most mathematicians are psychologically quite normal. An idea from statistics is germane. "Selection bias" refers to the tendency of people, for a variety of psychological and other reasons, to select non-random, atypical samples. There are a goodly number of mathematicians whose mathematical accomplishments rival those of Nash (some mentioned in the books herein reviewed) and arguably a few whose work compares to Erdos'. Not having spent 30 years suffering from schizophrenia and then winning a Nobel Prize and not having traveled the globe sprinkling theorems and insights about like apple seeds, they're unlikely, however, to be selected by talented biographers. It's lucky for prospective readers that Nash and Erdos were.