# Problem 57492. Compute the Tetris sequence

In the Tetris sequence, which starts with a 1, the next term is the smallest positive integer not already in the sequence that has no common 1-bits with the previous term. The first five terms are 1, 2, 4, 3, and 8 because the binary expansions 0001, 0010, 0100, 0011, and 1000 have no common ones among consecutive terms, and they are the smallest numbers with that property not already in the sequence.
The discussion of this sequence involves odd gaps in the plot of the terms (say) as a function of their position n in the sequence. A plot of vs. (below) makes one think of the Sierpinski gasket. Neil J.A. Sloane uses this resemblance to propose using “facial recognition” to connect sequences.
Write a function to compute the nth term of the Tetris sequence.

### Solution Stats

88.89% Correct | 11.11% Incorrect
Last Solution submitted on Apr 30, 2024

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!