A postcard featuring a fiendish mathematical puzzle written and signed by codebreaker Alan Turing is being auctioned today (01 February).

Turing, whose signature is very rare because he rarely wrote letters, sent the postcard to his psychiatrist in July 1953. He died from a suspected suicide around a year later. The front of the card shows a medieval picture representing the "Josephus problem" – a puzzle named after the first-century Romano-Jewish scholar Flavius Josephus.

The story goes that Josephus and his and his soldiers agreed upon an unusual suicide pact in the face of a certain military defeat. Standing in a circle, the first soldier would kill the man to his left, the next surviving soldier would then kill the man to his left, and so on until one man was left standing.

The problem is: faced with a similar situation, how could you determine where to position yourself in order to be the last man standing?

"Turing, who was fascinated by these types of algorithmic puzzles, surely knew of the 'Josephus Problem' and it is likely the reason he chose this specific postcard," said Robert Livingston, executive VP at RR Auction.

Turing became a patient of the Jungian psychologist Dr Franz Greenbaum in 1952, and became a friend of the family; in another letter he wrote to the doctor's daughter, Maria Greenbaum, about solving a solitaire puzzle.

In Sara Turing's pioneering 1959 biography of her son she noted that he "normally shirked letter-writing," and his autograph is indeed incredibly scarce in any form. The RR online auction house estimated that it will fetch more than $40,000 (£31,670) when it goes under the hammer today.

The British government convicted Turing of "gross indecency" in 1952 and sentenced him to chemical castration. He later died of cyanide poisoning, in an apparent suicide attempt on.

In 2017 he was retroactively pardoned by the UK government. An act, which pardons men previously convicted of homosexual crimes, has become informally known as "Turing's Law". The Policing and Crime Bill received Royal Assent on Tuesday 31 January, meaning the pardons have now been enshrined in law.

A video explainer of the fiendishly difficult 'Josephus Problem'
Alan Turing postcard
Alan Turing rarely wrote letters r postcards - his autograph is rare in any form RR Auction
Alan Turing postcard
Turing sent the postcard to his psychiatrist Dr. Franz Greenbaum RR Auction
Alan Turing postcard
An medieval representation of the Josephus problem - a fiendish mathematical challenge RR Auction