A350784 Number of Gray code sequences of length 2*n where numbers are between 0 and 2*n-1.
1, 2, 2, 12, 8, 44, 192, 2688, 1344, 6896, 24228, 316848, 812624, 9158880, 75652512, 1813091520, 725236608, 3568226496, 11152502816, 137997707616, 309878131724
Offset: 1
Examples
The following Gray codes of length 10 contain only the numbers between 0 and 9: 0, 2, 3, 7, 6, 4, 5, 1, 9, 8; 0, 2, 6, 4, 5, 7, 3, 1, 9, 8; 0, 4, 5, 7, 6, 2, 3, 1, 9, 8; 0, 4, 6, 2, 3, 7, 5, 1, 9, 8; 0, 8, 9, 1, 3, 2, 6, 7, 5, 4; 0, 8, 9, 1, 3, 7, 5, 4, 6, 2; 0, 8, 9, 1, 5, 4, 6, 7, 3, 2; 0, 8, 9, 1, 5, 7, 3, 2, 6, 4. Therefore a(5) = 8.
Links
- Thomas König, Fortran program for calculating the sequence
- Wikipedia, Gray code
- Wikipedia, Hamming distance
Programs
-
Fortran
! See König link.
Formula
a(2^m) = A003042(m+1).
a(n) = 2 * A236602(n) for n >= 2. - Alois P. Heinz, Feb 01 2022
Extensions
a(17)-a(18) (via A236602) from Alois P. Heinz, Feb 01 2022
a(19)-a(20) from Martin Ehrenstein, Feb 16 2022
a(21) from Martin Ehrenstein, Feb 21 2022
Comments