NEW YORK — A handwritten notebook by Alan Turing, the World War II code-breaking genius depicted by Benedict Cumberbatch in the Oscar-nominated “The Imitation Game,” is going up for auction.

The 56-page manuscript was written at the time the British mathematician and computer science pioneer was working to break the Enigma codes used by the Germans throughout World War II. It is being sold April 13 by Bonhams in New York. It is expected to bring at least $1 million.

The notebook contains Turing’s complex mathematical and computer science notations. It is believed to be the only extensive Turing manuscript known to exist, the auctioneer said.

It dates from 1942, when Turing was trying to break the seemingly unbreakable code with his team of cryptanalysts at Britain’s World War II code and cypher school Bletchley Park.

In one entry Turing writes about a complex calculus notation. “The Leibniz notation I find extremely difficult to understand in spite of it having been the one I understood the best once! It certainly implies that some relation between x and y has been laid down eg, y(equals)x2+3x ...”

The notebook was among the papers he left in his will to friend and fellow mathematician Robin Gandy.

Gandy gave the papers to The Archive Centre at King’s College in Cambridge in 1977. But he kept the notebook, using its blank pages for writing down his dreams at the request of his psychiatrist. Bonham describes Gandy’s entries as highly personal; the notebook remained in his possession until he died in 1995.

At the beginning of his journal, Gandy writes: “It seems a suitable disguise to write in between these notes of Alan’s on notation, but possibly a little sinister; a dead father figure, some of whose thoughts I most completely inherited.”

Bonhams said the seller wished to remain anonymous. Part of the proceeds will be donated to charity.