Euclide-Mullin Sequence

Author

Eric W. Weisstein
March 10, 2005

This notebook downloaded from http://mathworld.wolfram.com/notebooks/PrimeNumbers/Euclid-MullinSequence.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/Euclid-MullinSequence.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Recurrence

Off[General::"stop"];
LeastPrimeFactor[1]:=1
LeastPrimeFactor[n_]:=
Check[FactorInteger[n,FactorComplete->False],FactorInteger[n]][[1,1]]

EuclidMullin[1]:=2
EuclidMullin[n_]:=EuclidMullin[n]=
LeastPrimeFactor[Times@@(EuclidMullin/@Range[n-1])+1]

Do[
Print[{n,EuclidMullin[n]//Timing}],
{n,20}]

Do[
Print[{n,EuclidMullin[n]//Timing}],
{n,20,43}]

Enumeration

l={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};

Length[l]

p=1+Times@@l

PrimeQ[p]

Length[IntegerDigits[p]]