How to use a 5 or 6 bit integer in Python?

Glen Wheeler adsl5lcq at
Sat Dec 20 09:38:36 CET 2003

On 19 Dec 2003 06:02:23 GMT, bokr at (Bengt Richter) wrote:

>If we can tease out a little more about your problem, maybe we can help better ;-)
>E.g., how do your tuple-keys come into being and how many times are they re-used?
>If there is no nesting, you could create a string key just by ''.join([chr(el) for el in tup])
>which wouldn't be as compact as a compressed bit string, but would be smaller than the tuple.
>If you were lucky, a change could gain you both time and space.

  I'll be implementing that this weekend, as my employer is expecting
results before Christmas.  Damn deadlines.

>I'm curious what your dicts and their int tuples represent in the real world ;-)

  Well, I'm a researcher for an Australian university (University of
Wollongong) and my current task is to enumerate every possible 6 digit
binary Gray code.
  Most recently people have done the 5 digit BGCs, something which I
have also accomplished, but never the 6 digit codes.
  For a graphical representation, think of a cube in n-dimensions,
where n represents the number of digits in the code.  A binary Gray
code around that cube represents a path starting from any arbitrary
point and then visiting every vertex exactly once.
  The applications of such research are enourmous, and I'll not go
over them here, but that is my aim.  To find the number of ways a 6
dimensional fly could walk a 6d cube visiting every vertex exactly
  I've actually been working on this problem for many months now and
have gotten so close.  The previous best estimate for calculation time
(with a program written in C, I might add) was 2.8 * 10^15 years.
I've got the thing down to about 10^4 years.  If the calculation
becomes tractable on a supercomputer, e.g. Barossa hosted at, then I'll run it on that.

  I hope that's sated your curiosity for now :).  If you'd like any
more information, or if anyone else would like to know anything about
this, then I'll be happy to correspond with them.  I don't know how
on-topic it is for


More information about the Python-list mailing list