Thursday, March 25, 2010

Gray code conversion rules

at http://www.tinyurl.com/4zq4q
then access sequence A147995
The reflection principle is as follows, by way of example, ternary Gray code :
First column, going right to left, within each set of 3 terms starting with 0, write 0,1,2, then the next set repeats the 2 (reflection) then continues with the series 0,1,2. Each set reflects, then continues in the series 0->1->2, so we obtain
0,1,2; 2,0,1; 1,2,0; 0,1,2;...; (but these are column 1 terms.). Column 2 terms each term is marked down 3 times: 0,0,0; then 1,1,1; 2,2,2; then reflect: 2,2,2;...
For column 3, each term is written down 9 times along with the reflection principle as before. Generally for Gray code K, each term is recorded K^0, K^1, K^2...times by columns. Putting the rules together for k=3, Ternary, we
obtain (for decimal 0, 1, 2, 3,....):
000
001
002
012
010
011
021
022
020
120
121
122
102
101
100
110
111
112
...
and, we note that the column change from n-th to (n+1)-th term =
A051064 in OEIS: (1, 1, 2, 1, 1, 2, 1, 1, 3, 1, 1, 2, 1, ...) representing
the row (labeled 1,2,3,...) in the following multiplication table:
(heading terms not multiples of 3, * left column = powers of 3):
1,...2,...4,....5,....7,...8,...10...
3,..6..,12,..20, 21,.24,..30,..
9,..;
Then record the row that n=1,2,3,...occurs in, getting A051064 as before:
(1, 1, 2, 1, 1, 2, 1, 1, 3,...) = the ruler sequence for k=3.

No comments:

Post a Comment