A164677 For a binary reflected Gray code, the (Hamming/Euclidean) distance between 2 subsequent points x and y is 1, say in coordinate k. If y has a 1 in coordinate k and x has a 0, than (x,y) is indicated by k, if it is the other way around, (x,y) is indicated by -k. The sequence has a fractal character such that G(d+1) = G(d) d+1 R(G(d)) where R(G(d)) alters d --> -d and leaves all other numbers invariant.
1, 2, -1, 3, 1, -2, -1, 4, 1, 2, -1, -3, 1, -2, -1, 5, 1, 2, -1, 3, 1, -2, -1, -4, 1, 2, -1, -3, 1, -2, -1, 6, 1, 2, -1, 3, 1, -2, -1, 4, 1, 2, -1, -3, 1, -2, -1, -5, 1, 2, -1, 3, 1, -2, -1, -4, 1, 2, -1, -3, 1, -2, -1, 7, 1, 2, -1, 3, 1, -2, -1, 4, 1, 2, -1, -3, 1, -2, -1, 5
Offset: 1
References
- Jean-Paul Allouche and Jeffrey Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 203, Exercise 15.
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..8192
- Madeleine Goertz and Aaron Williams, The Quaternary Gray Code and How It Can Be Used to Solve Ziggurat and Other Ziggu Puzzles, arXiv:2411.19291 [math.CO], 2024. See pp. 2, 26.
- Index entries for sequences obtained by enumerating foldings.
Crossrefs
Absolute values give A001511.
Indices of negative terms are listed in A091067. - M. F. Hasler, Aug 06 2015
Cf. A034947.
Programs
-
Mathematica
a[n_] := KroneckerSymbol[-1, n] * IntegerExponent[2n, 2]; Array[a, 80] (* Jean-François Alcover, Sep 08 2019 *)
-
PARI
A164677(n)=(valuation(n,2)+1)*if(n>>valuation(n,2)%4==3,-1,1) \\ M. F. Hasler, Aug 06 2015
Formula
a(n) = (-1)^chi_A091067(n)*A001511(n), where chi_A091067 is the characteristic function of A091067. - M. F. Hasler, Aug 06 2015
Multiplicative with a(2^e) = e+1, and a(p^e) = (-1)^(e*(p-1)/2) for an odd prime p. - Amiram Eldar, Jun 09 2025
Extensions
More terms from Alois P. Heinz, Jan 30 2012
Comments