You should never turn down an opportunity to walk with a novelist—which is why I agreed to follow Joshua Cohen, fearless pedestrian and writer, across a vast expanse of pavement in Red Hook, Brooklyn, in which four streets and a highway off-ramp converged.

Cohen had offered to accompany me to the subway from a bar where we met to discuss Book of Numbers, his rise-of-the-Internet novel, due out in June from Random House. “All of these places are mobbed up,” he says of Red Hook’s trucking depots, before excitedly steering me across the Brooklyn-Queens Expressway overpass to a mysterious edifice. It had few windows; a fenced-in, corner-lot yard; CCTV cameras; and sidewalk pillars “so that a car can’t ram its way in.” I asked him what he thought was going on in there, expecting lurid tales of Mafia activity. “Nothing—probably just four fat guys sitting around drinking coffee.”

Doubtless, Cohen prefers to deploy his imagination on grander matters, as he does in Book of Numbers, which brilliantly anatomizes the ongoing transition to the digital era. An inventive novelist and book critic for Harper’s magazine, the 34-year-old Cohen has written eight books over the past 10 years, including Witz, a dense, darkly comic doorstopper about the last Jew on Earth, along with a growing body of exacting and entertaining criticism.

In his latest novel, Cohen structures a modern tale around an ancient text, Numbers, the fourth book of the Bible, which Cohen describes as a “messy, cultic, slightly insane book about people formation.” In it, Moses and the Israelites he led out of Egypt perish in the wilderness (Joshua and Caleb excepted) before reaching the promised land. “It’s the idea of the writerly generation dying out, and these new digitals inheriting the land,” Cohen says. “I’m aggressively, insanely writing a topical book. And my idea was to overdo the topicality of it—Islam, terrorism, technology, government surveillance—because we are enacting our lives in this same template in which international events are unfolding to our consciousness, which is to say on the screen.”

Two stories in Cohen’s previous book, Four New Messages, dealt with the perils of Internet culture—specifically, confusion between the virtual and the real, and the advent of indelible public humiliation. “I liked the idea of writing these didactic tales, presenting these fates in a very schematic way.” Book of Numbers is more expansive, supplying a panoramic view of a culture in which technology is assuming an almost religious significance.

“Technology is essentially going to take on a theological dimension, in the sense that the ultimate redemption of mankind will be forever delayed,” Cohen says. “It’s like waiting for the messiah. God doesn’t send us a Messiah 1.0, a Messiah 2.0, with you constantly having to upgrade. This is the same prolongation.”

Book of Numbers is structured as a double memoir, the tale of two separate men named Joshua Cohen. One is a struggling, self-indulgent writer who is understandably conflicted over the uncertain future of print culture. The other is the founder of Tetration, a Google-like tech company whose search algorithm helped map the Internet. He is as ascetic as a billionaire can be, a jet-setting recluse who ponders the Web as a void and debates whether it’s best comprehended in Buddhist or Hindu terms.

As a gimmick, a magazine hires writer Cohen to do a profile of tech Cohen, a piece that is killed when the latter is too forthcoming about his scorn for his investors and users—or “lusers,” as he calls them. Several years later, Cohen the author is contracted to ghostwrite the autobiography of Cohen the billionaire, now identified by the narrator as Principal. (The real motive behind taking this assignment is the novel’s central mystery.) Principal invites Cohen to his 40th birthday party in Palo Alto, Calif., then to Europe and Dubai, setting the stage for a collaboration between two men with vastly different conceptions of technology and language. As Principal relates his and his company’s secrets to the writer in a strangely elegant idiom sprinkled with neologisms (“comptrasted,” “rectards,” “octalfortified”) and verbal tics, a memoir unlike any other CEO memoir emerges.

“Principal speaks a language that is purely symbolic, not emotional” says the real Cohen. “For him it’s utile. For the writer, every word has the collapse of the history of its usage in it.” He notes that he wasn’t interested in creating a caricature of a fatuous Silicon Valley guru. “Technology manifests itself to Principal as this imperative to investigate his own soul, which is a much more humanitarian response than the ghostwriter’s response, which is Luddite and conventional and angry.”

