A344345 Digitally balanced numbers in Gray code: numbers whose binary reflected Gray code has the same number of 0's as 1's.
3, 8, 12, 14, 33, 35, 39, 47, 49, 51, 55, 57, 59, 61, 130, 132, 134, 136, 140, 142, 144, 152, 156, 158, 160, 176, 184, 188, 190, 194, 196, 198, 200, 204, 206, 208, 216, 220, 222, 226, 228, 230, 232, 236, 238, 242, 244, 246, 250, 517, 521, 523, 525, 529, 531, 535
Offset: 1
Examples
8 is a term since its Gray code, 1100, has 2 0's and 2 1's. 33 is a term since its Gray code, 110001, has 3 0's and 3 1's.
Links
- Amiram Eldar, Table of n, a(n) for n = 1..10000
- Eric Weisstein's World of Mathematics, Gray Code.
- Wikipedia, Gray code.
Crossrefs
Programs
-
Mathematica
gc[n_] := gc[n] = If[n <= 1, n, 2^(b = Floor@Log2[n]) + gc[2^(b + 1) - 1 - n]]; gcDigBalQ[n_] := Equal @@ DigitCount[gc[n], 2, {0, 1}]; Select[Range[500], gcDigBalQ]