Wolfram Research

Function Repository Resource:

GrayCode

Source Notebook

Find the Gray code for an integer

Contributed by: Wolfram Staff

ResourceFunction["GrayCode"][int]

gives the Gray code of the integer n.

Examples

Basic Examples

Find the Gray code of an integer:

In[1]:=
ResourceFunction["GrayCode"][14]
Out[1]=

Scope

Retrieve the ResourceFunction:

In[2]:=
ResourceFunction["GrayCode"]
Out[2]=

Retrieve the ResourceObject:

In[3]:=
ResourceObject["GrayCode"]
Out[3]=

GrayCode threads itself elementwise over lists:

In[4]:=
ResourceFunction["GrayCode"][Range[25]]
Out[4]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Resource History

License Information