# Examples and counterexamples in mathematics/Infinite sequences

296280 more-or-less notable sequences are collected on The On-Line Encyclopedia of Integer Sequences. See also mathigon, mathsisfun etc.

## A sequence of equal members

(0,0,0,0,...)

Unlike a set, a sequence may contain nothing but zero and still be infinite. That is, all members (in other words, elements or terms) of a sequence may be equal to 0; or, say, to 71, if you prefer: (71,71,71,71,...).

## The sequence of natural numbers

(1,2,3,...)

The n-th member is equal to n.

This sequence is strictly increasing (that is, each member is less than the next member).

The odd subsequence (1,3,5,...) contains all odd natural numbers; the even subsequence (2,4,6,...) contains all even natural numbers. More generally, for every sequence ${\displaystyle (a_{1},a_{2},a_{3},\dots )}$  one may consider its odd subsequence ${\displaystyle (a_{1},a_{3},a_{5},\dots )}$  and even subsequence ${\displaystyle (a_{2},a_{4},a_{6},\dots ).}$

## All integers in a sequence

(0,1,-1,2,-2,...)

Existence of such sequence shows that the set of all integers (including negative) is countable.

This sequence is non-monotone (that is, neither increasing nor decreasing). All integers cannot be contained in a monotone sequence, since an increasing sequence is bounded from below, and a decreasing sequence is bounded from above (think, why).

The n-th member is equal to

${\displaystyle {\begin{cases}-(n-1)/2&{\text{for odd }}n,\\n/2&{\text{for even }}n.\end{cases}}}$

Just for fun, these two formulas may be combined,

${\displaystyle {\frac {1+(-1)^{n}(2n-1)}{4}},}$

but this is not required. Two (and more) formulas are a legitimate way to define a sequence. More generally, any two sequences ${\displaystyle (a_{1},a_{2},\dots )}$  and ${\displaystyle (b_{1},b_{2},\dots )}$  may be interspersed into a single sequence ${\displaystyle (c_{1},c_{2},\dots )=(a_{1},b_{1},a_{2},b_{2},\dots );}$  here

${\displaystyle c_{n}={\begin{cases}a_{(n+1)/2}&{\text{for odd }}n,\\b_{n/2}&{\text{for even }}n.\end{cases}}}$

The odd subsequence ${\displaystyle (c_{1},c_{3},c_{5},\dots )}$  of the new sequence ${\displaystyle (c_{1},c_{2},\dots )}$  is equal to the first sequence ${\displaystyle (a_{1},a_{2},\dots );}$  similarly, the even subsequence ${\displaystyle (c_{2},c_{4},c_{6},\dots )}$  equals ${\displaystyle (b_{1},b_{2},\dots ).}$

## A sequence containing every natural number infinitely many times

(1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,5,1,2,...)

The odd subsequence (1,1,1,...) contains only 1. The even subsequence (2,3,2,4,2,3,2,5,2,...) differs from the whole sequence only by 1 added to every member. Thus, the odd subsequence of the even subsequence contains only 2. And so on... That is, denoting n-th member by ${\displaystyle a_{n},}$  we have ${\displaystyle a_{2n}=a_{n}+1.}$

The n-th member is equal to the number q such that ${\displaystyle {\frac {n}{2^{q-1}}}}$  is an odd integer. Thus, ${\displaystyle {\frac {n}{2^{q-1}}}=2p-1}$  for some integer p. Using this p instead of q we get another sequence containing every natural number infinitely many times:
(1,1,2,1,3,2,4,1,5,3,6,2,7,4,...)
The odd subsequence is just (1,2,3,...). The even subsequence (1,1,2,1,3,2,4,...) is equal to the whole sequence. That is, denoting n-th member by ${\displaystyle b_{n},}$  we have ${\displaystyle b_{2n}=b_{n}.}$

In contrast, a monotone sequence cannot contain both 1 and 2 infinitely many times (think, why).

## All positive rationals in a sequence

${\displaystyle \textstyle {\Big (}1,{\frac {1}{2}},2,{\frac {1}{3}},3,1,4,{\frac {1}{4}},5,{\frac {3}{2}},6,{\frac {2}{3}},\dots {\Big )}}$

