Thursday, March 25, 2010

Ternary Gray code

Enter "Gray code conversion rules" into Google to bring up the general rules; following rules in A147995 in OEIS: http://www.tinyurl.com/4zq4q
then, following the reflection principle for Gray code k, we write out (say k=3) 0,1,2; 2,0,1; 1,2,0; ...in the right column; i.e. we write each term in the series once, then for the next subset of 3, we repeat the last term recorded, or "reflect" it.
...0
...1
...2;
now reflect, starting the series again (2, then 0, 1,...):
...2,
...0,
...1;
now for the next subset we reflect the "1" getting
...1
...2 (continuing with 0,1,2, etc.)
Now for the next column going to the left, we mark down each term 3 times; and the next column after that (column 3), 9 times, so that each term in the series 0,1,2 (and generally, 0,1,2,3,...for any k) is marked down k^0, k^1, k^2,....times along with the reflection principle. Thus, for Ternary Gray code we obtain:
000
001
002
012
010
011
021
022
020
120
121
122
102
101
100
110
111
112
...

No comments:

Post a Comment