%I M0858 N0327 #155 Sep 10 2024 04:03:12
%S 2,3,7,23,89,113,523,887,1129,1327,9551,15683,19609,31397,155921,
%T 360653,370261,492113,1349533,1357201,2010733,4652353,17051707,
%U 20831323,47326693,122164747,189695659,191912783,387096133,436273009,1294268491
%N Primes (lower end) with record gaps to the next consecutive prime: primes p(k) where p(k+1) - p(k) exceeds p(j+1) - p(j) for all j < k.
%C See the links by _Jens Kruse Andersen_ et al. for very large gaps.
%D B. C. Berndt, Ramanujan's Notebooks Part IV, Springer-Verlag, see p. 133.
%D D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, Vol. 3, Sect 6.1, Table 1.
%D M. Kraitchik, Recherches sur la Théorie des Nombres. Gauthiers-Villars, Paris, Vol. 1, 1924, Vol. 2, 1929, see Vol. 1, p. 14.
%D N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H John W. Nicholson, <a href="/A002386/b002386.txt">Table of n, a(n) for n = 1..82</a> (first 75 terms from M. F. Hasler and N. J. A. Sloane, terms n=76..77 added by Charles R Greathouse IV).
%H R. K. Guy, <a href="/A000978/a000978.pdf">Letter to N. J. A. Sloane, Aug 1986</a>
%H R. K. Guy, <a href="/A005667/a005667.pdf">Letter to N. J. A. Sloane, 1987</a>
%H Lutz Kämmerer, <a href="https://arxiv.org/abs/2012.14263">A fast probabilistic component-by-component construction of exactly integrating rank-1 lattices and applications</a>, arXiv:2012.14263 [math.NA], 2020.
%H Jens Kruse Andersen, <a href="http://primerecords.dk/primegaps/gaps20.htm">The Top-20 Prime Gaps</a>
%H Jens Kruse Andersen, <a href="http://primerecords.dk/primegaps/megagap3.htm">New largest known prime gap</a>
%H Jens Kruse Andersen, <a href="http://primerecords.dk/primegaps/maximal.htm">Maximal gaps</a>
%H Alexei Kourbatov, <a href="http://arxiv.org/abs/1309.4053">Tables of record gaps between prime constellations</a>, arXiv preprint arXiv:1309.4053 [math.NT], 2013.
%H Alexei Kourbatov, <a href="https://arxiv.org/abs/1506.03042">Upper bounds for prime gaps related to Firoozbakht's conjecture</a>, arXiv:1506.03042 [math.NT], 2015; and <a href="https://cs.uwaterloo.ca/journals/JIS/VOL18/Kourbatov/kourb7.html">J. Int. Seq. 18 (2015) #15.11.2</a>.
%H Alexei Kourbatov and Marek Wolf, <a href="http://arxiv.org/abs/1901.03785">Predicting maximal gaps in sets of primes</a>, arXiv preprint arXiv:1901.03785 [math.NT], 2019.
%H Thomas R. Nicely, <a href="https://faculty.lynchburg.edu/~nicely/gaps/gaplist.html">First occurrence prime gaps</a> [For local copy see A000101]
%H Thomas R. Nicely, <a href="http://dx.doi.org/10.1090/S0025-5718-99-01065-0">New maximal prime gaps and first occurrences</a>, Math. Comput. 68,227 (1999) 1311-1315.
%H Tomás Oliveira e Silva, <a href="http://sweet.ua.pt/tos/gaps.html">Gaps between consecutive primes</a>
%H D. Shanks, <a href="http://dx.doi.org/10.1090/S0025-5718-1964-0167472-8">On maximal gaps between successive primes</a>, Math. Comp., 18 (1964), 646-651.
%H Matt Visser, <a href="https://arxiv.org/abs/1904.00499">Verifying the Firoozbakht, Nicholson, and Farhadian conjectures up to the 81st maximal prime gap</a>, arXiv:1904.00499 [math.NT], 2019.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/PrimeGaps.html">Prime Gaps</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Prime_gap">Prime gap</a>
%H Robert G. Wilson v, <a href="/A005250/a005250.pdf">Notes (no date)</a>
%H J. Young and A. Potler, <a href="http://dx.doi.org/10.1090/S0025-5718-1989-0947470-1">First occurrence prime gaps</a>, Math. Comp., 52 (1989), 221-224.
%H <a href="/index/Pri#gaps">Index entries for primes, gaps between</a>
%F a(n) = A000101(n) - A005250(n) = A008950(n-1) - 1. - _M. F. Hasler_, Dec 13 2007
%F A000720(a(n)) = A005669(n).
%F a(n) = A000040(A005669(n)). - _M. F. Hasler_, Apr 26 2014
%t s = {2}; gm = 1; Do[p = Prime[n]; g = Prime[n + 1] - p; If[g > gm, Print[p]; AppendTo[s, p]; gm = g], {n, 2, 1000000}]; s (* _Jean-François Alcover_, Mar 31 2011 *)
%t Module[{nn=10^7,pr,df},pr=Prime[Range[nn]];df=Differences[pr];DeleteDuplicates[ Thread[ {Most[ pr],df}],GreaterEqual[#1[[2]],#2[[2]]]&]][[All,1]] (* The program generates the first 26 terms of the sequence. *) (* _Harvey P. Dale_, Sep 24 2022 *)
%o (PARI) a(n)=local(p,g);if(n<2,2*(n>0),p=a(n-1);g=nextprime(p+1)-p;while(p=nextprime(p+1),if(nextprime(p+1)-p>g,break));p) /* _Michael Somos_, Feb 07 2004 */
%o (PARI) p=q=2;g=0;until( g<(q=nextprime(1+p=q))-p && print1(q-g=q-p,","),) \\ _M. F. Hasler_, Dec 13 2007
%Y Cf. A000040, A001223, A000101 (upper ends), A005250 (record gaps), A000230, A111870, A111943.
%Y Cf. A005669, A134266, A070866.
%Y See also A205827(n) = A000040(A214935(n)), A182514(n) = A000040(A241540(n)).
%K nonn,nice
%O 1,1
%A _N. J. A. Sloane_
%E Definition clarified by _Harvey P. Dale_, Sep 24 2022