'Knapsack' printed from http://nrich.maths.org/

You have worked out a secret code with a friend. Every letter in the
alphabet can be represented by a binary value that is given in the
lookup table below.

You go off on a camping trip with 5 sticks in your knapsack. They have
lengths of 1,3,5,10 and 20 centimetres, these will help you decode any
message your friend sends.

A coded message arrives. It is the number 31. To decode the message you
must work out which sticks you need to make a length of 31cm and convert
this information into the binary code that tells you the letter.
Decoding will be easy because your sticks form part of a superincreasing
series (each stick is longer than the sum of the lengths of all the
smaller sticks).

Taking the largest length off first leaves 31-20 = 11 so the coded
letter used the 20 cm stick. 11-10 = 1 so the coded letter also involves
the 10cm stick. With 1 left the 5-stick and the 3-stick are not used,
just the 1-stick.

This gives you a binary code of 10011 (1x1cm+0x3cm+0x5cm+1x10cm+1x20cm).

So using the binary lookup table, the number 31 represents is 10011,
which is the letter s.