### The Best Card Trick?

Time for a little mathemagic! Choose any five cards from a pack and show four of them to your partner. How can they work out the fifth?

### Substitution Cipher

Find the frequency distribution for ordinary English, and use it to help you crack the code.

### Secret Transmissions

How can Agent X transmit data on a faulty line and be sure that her message will get through?

# Substitution Transposed

##### Stage: 3 and 4 Challenge Level:

Well done to Holly from Hymers School who cracked this problem. She described her method as follows:

The way I solved this problem was looking at the frequency graph on the Cipher Toolkit. I realised that it would line up with the normal English letter frequency if every letter was moved three to the right (e.g. h-e, d-a), so I moved them all three to the right and came up with a code, which I then transposed. I discovered the factors of 456 are 1, 2, 3, 4, 6, 8, 12, 19, 24, 38, 57, 76, 114, 152, 228 and 456. The first and last two wouldn't be likely, so I kept trying the different factors until I came up with 19 being the correct number of columns.

Writing the message in a 24 by 19 grid and decoding the Caesar shift of +3 gives:

t e e r g k g t r w i t s s a e d a i

h n t a e s a h b i n e i a t r o i e
e t h i t t r e a t a d n g h e w n n
y o e l t h d y n h n v t e r l s t c
w b y w i e e w c t o i h t o e a a e
e e h a n p n e h h r l e h o c n n a
r g a y g a s r i e d l f a m t d d s
e i d s t n a e l i i a r t w r a e t
n n e e o t n j d r n w o w i i g v h
o w v x m o d u r f a i n a t c o e e
t i e c a m m s e a r t t s h b o r h
r t r e s i a t n t y h d c h e d y o
a h t p k m d o a h r c o a o l d m u
i i h t e e a r n e e o o l t l e o s
l d o a l z m d d r d l r l a s a d e
w o u s y o e i t a b o a e n f l e a
a n g a n o t n h n r u t d d r o r g
y t h m e l u a e d i r i a c e f n e
c s t e a o s r y m c e l h o n w c n
h u a a n g s y l o k d e a l c h o t
i p b n d i a s i t f g d l d h i n s
l p o s c c u u v h r l p l w w t v s
d o u o o a d b e e o a a a a i e e a
r s t f o l s u d r n s s b t n p n y




Reading down the columns gives the plaintext:

theywerenotrailwaychildrentobeginwithidontsupposetheyhadeverthoughta
andtheylivedwiththeirfatherandmotherinanordinaryredbrickfrontedvilla
withcolouredglassinthefrontdooratiledpassagethatwascalledahallabathr
oomwithhotandcoldwaterelectricbellsfrenchwindowsandagooddealofwhitep
aintandeverymodernconvenienceasthehouseagentssay


Here is the text that Holly managed to decipher:

They were not railway children to begin with. I don't suppose they had ever thought about railways except as a means of getting to Maskelyne and Cook's, the Pantomime, Zoological Gardens, and Madame Tussaud's. They were just ordinary suburban children, and they lived with their Father and Mother in an ordinary red-brick-fronted villa, with coloured glass in the front door, a tiled passage that was called a hall, a bath-room with hot and cold water, electric bells, French windows, and a good deal of white paint, and 'every modern convenience', as the house-agents say.

It's the first paragraph from "The Railway Children" by E. Nesbit