In the olden days many computers Octals (3 bits) which to a human are the numbers 0-7. Later we used Bytes (8 bits) and nibbles (4 bits) which give the numbers 0-F in hexadecimal (as you see on your computer). The transponder code is you setting 4 Octals of data which is why there are only the numbers 0-7.
Re - Why does Europe have a code shortage and the US not. I believe the US dynamically allocates codes across the whole airspace system using flight plan info to minimize the potential for a duplicate code - which is why very occasionally you do have a code change enroute in the US. As far as I am aware they don't have lots of special conspicuity codes or allocations of codes to individual controlling areas - hence much greater flexibility. They also have ‘everyone’ except VFR on a discrete code as compared to the use of here of say a 'Farnborough Code' used simultaneously by several aircraft receiving a service.