title: Euclid–Mullin sequence
text: # Euclid–Mullin sequence
  
  The Euclid–Mullin sequence is an infinite sequence of distinct prime numbers, in which each element is the least prime factor of one plus the product of all earlier elements. They are named after the ancient Greek mathematician Euclid, because their definition relies on an idea in Euclid's proof that there are infinitely many primes, and after Albert A. Mullin, who asked about the sequence in 1963.
  
  The first 51 elements of the sequence are
  
      2, 3, 7, 43, 13, 53, 5, 6221671, 38709183810571, 139, 2801, 11, 17, 5471, 52662739, 23003, 30693651606209, 37, 1741, 1313797957, 887, 71, 7127, 109, 23, 97, 159227, 643679794963466223081509857, 103, 1079990819, 9539, 3143065813, 29, 3847, 89, 19, 577, 223, 139703, 457, 9649, 61, 4357, 87991098722552272708281251793312351581099392851768893748012603709343, 107, 127, 3313, 227432689108589532754984915075774848386671439568260420754414940780761245893, 59, 31, 211... (sequence A000945 in the OEIS)
  
  These are the only known elements as of September 2012. Finding the next one requires finding the least prime factor of a 335-digit number (which is known to be composite).
  
  ## Definition
  
  The $n$th element of the sequence, $a_{n}$, is the least prime factor of
  
      ${\Bigl\prod _{i<n}a_{i}{\Bigr )}+1\,.$
  
  The first element is therefore the least prime factor of the empty product plus one, which is 2. The third element is (2 × 3) + 1 = 7. A better illustration is the fifth element in the sequence, 13. This is calculated by (2 × 3 × 7 × 43) + 1 = 1806 + 1 = 1807, the product of two primes, 13 × 139. Of these two primes, 13 is the smallest and so included in the sequence. Similarly, the seventh element, 5, is the result of (2 × 3 × 7 × 43 × 13 × 53) + 1 = 1244335, the prime factors of which are 5 and 248867. These examples illustrate why the sequence can leap from very large to very small numbers.
  
  ## Properties
  
  The sequence is infinitely long and does not contain repeated elements. This can be proved using the method of Euclid's proof that there are infinitely many primes. That proof is constructive, and the sequence is the result of performing a version of that construction.
  
  ## Conjecture
  
  Does every prime number appear in the Euclid–Mullin sequence?
  
  Mullin (1963) asked whether every prime number appears in the Euclid–Mullin sequence and, if not, whether the problem of testing a given prime for membership in the sequence is computable. Daniel Shanks (1991) conjectured, on the basis of heuristic assumptions that the distribution of primes is random, that every prime does appear in the sequence. However, although similar recursive sequences over other domains do not contain all primes, these problems both remain open for the original Euclid–Mullin sequence. The least prime number not known to be an element of the sequence is 41.
  
  The positions of the prime numbers from 2 to 97 are:
  
      2:1, 3:2, 5:7, 7:3, 11:12, 13:5, 17:13, 19:36, 23:25, 29:33, 31:50, 37:18, 41:?, 43:4, 47:?, 53:6, 59:49, 61:42, 67:?, 71:22, 73:?, 79:?, 83:?, 89:35, 97:26 (sequence A056756 in the OEIS)
  
  where ? indicates that the position (or whether it exists at all) is unknown as of 2012.
  
  ## Related sequences
  
  A related sequence of numbers determined by the largest prime factor of one plus the product of the previous numbers (rather than the smallest prime factor) is also known as the Euclid–Mullin sequence. It grows more quickly, but is not monotonic. The numbers in this sequence are
  
      2, 3, 7, 43, 139, 50207, 340999, 2365347734339, 4680225641471129, 1368845206580129, 889340324577880670089824574922371, … (sequence A000946 in the OEIS).
  
  Not every prime number appears in this sequence, and the sequence of missing primes,
  
      5, 11, 13, 17, 19, 23, 29, 31, 37, 41, 47, 53, 59, 61, 67, 71, 73, ... (sequence A216227 in the OEIS)
  
  has been proven to be infinite.
  
  It is also possible to generate modified versions of the Euclid–Mullin sequence by using the same rule of choosing the smallest prime factor at each step, but beginning with a different prime than 2.
  
  Alternatively, taking each number to be one plus the product of the previous numbers (rather than factoring it) gives Sylvester's sequence. The sequence constructed by repeatedly appending all factors of one plus the product of the previous numbers is the same as the sequence of prime factors of Sylvester's sequence. Like the Euclid–Mullin sequence, this is a non-monotonic sequence of primes, but it is known not to include all primes.
  
  