The n-th member is equal to ${\displaystyle {\frac {p}{q}}}$  for positive integers p, q such that ${\displaystyle n=(2p-1)\cdot 2^{q-1}.}$  That is, ${\displaystyle a_{(2p-1)\cdot 2^{q-1}}={\frac {p}{q}}.}$  Thus, ${\displaystyle \textstyle a_{1}=a_{1\cdot 2^{0}}=a_{(2\cdot 1-1)\cdot 2^{1-1}}={\frac {1}{1}}=1;}$  ${\displaystyle \textstyle a_{2}=a_{1\cdot 2^{1}}=a_{(2\cdot 1-1)\cdot 2^{2-1}}={\frac {1}{2}};}$  ${\displaystyle \textstyle a_{3}=a_{3\cdot 2^{0}}=a_{(2\cdot 2-1)\cdot 2^{1-1}}={\frac {2}{1}}=2;}$  ${\displaystyle \textstyle a_{4}=a_{1\cdot 2^{2}}=a_{(2\cdot 1-1)\cdot 2^{3-1}}={\frac {1}{3}};}$  ${\displaystyle \textstyle a_{5}=a_{5\cdot 2^{0}}=a_{(2\cdot 3-1)\cdot 2^{1-1}}={\frac {3}{1}}=3;}$  ${\displaystyle \textstyle a_{6}=a_{3\cdot 2^{1}}=a_{(2\cdot 2-1)\cdot 2^{2-1}}={\frac {2}{2}}=1;}$  and so on. Every positive rational number ${\displaystyle {\frac {p}{q}}}$  appears in this sequence as n-th member ${\displaystyle a_{n}}$  for ${\displaystyle n=(2p-1)\cdot 2^{q-1}.}$

Existence of such sequence shows that the set of all positive rational numbers is countable.

And moreover, ${\displaystyle {\frac {p}{q}}}$  appears infinitely many times, not only for ${\displaystyle n=(2p-1)\cdot 2^{q-1},}$  but also for ${\displaystyle n=(4p-1)\cdot 2^{2q-1},}$  ${\displaystyle n=(6p-1)\cdot 2^{3q-1}}$  and so on.

Every number is an accumulation point of this sequence (that is, every neighborhood of the given number contains infinitely many members of the sequence; equivalently, the given number is the limit of some subsequence). In contrast, a monotone sequence may have only one accumulation point, namely, the limit of the whole sequence (think, why).

The function f defined by ${\displaystyle f(q-1,p-1)+1=(2p-1)\cdot 2^{q-1}}$  for integer ${\displaystyle p,q>0,}$  that is, ${\displaystyle f(x,y)=(2y+1)\cdot 2^{x}-1}$  for integer ${\displaystyle x,y\geq 0,}$  is an example of the so-called pairing function.

## Factorials

(1,2,6,24,120,720,...)

The n-th member is equal n times the (n-1)-th member: ${\displaystyle a_{n}=na_{n-1}}$  for all ${\displaystyle n>1.}$  This is a so-called recurrence relation: each further member is defined as a function of its number and the preceding member.

And the first member is equal to one: ${\displaystyle a_{1}=1.}$  Thus, the n-th member is the product of all natural numbers from 1 to n; it is called the factorial of n and denoted by ${\displaystyle n!\,.}$  For instance, ${\displaystyle 5!=1\cdot 2\cdot 3\cdot 4\cdot 5=120.}$

Factorials are widely used. They appear in the binomial theorem, Taylor's theorem, most of well-known discrete probability distributions (binomial, negative binomial, multinomial, Poisson, hypergeometric) etc.

A wonderful approximation for large factorials is given by Stirling's formula ${\displaystyle \textstyle n!\sim {\sqrt {2\pi n}}\,n^{n}e^{-n}.}$  Its relative error ${\displaystyle \textstyle {\big |}1-{\frac {{\sqrt {2\pi n}}\,n^{n}e^{-n}}{n!}}{\big |}}$  tends to zero (as n tends to infinity), but the absolute error ${\displaystyle |n!-{\sqrt {2\pi n}}\,n^{n}e^{-n}|}$  tends to infinity.

## Fibonacci numbers

(1,1,2,3,5,8,13,21,...)

The n-th member is equal the (n-1)-th member plus the (n-2)-th member: ${\displaystyle a_{n}=a_{n-1}+a_{n-2}}$  for all ${\displaystyle n>2}$  (a recurrence relation, again). And the first two members are equal to one: ${\displaystyle a_{1}=a_{2}=1.}$  Thus, ${\displaystyle a_{3}=a_{2}+a_{1}=1+1=2;}$  ${\displaystyle a_{4}=a_{3}+a_{2}=2+1=3;}$  ${\displaystyle a_{5}=a_{4}+a_{3}=3+2=5;}$  and so on.

