cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A005235 Fortunate numbers: least m > 1 such that m + prime(n)# is prime, where p# denotes the product of all primes <= p.

This page as a plain text file.
%I A005235 M2418 #202 Jul 16 2025 10:04:44
%S A005235 3,5,7,13,23,17,19,23,37,61,67,61,71,47,107,59,61,109,89,103,79,151,
%T A005235 197,101,103,233,223,127,223,191,163,229,643,239,157,167,439,239,199,
%U A005235 191,199,383,233,751,313,773,607,313,383,293,443,331,283,277,271,401,307,331
%N A005235 Fortunate numbers: least m > 1 such that m + prime(n)# is prime, where p# denotes the product of all primes <= p.
%C A005235 Reo F. Fortune conjectured that a(n) is always prime.
%C A005235 You might be searching for Fortunate Primes, which is an alternative name for this sequence. It is not the official name yet, because it is possible, although unlikely, that not all the terms are primes. - _N. J. A. Sloane_, Sep 30 2020
%C A005235 The first 500 terms are primes. - _Robert G. Wilson v_. The first 2000 terms are primes. - _Joerg Arndt_, Apr 15 2013
%C A005235 The strong form of Cramér's conjecture implies that a(n) is a prime for n > 1618, as previously noted by Golomb. - _Charles R Greathouse IV_, Jul 05 2011
%C A005235 a(n) is the smallest m such that m > 1 and A002110(n) + m is prime. For every n, a(n) must be greater than prime(n+1) - 1. - _Farideh Firoozbakht_, Aug 20 2003
%C A005235 If a(n) < prime(n+1)^2 then a(n) is prime. According to Cramér's conjecture a(n) = O(prime(n)^2). - _Thomas Ordowski_, Apr 09 2013
%C A005235 Conjectures from _Pierre CAMI_, Sep 08 2017: (Start)
%C A005235 If all terms are prime, then lim_{N->oo} (Sum_{n=1..N} primepi(a(n))) / (Sum_{n=1..N} n) = 3/2, and primepi(a(n))/n < 6 for all n.
%C A005235 Limit_{N->oo} (Sum_{n=1..N} a(n)) / (Sum_{n=1..N} prime(n)) = Pi/2.
%C A005235 a(n)/prime(n) < 8 for all n. (End)
%C A005235 Conjecture: Limit_{N->oo} (Sum_{n=1..N} a(n)) / (Sum_{n=1..N} prime(n)) = 3/2. - _Alain Rocchelli_, Dec 24 2022
%C A005235 The name "Fortunate numbers" was coined by Golomb (1981) after the New Zealand social anthropologist Reo Franklin Fortune (1903 - 1979). According to Golomb, Fortune's conjecture first appeared in print in Martin Gardner's Mathematical Games column in 1980. - _Amiram Eldar_, Aug 25 2020
%D A005235 Martin Gardner, The Last Recreations, Chapter 12: Strong Laws of Small Primes, Springer-Verlag, 1997, pp. 191-205, especially pp. 194-195.
%D A005235 Richard K. Guy, Unsolved Problems in Number Theory, 3rd ed., Springer, 1994, Section A2, p. 11.
%D A005235 Stephen P. Richards, A Number For Your Thoughts, 1982, p. 200.
%D A005235 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%D A005235 James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, pages 114-115.
%D A005235 David Wells, Prime Numbers: The Most Mysterious Figures In Math, Hoboken, New Jersey: John Wiley & Sons (2005), pp. 108-109.
%H A005235 Pierre CAMI, <a href="/A005235/b005235.txt">Table of n, a(n) for n = 1..3000</a> (first 2000 terms from T. D. Noe)
%H A005235 Ray Abrahams and Huon Wardle, <a href="https://www.jstor.org/stable/23819766">Fortune's 'Last Theorem'</a>, Cambridge Anthropology, Vol. 23, No. 1 (2002), pp. 60-62.
%H A005235 Cyril Banderier, <a href="http://algo.inria.fr/banderier/Computations/prime_factorial.html">Conjecture checked for n < 1000</a> [It has been reported that the data given here contains several errors]
%H A005235 C. K. Caldwell, <a href="https://primes.utm.edu/glossary/page.php?sort=FortunateNumber">Fortunate number</a>, The Prime Glossary.
%H A005235 Antonín Čejchan, Michal Křížek, and Lawrence Somer, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL25/Krizek/krizek3.html">On Remarkable Properties of Primes Near Factorials and Primorials</a>, Journal of Integer Sequences, Vol. 25 (2022), Article 22.1.4.
%H A005235 Martin Gardner, <a href="https://www.jstor.org/stable/24966473">Patterns in primes are a clue to the strong law of sma11 numbers</a>, Mathematical Games, Scientific American, Vol. 243, No. 6 (December, 1980), pp. 18-28.
%H A005235 Solomon W. Golomb, <a href="http://www.jstor.org/stable/2689634">The evidence for Fortune's conjecture</a>, Mathematics Magazine, Vol. 54, No. 4 (1981), pp. 209-210.
%H A005235 Richard K. Guy, <a href="/A005728/a005728.pdf">Letter to N. J. A. Sloane, 1987</a>
%H A005235 Richard K. Guy, <a href="http://www.jstor.org/stable/2322249">The strong law of small numbers</a>. Amer. Math. Monthly 95 (1988), no. 8, 697-712.
%H A005235 Richard K. Guy, <a href="/A005165/a005165.pdf">The strong law of small numbers</a>. Amer. Math. Monthly 95 (1988), no. 8, 697-712. [Annotated scanned copy]
%H A005235 Bill McEachen, <a href="http://garden.irmacs.sfu.ca/?q=op/maceachen_conjecture">McEachen Conjecture</a>
%H A005235 Romeo Meštrović, <a href="http://arxiv.org/abs/1202.3670">Euclid's theorem on the infinitude of primes: a historical survey of its proofs (300 BC--2012) and another new proof</a>, arXiv preprint arXiv:1202.3670 [math.HO], 2012.
%H A005235 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/FortunatePrime.html">Fortunate Prime</a>
%H A005235 Robert G. Wilson v, <a href="/A005235/a005235.pdf">Letter to N. J. A. Sloane with attachment, Jan 1992</a>
%F A005235 If x(n) = 1 + Product_{i=1..n} prime(i), q(n) = least prime > x(n), then a(n) = q(n) - x(n) + 1.
%F A005235 a(n) = 1 + the difference between the n-th primorial plus one and the next prime.
%F A005235 a(n) = A035345(n) - A002110(n). - _Jonathan Sondow_, Dec 02 2015
%e A005235 a(4) = 13 because P_4# = 2*3*5*7 = 210, plus one is 211, the next prime is 223 and the difference between 210 and 223 is 13.
%p A005235 Primorial:= 2:
%p A005235 p:= 2:
%p A005235 A[1]:= 3:
%p A005235 for n from 2 to 100 do
%p A005235   p:= nextprime(p);
%p A005235   Primorial:= Primorial * p;
%p A005235   A[n]:= nextprime(Primorial+p+1)-Primorial;
%p A005235 od:
%p A005235 seq(A[n],n=1..100); # _Robert Israel_, Dec 02 2015
%t A005235 NPrime[n_Integer] := Module[{k}, k = n + 1; While[! PrimeQ[k], k++]; k]; Fortunate[n_Integer] := Module[{p, q}, p = Product[Prime[i], {i, 1, n}] + 1; q = NPrime[p]; q - p + 1]; Table[Fortunate[n], {n, 60}]
%t A005235 r[n_] := (For[m = (Prime[n + 1] + 1)/2, ! PrimeQ[Product[Prime[k], {k, n}] + 2 m - 1], m++]; 2 m - 1); Table[r[n], {n, 60}]
%t A005235 FN[n_] := Times @@ Prime[Range[n]]; Table[NextPrime[FN[k] + 1] - FN[k], {k, 60}] (* _Jayanta Basu_, Apr 24 2013 *)
%t A005235 NextPrime[#]-#+1&/@(Rest[FoldList[Times,1,Prime[Range[60]]]]+1) (* _Harvey P. Dale_, Dec 15 2013 *)
%o A005235 (PARI) a(n)=my(P=prod(k=1,n,prime(k)));nextprime(P+2)-P \\ _Charles R Greathouse IV_, Jul 15 2011; corrected by _Jean-Marc Rebert_, Jul 28 2015
%o A005235 (Haskell)
%o A005235 a005235 n = head [m | m <- [3, 5 ..], a010051'' (a002110 n + m) == 1]
%o A005235 -- _Reinhard Zumkeller_, Apr 02 2014
%o A005235 (Sage)
%o A005235 def P(n): return prod(nth_prime(k) for k in range(1, n + 1))
%o A005235 it = (P(n) for n in range(1, 31))
%o A005235 print([next_prime(Pn + 2) - Pn for Pn in it]) # _F. Chapoton_, Apr 28 2020
%o A005235 (Python)
%o A005235 from sympy import nextprime, primorial
%o A005235 def a(n): psharp = primorial(n); return nextprime(psharp+1) - psharp
%o A005235 print([a(n) for n in range(1, 59)]) # _Michael S. Branicky_, Jan 15 2022
%Y A005235 Cf. A046066, A002110, A006862, A035345, A035346, A055211, A129912, A010051, A005408, A038771, A038711.
%K A005235 nonn,nice
%O A005235 1,1
%A A005235 _N. J. A. Sloane_