GCHQ has released its “most difficult puzzle ever”, a set of 12 riddles linked to design elements of the new £50 note featuring the mathematician and codebreaker Alan Turing.

The questions begin with a relatively straightforward crossword-style puzzle that starts by asking where GCHQ’s predecessor agency, where Turing worked, was based during the second world war. A two-word answer, nine letters then four, is required.

The spy agency, which believes setting puzzles gives the public an insight into its surveillance work, said it thought the multi-part “Turing challenge” would take an experienced puzzler seven hours to complete.

Colin, described by the agency as its “chief puzzler,” said GCHQ’s riddles were generated by “a mix of minds from across our missions” in honour of Turing, who he said had inspired many recruits to join.

GCHQ chiefs also took the opportunity to apologise again for the postwar treatment of Turing, who helped develop the Bombe, a machine to help crack the German Enigma code, that is regarded as a forerunner of modern computers.

The academic was prosecuted for indecency in 1952 over his relationship with another man in Manchester. He pleaded guilty, underwent chemical castration as part of his punishment, and killed himself two years later.

Jeremy Fleming, the director of GCHQ, said: “Turing was embraced for his brilliance and persecuted for being gay. His legacy is a reminder of the value of embracing all aspects of diversity, but also of the work we still need to do to become truly inclusive.”

LGBT staff were banned from working in Britain’s spy agencies until the early 1990s, and if somebody was believed to be gay they were dismissed from the secret services, a policy that has resulted in several retrospective apologies.

Last month, the new head of MI6 apologised publicly to officers who were thrown out of the spy agency before 1991, and said the foreign intelligence service operated a “wrong, unjust and discriminatory” ban on LGBT staff in its ranks.

Previous GCHQ chiefs have apologised in 2012 and 2016 about what happened to Turing, although Fleming conceded last October that the British spy agency is “not nearly diverse enough” a few days after an official history of the signals intelligence agency revealed it had enforced a colour bar from the 1950s to the 1980s.