This is called "smart numbers" or "intelligent numbers" and is generally considered a bad practice. That said, I can't think of a better approach, but have never tried to solve this problem so that's only maybe four or five brain cells. -- Mitch