# Counting Integers in a Range

\(\bullet\) If you are given an inclusive range of integers, for example, \[a\leqslant n\leqslant b,\] then there will be \(b-a+1\) integers in this range.

\(\bullet\) If you are given an exclusive range of integers, for example, \[a <n <b,\] then there will be \(b-a-1\) integers in this range.

\(\bullet\) If you are given a range of integers that has the form \[\begin{array} &a <n\leqslant b &\text{ or } &a\leqslant n<b, \end{array}\] then there will be \(b-a\) integers in this range.

## <Example Problem #1>

## How many integers are there in the open interval \((-10, 5)?\)

The number of integers is \(5-(-10)-1=14.\)

## <Example Problem #2>

## How many integers are there in the closed interval \([-1, 99]?\)

The number of integers is \(99-(-1)+1=101.\)

## <Example Problem #3>

## What is the total number integers in the intervals \((-15, -4]\) and \([0, 22)?\)

The total number of integers is \((-4-(-15))+(22-0)=11+22=33.\)

## <Example Problem #4>

## What is the total number integers in the intervals \[(-4, -3), (-2, -1), (0, 1)?\]

The total number of integers is \[\begin{align} (-3-(-4)-1)+(-1-(-2)-1)+(1-(0)-1)&=0+0+0\\ &=0. \end{align}\]

## <Example Problem #5>

## Which of the following intervals has the most number of integers: \[\begin{array} & (-23, -7), & (-12, 3], & [0, 15), & [99, 114]? \end{array}\]

The number of integers in the interval \((-23, -7)\) is \(-7-(-23)-1=15.\)

The number of integers in the interval \((-12, 3]\) is \(3-(-12)=15.\)

The number of integers in the interval \([0, 15)\) is \(15-0=15.\)

The number of integers in the interval \([99, 114]\) is \(114-99+1=16.\)Hence, the interval \([99, 104]\) has the most number of integers.

## <Example Problem #6>

## Both \(A\) and \(B\) are integers such that \(A<B\) and the number of integers in the interval \((A, B)\) is \(99.\) What is \(A-B?\)

The number of integers in the interval \((A, B)\) is \(B-A-1.\) Since this is equal to \(99,\) we have \[B-A-1=99 \Rightarrow A-B=-1-99=-100.\]

**Cite as:**Counting Integers in a Range.

*Brilliant.org*. Retrieved from https://brilliant.org/wiki/counting-integers-in-a-range/