Get reference code
Appearance
Sample
StudyMath

Gaps and missing numbers finder

This online calculator helps you find gaps and missing numbers in a sequence of numbers.
Timur2017-10-20 12:41:32

Below is the simple calculator which can help you to find missing numbers in an integer sequence. Let's suppose you have text file of consecutive numbers, like this, each number on its own line

1
2
3
4
6
7
12
13
18

However, there are some missing numbers and gaps. For the example above, 5 is missing, and there are two gaps: between 8 and 11 and between 14 and 17.

Of course, in this example you can find all problems by yourself, but if we talk about thousands of numbers, it will be too cumbersome. That's why I've created this calculator. You can paste list of numbers in there, and it will display all missing numbers and gaps it was able to find in the sequence bounded by the first and the last line of the list.

I have also added couple of options:

  • You can set "Collapse gaps" checkbox to output gaps in collapsed form, in other words, as 8 - 11, there 8 is the start of the gap and 11 is the end of the gap. This option turned on by default. If you uncheck it, you will get list of all numbers in a gap, i.e. 8, 9, 10, 11.
  • You can set "Use regular expression to parse number" checkbox to parse line of your text file with regular expression.

The reason for the second option is that probably you rarely have list of just numbers. Your text file can include additional text, something like this:
1 Paper beats stone
2 Scissors beats paper
3 Stone beats scissors

For that case, you can use regular expression to extract number from line and then check the sequence. You need to set "Use regular expression to parse number" checkbox and enter regular expression and match group which will be used to extract number.
Default regular expression matches line where number is placed at the beginning of the line.

Gaps and missing numbers finderCreative Commons Attribution/Share-Alike License 3.0 (Unported)
Missing numbers and gaps 

Request a calculator
View all calculators
(514 calculators in total. )

Comments