You might look up Hamming distance and Trellis Coded Modulation. They are concepts which go beyond what you are talking about, but they are somewhat similar since they involve assigning values to symbols in such a way as to maximize the distance between the symbols for certain values (in the TCM case, the goal is to reduce bit error rate). I assume by "far apart" you mean in the circular sense (i.e., you chose 0101=3D2 instead of 1001 because you consider the MSbit to be "next" to the LSbit, in a wrap-around sense?) Also, your code is similar to Gray code because only one bit changes between adjacent values. Why do you want to keep one-valued bits far apart? Sean On Sat, Aug 15, 2009 at 10:07 PM, William Couture wrote: > Hi all, > > I have to do some oddball counting in binary, and I was wondering if ther= e was > some standard table to make sure I get this right. > > I have to, for example, count from 0 to 4. =A0I do this by setting the ap= propriate > number of bits to 1. =A0For example: > =A0 0000 =3D 0 > =A0 0001 =3D 1 > =A0 0011 =3D 2 > =A0 0111 =3D 3 > =A0 1111 =3D 4 > > However, I also have to keep the '1' bits as far from each other as possi= ble. > Again, using 0 to 4 for the example: > =A0 0000 =3D 0 > =A0 0001 =3D 1 > =A0 0101 =3D 2 > =A0 1101 =3D 3 > =A0 1111 =3D 4 > (there is quite a difference when you have a count of 16 or 32). > > This isn't a gray code, and isn't a balanced gray code, either. > > Is this a "standard" thing? =A0Does it have a name? =A0And a standard > set of bits? > > Thanks, > =A0 Bill > > --- > Psst... =A0Hey, you... Buddy... =A0Want a kitten? =A0straycatblues.petfin= der.org > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist