From: Brian Candler Date: 2003-07-19T17:04:07+09:00 Subject: Re: [SNIPPET] Binary counter On Sat, Jul 19, 2003 at 07:26:32AM +0900, Phil Tomson wrote: > You guys are spoiling all my fun with recursive functions ;-) Sorry. Well for a bit more fun, how about writing a Gray code counter? The characteristic of this sequence is that each number differs from the previous one by exactly one bit. 0000 0001 0011 0010 0110 0111 0101 0100 1100 ... etc It has important practical applications: e.g. devices which detect the rotational position of a shaft. You don't have to worry about false readings during awkward transitions like 0111->1000 Regards, Brian.