# Method For Determining if a Series of Integers Is Sequential or Not

I’m sure this must be a well known mathematical trick, but I actually figured this one out myself, so I’m understandably astonished:

I’ve discovered a neat math shortcut for determining whether or not an arbitrary group of integers are sequential (that is, if there are any gaps in the numbers).

## A group of unique integers is sequential if the difference between the largest integer and the smallest integer is equal to one less than the total number of integers.

Here are some examples:

e.g. 1

1,2,3,4,5

largest = 5

smallest = 1

largest – smallest = 5 – 1 = 4

count – 1 = 5 – 1 = 4

largest – smallest = count – 1 , therefore, the series is sequential

e.g. 2

1,2,3,4,6

largest = 6

smallest = 1

largest – smallest = 6 – 1 = 5

count – 1 = 5 – 1 = 4

largest – smallest ≠ count – 1 , therefore, the series is not sequential

e.g. 3

-3, -2, -1

largest = -1

smallest = -3

largest – smallest =-3 – -1 = -3 + 1 = -2

count – 1 = 3 – 1 = 2

largest – smallest = count – 1 , therefore, the series is sequential

e.g. 4

243, 246, 244, 245, 242, 247

largest = 247

smallest = 242

largest – smallest =247 – 242 = 5

count – 1 = 6 – 1 = 5

largest – smallest = count – 1 , therefore, the series is sequential

Neat, huh?

## 2 thoughts on “Method For Determining if a Series of Integers Is Sequential or Not”

1. Chris says:

How about this?

1,2,3,3,5

largest = 5

smallest = 1

largest – smallest = 5 – 1 = 4

count – 1 = 5 – 1 = 4

largest – smallest = count – 1 , therefore, the series is sequential?

• Don Dueck says:

Good catch! I was making the assumption that all the numbers were unique — the problem I was solving dealt with unique numbers only.

I’ll have to amend my description of the trick.