cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A268676 a(n) = A101080(n,A268823(3+n)), where A101080(x,y) gives the Hamming distance between binary expansions of x and y.

This page as a plain text file.
%I A268676 #39 Mar 12 2024 15:42:58
%S A268676 1,3,3,1,3,1,1,3,3,1,1,3,1,3,3,1,3,1,1,3,1,3,3,1,1,3,3,1,3,1,1,3,3,1,
%T A268676 1,3,1,3,3,1,1,3,3,1,3,1,1,3,1,3,3,1,3,1,1,3,3,1,1,3,1,3,3,1,3,1,1,3,
%U A268676 1,3,3,1,1,3,3,1,3,1,1,3,1,3,3,1,3,1,1,3,3,1,1,3,1,3,3,1,1,3,3,1,3,1,1,3,3,1,1,3,1,3,3,1,3,1,1,3,1,3,3,1,1
%N A268676 a(n) = A101080(n,A268823(3+n)), where A101080(x,y) gives the Hamming distance between binary expansions of x and y.
%C A268676 It seems that A001969 gives the positions of 1's, while A000069 gives the positions of 3's.
%C A268676 The above observation follows because by definition, a(n) gives the Hamming distance between binary expansions of n and A003188(3+A006068(n)). To see how this leads to the stated claim, consider the illustration "Visualized as a traversal of vertices of a tesseract" in the Wikipedia article "Gray code".  Starting from any vertex with either (A) an even, or (B) an odd number of 1-bits, traverse three edges along the red path, to the direction indicated by the arrow, and then note the Hamming distance between the starting and the ending vertex. It is always 1 in case (A), and 3 in case (B), because the position of the flipped bit is given by sequence A007814, with its every other term zero, so in case (A) the third flip cancels the first flip (both toggling the rightmost bit), which leaves only the second bit-flip effective. Note that the properties of a tesseract generalize to those of an infinite dimensional hypercube. - _Antti Karttunen_, Mar 11 2024
%H A268676 Antti Karttunen, <a href="/A268676/b268676.txt">Table of n, a(n) for n = 0..8191</a>
%H A268676 Wikipedia, <a href="https://en.wikipedia.org/wiki/Gray_code">Gray code</a>.
%F A268676 a(n) = A101080(n,A268823(3+n)), where A101080(x,y) gives the Hamming distance between binary expansions of x and y.
%F A268676 a(n) = 2 - (-1)^A000120(n) = 2 - A106400(n). - _Lorenzo Sauras Altuzarra_, Mar 10 2024
%F A268676 a(n) = 1 + 2 * A010060(n). - _Joerg Arndt_, Mar 11 2024
%p A268676 a := n -> 2-(-1)^add(convert(n, base, 2)):
%p A268676 seq(a(n), n = 0 .. 120); # _Lorenzo Sauras Altuzarra_, Mar 10 2024
%o A268676 (Scheme) (define (A268676 n) (A101080bi n (A268823 (+ 3 n))))
%o A268676 ;; Where A101080bi implements the dyadic function A101080(x,y) which gives the Hamming distance between binary expansions of x and y.
%o A268676 (PARI)
%o A268676 A003188(n) = bitxor(n, n>>1);
%o A268676 A006068(n) = { my(s=1, ns); while(1, ns = n >> s; if(0==ns, return(n)); n = bitxor(n, ns); s <<= 1); };
%o A268676 A268676(n) = hammingweight(bitxor(n,A003188(3+A006068(n)))); \\ _Antti Karttunen_, Mar 11 2024
%o A268676 (PARI) A268676(n) = 2-((-1)^hammingweight(n)); \\ _Antti Karttunen_, Mar 11 2024, after _Lorenzo Sauras Altuzarra_'s Maple-code.
%Y A268676 Row 3 of A268833.
%Y A268676 Cf. A000069, A000120, A001969, A003188, A006068, A007814, A010060, A101080, A106400, A268823.
%K A268676 nonn
%O A268676 0,2
%A A268676 _Antti Karttunen_, Feb 19 2016