A380667 First differences of the Golay-Rudin-Shapiro sequence (A020985), divided by 2.
0, 0, -1, 1, 0, -1, 1, 0, 0, 0, -1, 0, 0, 1, -1, 1, 0, 0, -1, 1, 0, -1, 1, -1, 0, 0, 1, 0, 0, -1, 1, 0, 0, 0, -1, 1, 0, -1, 1, 0, 0, 0, -1, 0, 0, 1, -1, 0, 0, 0, 1, -1, 0, 1, -1, 1, 0, 0, -1, 0, 0, 1, -1, 1, 0, 0, -1, 1, 0, -1, 1, 0, 0, 0, -1, 0, 0, 1, -1, 1, 0, 0, -1, 1, 0
Offset: 0
Links
- Paolo Xausa, Table of n, a(n) for n = 0..10000
Programs
-
Mathematica
Differences[RudinShapiro[Range[0, 100]]]/2
-
Python
def A380667(n): return (1 if m else -1) if (m:=(n&(n>>1)).bit_count()&1)^((n+1&(n+1>>1)).bit_count()&1) else 0 # Chai Wah Wu, Jan 30 2025