Gaps and missing numbers finder

This online calculator helps you find gaps and missing numbers in an integer sequence.

This page exists due to the efforts of the following people:

Timur

Timur

Karen Luckhurst

Created: 2017-10-20 12:41:32, Last updated: 2022-02-09 09:19:07
Creative Commons Attribution/Share-Alike License 3.0 (Unported)

This content is licensed under Creative Commons Attribution/Share-Alike License 3.0 (Unported). That means you may freely redistribute or modify this content under the same license conditions and must attribute the original author by placing a hyperlink from your site to this work https://planetcalc.com/7471/. Also, please do not modify any references to the original work (if any) contained in this content.

Disclaimer: This calculator was made for a specific purpose to find gaps in a continuous number sequence. If you are looking for math problem solving, then it is probably about arithmetic sequence or geometric sequence - please look at Arithmetic sequence calculator and problems solver or Geometric sequence calculator and problems solver

Let's suppose you have a text file of consecutive numbers, such as below, with each number on its own line:

1
2
3
4
6
7
12
13
18

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

Of course, in this example, it is easy to see the problems just by looking at numbers, but if we were talking about thousands of numbers, it would be too cumbersome to locate the gaps by eye. That's why I've created this calculator. You can paste in a list of numbers, and it will display all the 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 a couple of options:

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

The reason for the second option is that your list is unlikely to include just numbers. Your text file will probably include additional text, something like:
1 Paper beats stone
2 Scissors beat paper
3 Stone beats scissors

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

PLANETCALC, Gaps and missing numbers finder

Gaps and missing numbers finder

Missing numbers and gaps
 

URL copied to clipboard
PLANETCALC, Gaps and missing numbers finder

Comments