Generate Rudin-Shapiro Sequence

Generate the Rudin-Shapiro sequence — a binary sequence defined by counting pairs of consecutive 1s in the binary representation of n, modulo 2.

Options
Rudin-Shapiro Sequence Options
Starting index for the Rudin-Shapiro sequence.
How many elements to generate?
Delimiter among sequence elements.
(Newline by default.)
Output (Rudin-Shapiro Sequence)

What It Does

Generate the Rudin-Shapiro sequence — a binary sequence defined by counting pairs of consecutive 1s in the binary representation of n, modulo 2.

How It Works

Generate Rudin-Shapiro Sequence produces new output from rules, parameters, or patterns instead of editing an existing document. That makes input settings more important than input text, because the settings are what define the shape of the result.

Generators are only as useful as the settings behind them. When the output seems off, check the count, range, delimiter, seed values, or pattern options before judging the result itself.

All processing happens in your browser, so your input stays on your device during the transformation.

Common Use Cases

  • Study sequences with flat Fourier coefficients
  • Research pseudorandom binary sequences
  • Explore automatic sequences
  • Generate reference data for signal processing research
  • Educational materials on binary-defined sequences

How to Use

  1. Specify term count.
  2. Click Generate.
  3. View sequence.
  4. Copy.

Features

  • Generates Rudin-Shapiro terms
  • Shows binary analysis
  • Flat spectral property explanation
  • Large sequence support
  • Comparison with Thue-Morse

Examples

Below is a representative input and output so you can see the transformation clearly.

Input
n: 8
Output
1 1 1 -1 1 1 -1 1

Edge Cases

  • Very large inputs can still stress the browser, especially when the tool is working across many numbers. Split huge jobs into smaller batches if the page becomes sluggish.
  • Empty or whitespace-only input is technically valid but may produce unchanged output, which can look like a failure at first glance.
  • If the output looks wrong, compare the exact input and option values first, because Generate Rudin-Shapiro Sequence should be repeatable with the same settings.

Troubleshooting

  • Unexpected output often means the input is being split or interpreted at the wrong unit. For Generate Rudin-Shapiro Sequence, that unit is usually numbers.
  • If a previous run looked different, check for hidden whitespace, changed separators, or a setting that was toggled accidentally.
  • If nothing changes, confirm that the input actually contains the pattern or structure this tool operates on.
  • If the page feels slow, reduce the input size and test a smaller sample first.

Tips

The Rudin-Shapiro sequence has remarkably flat partial Fourier sums, making it useful in signal processing and analysis.

Rudin-Shapiro Sequence

Count the number of occurrences of '11' (overlapping) in the binary representation of n. If this count is even, R(n)=1; if odd, R(n)=-1 (or equivalently 0 in the {0,1} version). The sequence begins: 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, ....

Spectral Properties

The Rudin-Shapiro sequence was independently discovered by Walter Rudin and Harold Shapiro for its remarkable property: the partial sums of its Fourier series are bounded by C√n. This 'flatness' makes it valuable in harmonic analysis and digital signal processing.

Frequently Asked Questions

How is the sequence computed?

Count overlapping '11' pairs in the binary representation of n. Even count → +1, odd count → -1.

What makes it useful?

Its Fourier transform has unusually flat partial sums, bounded by O(√n), which is optimal.

Is it periodic?

No. It is aperiodic but deterministic.

Who discovered it?

Independently by Walter Rudin (1959) and Harold Shapiro (1951).

Is it a 2-automatic sequence?

Yes. Like Thue-Morse and Baum-Sweet, it is computable by a finite automaton reading binary digits.

How does it compare to Thue-Morse?

Both are automatic binary sequences, but they have different spectral properties. Thue-Morse has a singular continuous spectrum; Rudin-Shapiro has a flat spectrum.