where the first term is not zero and each consecutive pair of terms in the sum has the same ratio, called the *common ratio*. In the example above we have `1/(1/2) = 2`, `(1/2)/(1/4) = 2`, etc... While seemingly fairly simple this type of sum is found extensively in many areas including [geometry of real numbers](https://en.wikipedia.org/wiki/Cantor_set), [fractals](https://en.wikipedia.org/wiki/Geometric_series#Fractal_geometry), [probability](https://math.stackexchange.com/questions/1164163/introduction-to-probability-dice), [economics](https://en.wikipedia.org/wiki/Annuity#Proof_of_annuity-immediate_formula), converting rational numbers from decimal form to fraction form (see below) and more.
It is common to see the common ratio between terms denoted by `r`, so if a geometric series starts with first term `a`, the series is
```
a + a*r + a*r^2 + a*r^3 + a*r^4 + ...
```
When summing an infinite number of terms (such as 1 + 1 + 1 + 1 + ...) it is not clear the sum should be a number, but a remarkable property about geometric series is that the sum is always a number when `-1 < r < 1` and otherwise the sum is not a number (e.g., our `1 + 1 + 1 + ...` series tends to infinite, so is not a number). To see why, suppose we are only interested in the first `n + 1` terms of the series,
```
a + a*r + a*r^2 + ... + a*r^n
```
This is a sum of a `n + 1` numbers, so is certainly a real number itself. If we call this number `S_n`, so
when `r` is not equal to 1 (we cannot divide by 0!). Now if `-1 < r < 1` then we know that `r^(n+1)` tends to 0 as `n` tends to infinity, so our sum `S_n` tends to
```
S = a*[1 - 0]/(1 - r) = a/(1 - r).
```
On the other hand, when `r > 1` or `r < 1` we know that `r^(n_1)` does not tend to a finite number, so the `S_n` do not tend to a finite number either. The only case we have not mentioned yet is when `r = 1`, but then the series is
```
S_n = a + a*1 + a*1^2 + ... + a*1^n = a + a + ... + a = (n + 1)*a
```
which certainly does not equal a number when `n` tends to infinity.
For example, the series with `a = 1` and `r = 1/2` above has sum
```
1/(1 - 1/2) = 1/(1/2) = 2.
```
(This particular sum is well known for [one](https://www.reddit.com/r/Jokes/comments/1423a4/an_infinite_number_of_mathematicians_walk_into_a/) or [two](https://www.reddit.com/r/Jokes/comments/929r9g/an_infinite_number_of_mathematicians_walk_into_a/) jokes.)
For the most complicated type of repeating decimal, consider one that starts with something different from the repeating pattern, e.g., `0.42567676767...` where after the initial 425 we repeat with 67 forever. This is simply