In the 17th century Johannes Kepler observed that ratios of consecutive Fibonacci numbers ${\displaystyle \textstyle {\big (}{\frac {1}{1}},{\frac {2}{1}},{\frac {3}{2}},{\frac {5}{3}},\dots {\big )}}$  converge to a limit: ${\displaystyle {\tfrac {a_{n+1}}{a_{n}}}\to \varphi }$  (as ${\displaystyle n\to \infty }$ ) for some number ${\displaystyle \varphi .}$  If so, then necessarily ${\displaystyle {\tfrac {a_{n+2}}{a_{n+1}}}\to \varphi ,}$  therefore ${\displaystyle {\tfrac {a_{n+1}+a_{n}}{a_{n+1}}}\to \varphi ,}$  that is, ${\displaystyle 1+{\tfrac {a_{n}}{a_{n+1}}}\to \varphi ;}$  taking into account that ${\displaystyle {\tfrac {a_{n}}{a_{n+1}}}\to {\tfrac {1}{\varphi }}}$  we get ${\displaystyle 1+{\tfrac {1}{\varphi }}=\varphi ,}$  that is, ${\displaystyle \varphi +1=\varphi ^{2};}$  a quadratic equation on ${\displaystyle \varphi .}$  It has two roots, ${\displaystyle (1\pm {\sqrt {5}})/2,}$  one greater than 1, another smaller than 1. Clearly, the limit ${\displaystyle \varphi }$  cannot be smaller than 1 (since ${\displaystyle {\tfrac {a_{n+1}}{a_{n}}}}$  cannot); thus, this limit (if exists) must be ${\displaystyle \varphi =(1+{\sqrt {5}})/2.}$  This number is the famous "golden ratio" treated already by Euclid about 2300 years ago.

We wonder about the error of the approximate equality ${\displaystyle {\tfrac {a_{n+1}}{a_{n}}}\approx \varphi }$  (for large n), that is, ${\displaystyle a_{n+1}\approx \varphi a_{n}.}$  The absolute error being ${\displaystyle |a_{n+1}-\varphi a_{n}|,}$  we investigate the difference ${\displaystyle a_{n+1}-\varphi a_{n};}$  how does it change with n? Is ${\displaystyle a_{n+2}-\varphi a_{n+1}}$  greater or smaller (in absolute value) than ${\displaystyle a_{n+1}-\varphi a_{n}?}$

Using the recurrence relation and the property of ${\displaystyle \varphi }$  we get ${\displaystyle a_{n+2}-\varphi a_{n+1}=a_{n+1}+a_{n}-\varphi a_{n+1}=(1-\varphi )a_{n+1}+a_{n}=-{\frac {1}{\varphi }}a_{n+1}+a_{n}=-{\frac {1}{\varphi }}(a_{n+1}-\varphi a_{n}),}$  which shows that the investigated difference changes the sign and decreases in the absolute value. By induction, ${\displaystyle a_{n+1}-\varphi a_{n}={\big (}-{\tfrac {1}{\varphi }}{\big )}^{n-1}(a_{2}-\varphi a_{1})}$  for all n. Introducing ${\displaystyle \psi =-{\tfrac {1}{\varphi }},}$  noting that ${\displaystyle \psi =1-\varphi }$  and recalling that ${\displaystyle a_{1}=a_{2}=1}$  we get ${\displaystyle a_{n+1}-\varphi a_{n}=\psi ^{n},}$  which shows that the absolute error is decreasing and converges to 0 (since ${\displaystyle -1<\psi <0}$ ). Existence of the limit follows: ${\displaystyle {\tfrac {a_{n+1}}{a_{n}}}=\varphi +{\tfrac {a_{n+1}-\varphi a_{n}}{a_{n}}}\to \varphi .}$

Interestingly, the property ${\displaystyle 1+{\tfrac {1}{\varphi }}=\varphi }$  of ${\displaystyle \varphi }$  leads to a similar property ${\displaystyle 1+{\tfrac {1}{\psi }}=\psi }$  of ${\displaystyle \psi ,}$  as follows: ${\displaystyle 1+{\tfrac {1}{\psi }}=1-\varphi =-{\tfrac {1}{\varphi }}=\psi .}$  Thus, ${\displaystyle \psi }$  is nothing but the other root of the quadratic equation: ${\displaystyle \psi =(1-{\sqrt {5}})/2.}$

