One way would be to use python list comprehensions. This will select brick 1 to 4. (Note that even though it says 1-5, 5 is not included)
Not the most efficient, but it will work.
Code:
python("cmds.select(['brick%s' % n for n in range(1,5)])");
Imagination is more important than knowledge.