%I M0675 #118 Feb 16 2025 08:32:31
%S 2,3,5,7,13,23,43,83,163,317,631,1259,2503,5003,9973,19937,39869,
%T 79699,159389,318751,637499,1274989,2549951,5099893,10199767,20399531,
%U 40799041,81598067,163196129,326392249,652784471,1305568919,2611137817
%N Bertrand primes: a(n) is largest prime < 2*a(n-1) for n > 1, with a(1) = 2.
%C a(n) < a(n+1) by Bertrand's postulate (Chebyshev's theorem). - _Jonathan Sondow_, May 31 2014
%C Let b(n) = 2^n - a(n). Then b(n) >= 2^(n-1) - 1 and b(n) is a B_2 sequence: 0, 1, 3, 9, 19, 41, 85, 173, 349, ... - _Thomas Ordowski_, Sep 23 2014 See the link for B_2 sequence.
%C These primes can be obtained of exclusive form using a restricted variant of Rowland's prime-generating recurrence (A106108), making gcd(n, a(n-1)) = -1 when GCDs are greater than 1 and less than n (see program). These GCDs are also a divisor of each odd number from a(n) + 2 to 2*a(n-1) - 1 in reverse order, so that this subtraction with -1's invariably leads to the prime. - _Manuel Valdivia_, Jan 13 2015
%C First row of array in A229607. - _Robert Israel_, Mar 31 2015
%C Named after the French mathematician Joseph Bertrand (1822-1900). - _Amiram Eldar_, Jun 10 2021
%D Martin Aigner and Günter M. Ziegler, Proofs from The Book, Springer-Verlag, Berlin, 1999; see p. 7.
%D Martin Griffiths, The Backbone of Pascal's Triangle, United Kingdom Mathematics Trust (2008), page 115. [From _Martin Griffiths_, Mar 28 2009]
%D G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 344.
%D Ivan Niven and Herbert S. Zuckerman, An Introduction to the Theory of Numbers. 2nd ed., Wiley, NY, 1966, p. 189.
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H Robert G. Wilson v, <a href="/A006992/b006992.txt">Table of n, a(n) for n = 1..1001</a> (first 100 terms from T. D. Noe)
%H Paul Erdős, <a href="http://www.renyi.hu/~p_erdos/1932-01.pdf">Beweis eines Satzes von Tschebyschef</a> (in German), Acta Litt. Sci. Szeged, Vol. 5 (1932), pp. 194-198.
%H Paul Erdős, <a href="https://www.renyi.hu/~p_erdos/1934-01.pdf">A theorem of Sylvester and Schur</a>, J. London Math. Soc., Vol. 9 (1934), pp. 282-288.
%H Srinivasa Ramanujan, <a href="http://ramanujan.sirinudi.org/Volumes/published/ram24.html">A proof of Bertrand's postulate</a>, J. Indian Math. Soc., Vol. 11 (1919), pp. 181-182.
%H Vladimir Shevelev, <a href="http://www.cs.uwaterloo.ca/journals/JIS/VOL15/Shevelev/shevelev19.html">Ramanujan and Labos primes, their generalizations, and classifications of primes</a>, J. Integer Seq., Vol. 15 (2012) Article 12.5.4.
%H Jonathan Sondow, <a href="http://arxiv.org/abs/0907.5232">Ramanujan primes and Bertrand's postulate</a>, arXiv:0907.5232 [math.NT], 2009-2010.
%H Jonathan Sondow, <a href="http://www.jstor.org/stable/40391170">Ramanujan primes and Bertrand's postulate</a>, Amer. Math. Monthly, Vol. 116, No. 7 (2009), pp. 630-635.
%H Jonathan Sondow and Eric Weisstein, <a href="https://mathworld.wolfram.com/BertrandsPostulate.html">MathWorld: Bertrand's Postulate</a>.
%H Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/B2-Sequence.html">B2 Sequence</a>.
%H Robert G. Wilson, V, <a href="/A006992/a006992.pdf">Letter to N. J. A. Sloane, Oct. 1993</a>.
%F a(n+1) = A007917(2*a(n)). - _Reinhard Zumkeller_, Sep 17 2014
%F Limit_{n -> infinity} a(n)/2^n = 0.303976447924... - _Thomas Ordowski_, Apr 05 2015
%p A006992 := proc(n) option remember; if n=1 then 2 else prevprime(2*A006992(n-1)); fi; end;
%t bertrandPrime[1] = 2; bertrandPrime[n_] := NextPrime[ 2*a[n - 1], -1]; Table[bertrandPrime[n], {n, 40}]
%t (* Second program: *)
%t NestList[NextPrime[2#, -1] &, 2, 40] (* _Harvey P. Dale_, May 21 2012 *)
%t k = 3; a[n_] := If[GCD[n,k] > 1 && GCD[n, k] < n, -1, GCD[n, k]]; Select[Differences@Table[k = a[n] + k, {n, 2611137817}], # > 1 &] (* _Manuel Valdivia_, Jan 13 2015 *)
%o (PARI) print1(t=2);for(i=2,60,print1(", "t=precprime(2*t))) \\ _Charles R Greathouse IV_, Apr 01 2013
%o (Haskell)
%o a006992 n = a006992_list !! (n-1)
%o a006992_list = iterate (a007917 . (* 2)) 2
%o -- _Reinhard Zumkeller_, Sep 17 2014
%o (Python)
%o from sympy import prevprime
%o l = [2]
%o for i in range(1, 51):
%o l.append(prevprime(2 * l[i - 1]))
%o print(l) # _Indranil Ghosh_, Apr 26 2017
%Y Cf. A055496, A163961.
%Y See A185231 for another version.
%Y Cf. A007917, A229607, A295262.
%K nonn,nice
%O 1,1
%A _N. J. A. Sloane_, _Robert G. Wilson v_
%E Definition completed by _Jonathan Sondow_, May 31 2014
%E B_2 sequence link added by _Wolfdieter Lang_, Oct 09 2014