# Enumeration of a lexicographically ordered set

Suppose I have a family of vectors of the form x=(x0,x1,x2,x3,x4,x5) where x0,x3 can taker either 0 or 1 value and all the other variables can take values 0,1,2,3,4,5,6,7. Then I m ordering them in lexigraphic order say like 000000<000001<000002<...<000010<000020<....

We have in total 16384=2.8.8.2.8.8 elements. I want to list thme in a list in this order so that when given say the number m I can recover the entries x0,..,x5 of the mth element in my list. So I need like function from these vectors to {0,1,...,16383}. I want this for a programming task actually.

-
Anyway, it is the same as writing the given natural number $<16384$ into (max 14 digits) binary form, then rearraging its digits as $$\overbrace{d_1}\underbrace{d_2d_3d_4}\overbrace{d_5d_6d_7}\underbrace{d_8}\overbrace{d_9d_{10}d_{11}}\underbrace{d_{12}d_{13}d_{14}},$$ and the lexicographical order coincides with the traditional order of numbers.