# Generate a sequence of sequences

Imagine I have a sequence of M integers each of which is either zero or one. How do I generate a sequence of all such 2^M sequences?

• Tuples[{0, 1}, m]? – kglr Sep 29 at 9:37

## 2 Answers

You can also use Tuples:

m = 5;
Tuples[{0, 1}, m]


Look up IntegerDigits.

m = 5;

IntegerDigits[Range[0, 2^m - 1], 2, m]