The proof of the equality ${\displaystyle a_{n+1}-\varphi a_{n}={\big (}-{\tfrac {1}{\varphi }}{\big )}^{n-1}(a_{2}-\varphi a_{1})}$  given above does not use any other property of ${\displaystyle \varphi ,}$  and therefore it holds for ${\displaystyle \psi }$  as well: ${\displaystyle a_{n+1}-\psi a_{n}={\big (}-{\tfrac {1}{\psi }}{\big )}^{n-1}(a_{2}-\psi a_{1}),}$  that is (as before) ${\displaystyle a_{n+1}-\psi a_{n}=\varphi ^{n}.}$

Having explicit formulas for ${\displaystyle a_{n+1}-\varphi a_{n}=\psi ^{n}}$  and ${\displaystyle a_{n+1}-\psi a_{n}=\varphi ^{n}}$  it is easy to get an explicit formula for ${\displaystyle a_{n}.}$  We just subtract the first formula from the second and get ${\displaystyle (\varphi -\psi )a_{n}=\varphi ^{n}-\psi ^{n},}$  that is, the wonderful formula

${\displaystyle a_{n}={\frac {(1+{\sqrt {5}})^{n}-(1-{\sqrt {5}})^{n}}{2^{n}{\sqrt {5}}}}.}$

It follows that ${\displaystyle a_{n}}$  is the closest integer to ${\displaystyle \varphi ^{n}/{\sqrt {5}}.}$

## The decimal digits of the number ${\displaystyle \pi }$

(3,1,4,1,5,9,2,6,5,...)
By definition, n-th member of this sequence is equal to ${\displaystyle \lfloor 10\cdot \{10^{n-2}\pi \}\rfloor ;}$  here ${\displaystyle \lfloor x\rfloor }$  is the integral part of x, and ${\displaystyle \{x\}=x-\lfloor x\rfloor }$  is the fractional part of x. Thus,
the first member is ${\displaystyle \lfloor 10\cdot \{10^{-1}\pi \}\rfloor =\lfloor 10\cdot \{0.3141\dots \}\rfloor =\lfloor 10\cdot 0.3141\dots \rfloor =\lfloor 3.141\dots \rfloor =3;}$
the second member is ${\displaystyle \lfloor 10\cdot \{10^{0}\pi \}\rfloor =\lfloor 10\cdot \{3.141\dots \}\rfloor =\lfloor 10\cdot 0.141\dots \rfloor =\lfloor 1.41\dots \rfloor =1;}$
the third member is ${\displaystyle \lfloor 10\cdot \{10^{1}\pi \}\rfloor =\lfloor 10\cdot \{31.41\dots \}\rfloor =\lfloor 10\cdot 0.41\dots \rfloor =\lfloor 4.1\dots \rfloor =4;}$  and so on.

In order to calculate ${\displaystyle \pi }$  one may use the formula ${\displaystyle \textstyle \pi =3+{\frac {4}{2\cdot 3\cdot 4}}-{\frac {4}{4\cdot 5\cdot 6}}+{\frac {4}{6\cdot 7\cdot 8}}-{\frac {4}{8\cdot 9\cdot 10}}+\dots .}$  Trillions (that is, millions of millions) of decimal digits of ${\displaystyle \pi }$  are calculated using better formulas. They look as if they are random! On one hand, this is natural, since we do not know any reason for any regularity in this sequence. On the other hand, this is paradoxical, since in these digits there is not the slightest chance. The equality ${\displaystyle \lfloor 10\cdot \{10^{1}\pi \}\rfloor =4}$  is a mathematical theorem, as well as the equality ${\displaystyle \lfloor 10\cdot \{10^{41}\pi \}\rfloor =9}$ , and the same can be said about ${\displaystyle \lfloor 10\cdot \{10^{n-2}\pi \}\rfloor }$  for every n. (See also Numerical calculations and rigorous mathematics.) Each of these (seemingly random) digits, being an eternal mathematical truth, could not be different. Тhis puzzling situation is vividly discussed, see Wicklin, Preuss, mathoverfow etc. "To put our ignorance in perspective, note that it is not even known that all digits appear infinitely often: perhaps Pi = 3.1415926.....01001000100001000001..." (Stan Wagon, Is Pi normal?)