Copyright © University of Cambridge. All rights reserved.

'Substitution Cipher' printed from http://nrich.maths.org/

Show menu


This was an interesting problem! Thanks for all the solutions, all of which were correct - let's see how some of you attacked this puzzle.

Jessica, from Chichester High School for Girls, started off by noting that E is the most common letter in English. Holly, from Hymers College, agreed, and after counting the frequencies of various letters in the code, concluded that E had probably been substituted by J, since J occurred so frequently in the code. This method can be used repeatedly to guess the rough distribution of letters. Are there any other ways of working things out?

Oak class from Henham and Ugley School explained their strategy:

We decided to try to identify single letter words first and then researched which letters are most commonly occurring in the English language. Once we had a possible solution we tested it to see if it fitted. If not we tried an alternative.

Geoffrey, from Creative Secondary School, Hong Kong, had the following few ideas:

First, set up a document in Microsoft Word. Change all letters into upper case letters - this will make your life?easier in later steps. Then make a table in another document, which should look like this:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
- - - - - - - - - - - - - - - - - - - - - - - - - -

Once you crack part of the code, use the "replace" function. Replace the code letter in upper case letters with the substituted letter in lower case letters.

Next, search for one-letter words. They can only be "a", "i", or "o".

Some common two-letter words and three-letter words, which you should look for, include:
to do on at as of he the and his her has had

When you work out a letter, write it under the code letter in the table:

 

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
x p d c j h i f g e r y u w z b s k q v m t n a l o

Big tip: there's a website address at the bottom of this code, so you can guess that "nnn." = "www." and ".zki" = ".com/.net/.org".

Great! Thanks for all the responses. By the way, the text was:

The Mole had been working very hard all the morning, spring-cleaning his?little home. First with rooms, then with dusters; then on ladders and steps and chairs, with a brush and a pail of whitewash; till he had dust in his throat and eyes, and splashes of whitewash all over his black fur, and an aching back and weary arms. Spring was moving in the air above and in the earth below and around him, penetrating even his dark and lowly little house with its spirit of divine discontent and longing. It was small wonder, then, that he suddenly flung down his brush on the floor, said 'Bother!' and 'O blow!' and also 'Hang spring-cleaning!' and bolted out of the house without even waiting to put on his coat. Something up above was calling him imperiously, and he made for the steep little tunnel which answered in his case to the gavelled carriage-drive owned by animals whose residences are nearer to the sun and air. So he scraped and scratched and scrabbled and scrooged and then he scrooged again and scrabbled and scratched and scraped, working busily with his little paws and muttering to himself, 'Up we go! Up we go!' till at last, pop! his snout came out into the sunlight, and he found himself rolling in the warm grass of a great meadow. 'This is fine!' he said to himself.  'This is better than whitewashing!' The sunshine struck hot on his fur, soft breezes caressed his heated brow, and after the seclusion of the cellarage he had lived in so long the carol of happy birds fell on his dulled hearing almost like a shout.  Jumping off all his four legs at once, in the joy of living and the delight of spring without its cleaning, he pursued his way across the meadow till he reached the hedge on the further side.

Extract from 'The Wind in the Willows' by Kenneth Grahame available to read in full at www.gutenberg.org