combinat
graycode
list of the n-bit numbers in graycode order
Calling Sequence
Parameters
Description
Examples
graycode(n)
n
-
non-negative integer
The procedure graycode computes and returns a list containing all 2n n-bit integers in a graycode order starting at zero.
A graycode order is such that each successive pair of integers differ in only one bit in their binary representations.
The command with(combinat,graycode) allows the use of the abbreviated form of this command.
with⁡combinat,graycode
graycode⁡0
0
graycode⁡1
0,1
g≔graycode⁡3
g≔0,1,3,2,6,7,5,4
printf⁡cat⁡`$`⁡` %.3d`,8,op⁡map⁡convert,g,binary
000 001 011 010 110 111 101 100
See Also
Download Help Document