Free Online Utility • MATH Studio • Exact BigInt Engine

Generate Rudin-Shapiro Sequence

Generate the Golay–Rudin–Shapiro sequence (OEIS A020985: +1, +1, +1, -1, +1, +1, -1, +1, ...) and its 0/1 binary parity form (A020987) with partial sums and JSON export.

Formula & Quick Reference Live Engine
e₂(n) = popcount(n AND (n >> 1))   (counts overlapping '11' blocks in binary n)
A020985: a(n) = (-1)^(e₂(n))   (+1, +1, +1, -1, +1, +1, -1, +1, ...)
A020987: b(n) = e₂(n) mod 2    (0, 0, 0, 1, 0, 0, 1, 0, ...)
00
311
6110
OEIS A020985 • Overlapping '11' Binary Parity
Rudin–Shapiro Sequence

        
Instant client-side computation • Exact sequence math OEIS Verified

Session Calculation Log

No entries recorded in this session yet.

Complete Technical Guide to Generate Rudin-Shapiro Sequence

The Golay–Rudin–Shapiro sequence (OEIS A020985) assigns +1 or −1 to each non-negative integer n based on the parity of overlapping '11' substrings in the binary expansion of n. Remarkably, its trigonometric polynomials have ultra-flat Fourier spectra bounded tightly by √(2N)!

Switch between classical ±1 notation (OEIS A020985) and binary 0/1 parity form (OEIS A020987), inspect the exact partial sum bound, and export up to 4,096 terms cleanly.

Bitwise Overlapping-'11' Formula

e₂(n) = popcount(n AND (n >> 1))   (counts overlapping '11' blocks in binary n)
A020985: a(n) = (-1)^(e₂(n))   (+1, +1, +1, -1, +1, +1, -1, +1, ...)
A020987: b(n) = e₂(n) mod 2    (0, 0, 0, 1, 0, 0, 1, 0, ...)

Because `n & (n >> 1)` sets a bit precisely wherever two adjacent bits of n are both 1, the popcount gives the exact count of overlapping '11' pairs in O(1) bit operations.

How to Use Generate Rudin-Shapiro Sequence

  1. 1Choose count (1–4,096) and +1/-1 or 0/1 format.
  2. 2Review the exact partial sum (proven bounded by √(6N)).
  3. 3Copy or export JSON/TXT.

Reference Examples & Worked Benchmarks

nBinary'11' CountA020985A020987
000+10
3111-11
61101-11
71112+10

Practical Applications & Engineering Workflows

Signal Processing & Radar

Golay complementary sequences derived from Rudin–Shapiro minimize peak-to-average power ratio (PAPR) in OFDM and radar pulse compression.

Accuracy, Edge Cases & Best Practices

  • Partial sums of the ±1 sequence are always strictly positive for every N >= 1.

All calculations execute locally inside your browser using JavaScript with zero server round-trips, guaranteeing instant responsiveness and complete data privacy.

Frequently Asked Questions

Why is a(7) = +1 even though binary 7 is 111?
Binary 111 contains TWO overlapping '11' substrings (positions 0–1 and 1–2), and (−1)² = +1.