**Sylvester's sequence** is a sequence defined as follows:^{[1]}

\[S_1 = 2\]

\[S_{n+1} = \prod^n_{i=1}S_n + 1\]

In other words, it begins with 2 and then each member of the sequence is the product of all of the previous terms, plus 1. Equivalently, it can be defined by a recurrence \(S_1=2,S_{n+1}=S_n^2-S_n+1\). Sylvester's sequence begins 2, 3, 7, 43, 1807, 3,263,443, 10,650,056,950,807... and it achieves a doubly exponential growth rate. Remarkably, there is a constant \(E\) such that \(S_n = \left\lfloor E^{2^{n + 1}} + 1/2 \right\rfloor\).

The sequence is named after James Joseph Sylvester who investigated it in 1880. It can be used to show that there are infinitely many prime numbers, since it is easy to see that no terms of the sequence have any prime factors in common.

If a sequence has \(a_n \geq a_{n-1}^2 - a_n + 1\) and the sums of the reciprocals of \(a_i\) add to a rational number, then for all sufficiently large \(n\) Sylvester's recurrence relation \(a_n = a_{n-1}^2 - a_n + 1\) must hold.