How to generate account number?

Roy Smith roy at panix.com
Sat Nov 3 14:22:55 CET 2012


In article <mailman.3234.1351931985.27098.python-list at python.org>,
 Andriy Kornatskyy <andriy.kornatskyy at live.com> wrote:

> 'Z05738521581'
> 'Z17888279480'
> 'Z07395350007'
> 
> Short, human readable and satisfy original requirements.
> 
> Andriy

If you really want human readable, it's better to chunk the data up into 
3 or 4 digit groups.  So, instead of Z05738521581, maybe 
Z05-738-521-581.  Or perhaps even better, Z05-7385-21-581 (just a hunch, 
but I suspect varying the length of the groups makes it easier to read).

Even better might be base-32 encoding the value.  Strings of digits have 
an information density of about 3.2 bits/char. Base-32 is just about as 
readable, but gives you 5 bits/char, so you end up with a few less 
characters (which you still want to chunk into 3 or 4 character groups).


More information about the Python-list mailing list