Skip to content

GrayPrevious ​

The previous word in the Gray code: flip the first letter when the ones are odd in number, else the letter after the first one.

GrayPrevious(BinaryWord)The previous word in the Gray code: flip the first letter when the ones are odd in number, else the letter after the first one.
Typed signatures
TypePackageApplies
(binary_word) -> binary_wordcombinatoricsalways

Domain: Combinatorial maps

Details
  • Takes a BinaryWord and returns a BinaryWord — a typed map, so a wrong carrier is a type error rather than a wrong answer.
  • FindStat's Mp00273, the inverse of GrayNext. The zero word gets its last letter flipped.

Examples

Basic #

the binary word 0110001100

live ↗
InGrayPrevious(BinaryWord⁡([0,1,1,0,0]))\mathrm{GrayPrevious}({\operatorname{BinaryWord}}([0, 1, 1, 0, 0]))OutBinaryWord⁡([0,1,0,0,0]){\operatorname{BinaryWord}}([0, 1, 0, 0, 0])
About
Examples1
CrosswalkFindStat