in reply to hashing intervals

It depends where your priority are: A trivial approach is a binary search in a sorted array where you store the upper bound for each interval (including the undefined ones).

Cheers Rolf

( addicted to the Perl Programming Language)