If I have a sequence 1,2,3,.. 1000. I can find a gap by summing up and subtrating from the sum of 1.. 1000 (usually with a known formula like n x (n+1) / 2 but with processing power I can just add 1 ... 1000 with a computer program).
If there is a two number gap, I can add squares as well and...