%I #75 Oct 27 2018 11:30:26
%S 2,11,17,29,41,47,59,67,71,97,101,107,109,127,137,149,151,167,179,181,
%T 191,197,227,229,233,239,241,263,269,281,283,307,311,347,349,367,373,
%U 401,409,419,431,433,439,461,487,491,503,521,569,571,587,593,599,601,607
%N Primes p with the property: if q is the smallest prime > p/2, then a prime exists between p and 2q.
%C The Ramanujan primes possess the following property:
%C If p = prime(n) > 2, then all numbers (p+1)/2, (p+3)/2, ..., (prime(n+1)-1)/2 are composite.
%C The sequence equals all primes with this property, whether Ramanujan or not.
%C All Ramanujan primes A104272 are in the sequence.
%C Every lesser of twin primes (A001359), beginning with 11, is in the sequence. - _Vladimir Shevelev_, Aug 31 2009
%C 109 is the first non-Ramanujan prime in this sequence.
%C A very simple sieve for the generation of the terms is the following: let p_0=1 and, for n>=1, p_n be the n-th prime. Consider consecutive intervals of the form (2p_n, 2p_{n+1}), n=0,1,2,... From every interval containing at least one prime we remove the last one. Then all remaining primes form the sequence. Let us demonstrate this sieve: For p_n=1,2,3,5,7,11,... consider intervals (2,4), (4,6), (6,10), (10,14), (14,22), (22,26), (26,34), ... . Removing from the set of all primes the last prime of each interval, i.e., 3,5,7,13,19,23,31,... we obtain 2,11,17,29, etc. - _Vladimir Shevelev_, Aug 30 2011
%C This sequence and A194598 are the mutually wrapping up sequences:
%C A194598(1) <= a(1) <= A194598(2) <= a(2) <= ...
%C From _Peter Munn_, Oct 30 2017: (Start)
%C The sequence is the list of primes p = prime(k) such that there are no primes between prime(k)/2 and prime(k+1)/2. Changing "k" to "k-1" and therefore "k+1" to "k" produces a definition very similar to A164333's: it differs by prefixing an initial term 3. From this we get a(n+1) = prevprime(A164333(n)) = A151799(A164333(n)) for n >= 1.
%C The sequence is the list of primes that are not the largest prime less than 2*prime(k) for any k, so that - as a set - it is the complement relative to A000040 of the set of numbers in A059788.
%C {{2}, A166252, A166307} is a partition.
%C (End)
%H Alois P. Heinz, <a href="/A164368/b164368.txt">Table of n, a(n) for n = 1..20000</a>
%H V. Shevelev, <a href="http://arXiv.org/abs/0908.2319">On critical small intervals containing primes</a>, arXiv:0908.2319 [math.NT], 2009.
%H V. Shevelev, <a href="http://arxiv.org/abs/0909.0715">Ramanujan and Labos primes, their generalizations and classifications of primes</a>, arXiv:0909.0715 [math.NT], 2009-2011.
%H V. 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. 15 (2012) Article 12.5.4
%H J. Sondow, <a href="http://mathworld.wolfram.com/RamanujanPrime.html">Ramanujan Prime in MathWorld</a>
%H J. Sondow, J. W. Nicholson, and T. D. Noe, <a href="http://arxiv.org/abs/1105.2249">Ramanujan Primes: Bounds, Runs, Twins, and Gaps</a>, arXiv:1105.2249 [math.NT], 2011 (see Section 5 Prime gaps).
%H J. Sondow, J. W. Nicholson, and T. D. Noe, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL14/Noe/noe12.html">Ramanujan Primes: Bounds, Runs, Twins, and Gaps</a>, J. Integer Seq. 14 (2011) Article 11.6.2 (see Section 5 Prime gaps).
%F As a set, this sequence = A000040 \ A059788 = A000040 \ prevprime(2*A000040) = A000040 \ A151799(A005843(A000040)). - _Peter Munn_, Oct 30 2017
%e 2 is in the sequence, since then q=2, and there is a prime 3 between 2 and 4. - _N. J. A. Sloane_, Oct 15 2009
%p a:= proc(n) option remember; local q, k, p;
%p k:= nextprime(`if`(n=1, 1, a(n-1)));
%p do q:= nextprime(floor(k/2));
%p p:= nextprime(k);
%p if p<2*q then break fi;
%p k:= p
%p od; k
%p end:
%p seq(a(n), n=1..55); # _Alois P. Heinz_, Aug 30 2011
%t Reap[Do[q=NextPrime[p/2]; If[PrimePi[2*q] != PrimePi[p], Sow[p]], {p, Prime[Range[100]]}]][[2, 1]]
%t (* Second program: *)
%t fQ[n_] := PrimePi[ 2NextPrime[n/2]] != PrimePi[n];
%t Select[ Prime@ Range@ 105, fQ]
%o (PARI) is(n)=nextprime(n+1)<2*nextprime(n/2) && isprime(n) \\ _Charles R Greathouse IV_, Apr 24 2015
%Y Cf. Ramanujan primes, A104272, and related sequences: A164288, A080359, A164294, A193507, A194184, A194186.
%Y Cf. A059788, A164333, A194598.
%Y A001359, A166252, A166307 are subsets.
%Y Cf. A001262, A001567, A062568, A141232 (all relate to pseudoprimes to base 2).
%K nonn
%O 1,1
%A _Vladimir Shevelev_, Aug 14 2009
%E Definition clarified and simplified by _Jonathan Sondow_, Oct 25 2011