A paranoid mathematician searches for a key number that will unlock the universal patterns found in nature.
Max is a genius mathematician who's built a supercomputer at home that provides something that can be understood as a key for understanding all existence. Representatives both from a Hasidic cabalistic sect and high-powered Wall Street firm hear of that secret and attempt to seduce him.
The mathematician Maximillian Cohen is tormented by a severe migraine since he was a kid, and he uses many pills to reduce his painful headaches. He is a lonely man, and his only friend is his former professor Sol Robeson. Max has the following assumptions, which rules his life: (1) Mathematics is the language of nature; (2) Everything around us can be represented and understood from numbers; (3) If you graph the numbers in any system, patterns emerge. Therefore there are patterns everywhere in nature. Based on these principles, Max is trying to figure out a system to predict the behavior of the stock market. Due to his research, Max is chased by a Wall Street company with obvious interest in the results of his studies, and by a Chasidic Torah scholar, who believes that this long string of numbers is a code sent from God.
In Manhattan, behind six locks, lives Max Cohen, a mathematician and computer whiz. Since staring at the sun at age six, he's had terrible headaches; plus, he can't abide human contact except with an aging professor, and he's obsessed with finding numeric patterns. His current obsession is the stock market; his theories bring him to the attention of Wall Street traders. He also keeps running into Lenny, a fast-talking Chasidic who fronts for a cabal that wants to rediscover long-lost mathematical mysteries in the Torah. Neither group is benign, and they pursue Max as his hallucinations and headaches worsen. Does nature offer any solutions? Can Max find them?
- The film is about a mathematical genius, Maximilian Cohen (Sean Gullette), who narrates much of the movie. Max, a number theorist, theorizes that everything in nature can be understood through numbers, and that if you graph the numbers properly patterns will emerge. He is working on finding patterns within the stock market, using its billions upon billions of variables as his data set with the assistance of his homemade supercomputer, Euclid, that he built in his small apartment in New York City's Chinatown.
The film opens with Max narrating a time when he was very young and tried to stare directly at the sun, despite his mother's warnings not to. His eyes were terribly damaged, and his doctors were not sure if they would ever heal. They did, but immediately thereafter he began to be plagued with headaches. The headaches are severe enough to drive him to the brink of madness, and he often passes out from the pain. He also suffers from extreme paranoia, manifested in menacing hallucinations, and some form of social anxiety disorder. (Note: throughout the film, it gets increasingly difficult to separate what is real and what is a product of Max's hallucinations.)
Due to his "gift" (or curse), Max is capable of doing simple arithmetic calculations involving large numbers in his head, a skill that impresses Jenna, a small Chinese-American girl with a calculator who lives in his apartment building.
In the course of his work, Max begins making stock predictions based on Euclid's calculations. In the middle of printing out the picks, Euclid suddenly crashes, but first spits out a 216-digit number that appears to be nothing more than a random string. Disgusted, Max tosses out the printout of the number. The next morning, Max checks the financial pages and sees that the few picks Euclid made before crashing were accurate. He searches desperately for the printout but cannot find it.
Other than Devi, a young woman living next door who sometimes speaks to him, Max's only other social interaction is with Sol Robeson (Mark Margolis), his old mathematics mentor who is now an invalid. Sol had been a leading figure in research into the nature of Pi (the symbol for the number 3.14) in his earlier years, but gave it up for reasons that are not yet clear. He sympathizes with Max about the loss of Euclid but becomes unnerved when Max mentions the string of numbers, asking if the string was 216 digits long. When Max questions him about the string, Sol indicates that he came across such a number many years ago. He urges Max to slow down and try taking a break.
At a coffee shop that he frequents on a daily basis, Max meets Lenny Meyer (Ben Shenkman), a Hasidic Jew who coincidentally does mathematical research on the Torah. Lenny demonstrates some simple Gematria, the correspondence of the Hebrew alphabet to numbers, and explains how some people believe that the Torah is a string of numbers that form a code sent by God. Max takes an interest when he realizes that some of the number concepts Lenny discusses are similar to other mathematical concepts, such as the Fibonacci sequence. Lenny also mentions that he and his fellow researchers are searching for a 216-digit number that is repeated throughout the text of the Torah.
Meanwhile, Max is being pursued by shadowy agents of a Wall Street firm, who are interested in his work for financial reasons. The leader of the agents, Marcy Dawson (Pamela Hart), shows up at his apartment one day and offers Max a powerful new computer chip, called the "Ming Mecca", in exchange for the results of his work. Max insists that he is uninterested in working for them to make a profit but takes the chip to help his new research into the Torah.
Utilizing the sophisticated chip, Max has Euclid analyze mathematical patterns in the Torah. Euclid crashes again, but once again spits out the 216-digit number. Thereafter, Max appears to become somewhat clairvoyant and able to visualize the stock-market patterns he had been searching for. His headaches also increase in intensity, and he discovers a strange vein-like bulge protruding from his right temple.
During another visit with Sol, his old mentor warns him that the mysterious 216-digit number is more than Max realizes, and seems to have powers of its own. Sol insists that trying to understand it years ago had caused him to suffer a stroke, but Max angrily dismisses Sol's concerns as cowardice.
One evening, Dawson and her agents grab Max on the street and try to force him to explain the number. They had found the original printout that Max threw away and had been trying to use it to manipulate the stock market in their favor, but as a result, caused it to crash. Although Max is held at gunpoint, Lenny drives by and rescues him. However, Lenny and his companions make similar demands on Max to give them the number. They take him to a nearby synagogue where they finally reveal their intentions: they believe the 216-number was meant for them to bring about the messianic age, as the number represents the unspeakable name of God. Max refuses, insisting that whatever the source of the number is, it has been revealed to him alone.
Max flees and tries to visit Sol, only to find out from his daughter, Jenny, that he has just died from another stroke. Max searches Sol's apartment and finds mathematical scribblings similar to his own, eventually finding a piece of paper with the number.
Back in his own apartment, Max is driven to the brink of madness when he experiences another headache and resists the urge to take his painkillers, which causes him to destroy some of the parts of Euclid. Believing that the number and the headaches are linked, Max tries to concentrate on the number through the pain. After passing out, Max has a vision of himself standing in a white void and repeating the digits of the number. The vision ends with Max hugging Devi, who turns out to be a hallucination. Max stands alone in his trashed apartment. Max burns the paper with the number and blithely performs an impromptu trepanning on himself in the right cerebral hemisphere with a power drill.
Later, in the final scene, Jenna approaches Max in a park asking math problems, including 748 ÷ 238, which is an approximation for Pi. Max smiles and claims that he doesn't know the answer to them. No longer able to solve complex mathematics or experience headaches or paranoid thoughts, Max sits on the park bench and observes the trees blowing in the breeze, at peace.