Max Cohen, the story's protagonist and unreliable narrator, is a number theorist who believes that everything in nature can be understood through numbers. He is capable of doing simple arithmetic calculations involving large numbers in his head, a skill that impresses Jenna, a small girl with a calculator who lives in his apartment building. Max also suffers from cluster headaches, as well as extreme paranoia, hallucinations, and social anxiety disorder. Other than Devi, a woman living next door who sometimes speaks to him, Max's only social interaction is with Sol Robeson, his old mathematics mentor.

Max begins making stock predictions based on the calculations of his computer, Euclid. In the middle of printing out its picks, Euclid suddenly crashes after spitting out a seemingly random 216-digit number, as well as a single pick at one-tenth its current value. Disgusted, Max tosses out the printout of the number. The next morning, he checks the financial pages and sees that the pick Euclid made was accurate. He searches desperately for the printout but cannot find it. Sol becomes unnerved when Max mentions the number, asking if it contained 216 digits. When Max questions him about the number, Sol indicates that he came across it many years ago. He urges Max to slow down and try taking a break.

At a coffee shop, Max meets Lenny Meyer, 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. Max is also met by agents of a Wall Street firm who are interested in his work. One of the agents, Marcy Dawson, offers Max a classified computer chip called "Ming Mecca" in exchange for the results of his work, which Max eventually accepts.

Using the chip, Max has Euclid analyze mathematical patterns in the Torah. Euclid spits out the 216-digit number before crashing again. When his computer refuses to print out the number, Max begins to write it down. Midway through the writing, Max realizes that he knows the pattern, undergoes a sudden epiphany, and passes out. Thereafter, Max appears to become clairvoyant and is able to visualize the stock market patterns he had been searching for. But his headaches also increase in intensity, and he discovers a strange vein-like bulge protruding from his right temple. Max has a falling out with Sol after the latter urges him to quit his work.

Dawson and her agents grab Max on the street and try to force him to explain the number. They had found the original printout 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 finally reveal their intentions: they believe the 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 that he has died. Max searches his house and finds mathematical scribblings similar to his own, eventually finding a piece of paper with the number. Driven to the brink of madness, Max 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 an illusion. 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, 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. He observes the trees blowing in the breeze, at peace.

This article uses material from the Wikipedia article "Pi_(film)", which is released under the Creative Commons Attribution-Share-Alike License 3.0