This is the same problem as the Social Security Number validator - assume you have a list of all valid SSN's. Design a program/data structure to rapidly tell you if a given SSN is valid.

Bit vector turns out to be the only really fast solution that fits in memory.