Generate gray code sequence.