Book of Numbers, like all encyclopedic fiction, comprises many modes and genres: it is a spiritual biography, a satire of industry (tech and publishing), and a portrait of the artist, with elements of noir, melodrama, and the thriller mixed in. Cohen is as comfortable delving into the seedy and the sublime as Thomas Pynchon, whose latest novel, Bleeding Edge, which is also about the Web, he greatly admires. Other Internet novels, not so much.

“There are so many classic Big Brother warning books: the Internet is a horrible, controlling thing, as if it has a consciousness or political agenda,” Cohen says. While his novel does contain conspiratorial elements, it never devolves into a pat dystopian fable. Book of Numbers is not so much hostile toward Silicon Valley as inquisitive about the nature of our reliance on technology.

“We’re complicit because we’re serviced, willing to be tracked so that we can get the sandwich we so desperately want,” Cohen says. “We’ve always made traps for ourselves. And look at this desublimated trap that we have technologized and set in motion to grant us enormous access and yet preclude us from feeling free. That to me is a spirit of collective, communal sadness.” Cohen watched the Internet spring up from Europe, where he had moved several weeks before 9/11 (“At least I was spared the indignity of Wolf Blitzer”). Looking on as his friends began going and writing online, he felt that “this was a world which I felt in some ways foreclosed from. But at the same time, I saw that the more that was written on it, the less worth it had.”

Meanwhile, Cohen was devoting himself to print culture, writing articles as the correspondent in Eastern Europe for the Jewish Daily Forward and working on four books at once. “Writing blindly into the emptiness” is how he describes the isolating but formative time.

“I wanted there to be some meaning in my life, which meant that I had to live my life in the same way one writes a novel,” Cohen says. “You write a novel by inventing a world and inventing the rules that govern that world. Then you break the rules when you want to. And I felt that to exist in someone else’s novel, to live in someone else’s novel—meaning to go through a training as a writer in an M.F.A. program, to submit myself to commercial publishing at this point, which would’ve rejected me anyway—felt like it wasn’t free and it wasn’t consequential.”

Cohen eventually found a home for his books, each with a different independent publisher. The advance for his first collection, Quorum, was “$50 and some Staropromen beer.” (The publishing house was Czech.) For his next book, he received a considerable upgrade—a bottle of rye—and he later sold Witz for a dollar a page, of which there were 800. His journey through the publishing landscape has now landed him at Random House, at least for the moment: “Aren’t they going to kick me off next week?”

Cohen has also supported himself through various freelance jobs, including ghostwriting. When I asked him about the experience of writing in another person’s voice, he replied with customary wryness: “My landlord and Con Ed liked those experiences. They appreciated them very much.”

Our conversation touches on the long tradition of Biblical exegesis; Pingala, the ancient Indian scholar of prosody who used a binary numbering system to describe Sanskrit metrical patterns; and reversible computing—“an insane, bastard stepchild” of a processing method that features prominently in the novel. Cohen is a polymath, and other topics covered in Book of Numbers include steatopygi (ancient, heavy-bottomed statuettes) and the intricacies of search algorithms.

Before writing the novel, Cohen knew C and a little bit of Java, but for this project he also looked at two more programming languages—Perl and Python. However, his real education came in business. To paint an accurate portrait of a global technology giant, he needed to acquaint himself with the workings of venture capitalism, corporate tax structures, and the State Department, a task for which his writerly vocation had prepared him. “All of business and all of politics is essentially fiction to those who live them,” Cohen says. “I have more experience with fiction than most senators because I do it all day, so their world didn’t seem that foreign to me.”

After a brief pause, he adds, “And most novelists are narcissistic egomaniacs who would probably fit somewhere on the CEO spectrum.”

Matt Seidel is a staff writer for the Millions, an online literary magazine.