Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Find the Gray code for an integer
ResourceFunction["GrayCode"][n] gives the Gray code of the integer n. |
Find the Gray code of an integer:
| In[1]:= |
|
| Out[1]= |
|
GrayCode threads itself elementwise over lists:
| In[2]:= |
|
| Out[2]= |
|
Visualize the sequence of values generated by GrayCode:
| In[3]:= |
|
| Out[3]= |
|
Successive values differ in only one bit in the binary representation:
| In[4]:= |
|
| Out[4]= |
|
| In[5]:= |
|
| Out[5]= |
|
Visualize the differences:
| In[6]:= |
|
| Out[6]= |
|
Create an animated fractal from the sequence generated by GrayCode:
| In[7]:= |
|
| Out[7]= |
|
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License