in reply to Re^2: find which ranges share at least one common value
in thread find which ranges share at least one common value

Then a modified version of inversion lists should work very well. See for example my replies to Optimizing a double loop.
  • Comment on Re^3: find which ranges share at least one common value