HP Forums

Full Version: (48G/49/50) Gray Codes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This program returns a list of binary Gray codes from 0 to 2^n-1. For example, given the number 4 the program will return a list of Gray codes from 0 to 15.

If real numbers are desired instead of binary numbers, replace the binary numbers in line 1 with reals, and replace the SL in line 2 with 2 *.


\<< # 10b { # 0b # 1b } ROT 2 SWAP
Reference URL's