login
Smallest prime that begins a run of n consecutive primes that are not Ramanujan primes.
9

%I #44 Oct 30 2023 07:36:50

%S 3,3,3,73,191,191,509,2539,2539,5279,9901,9901,9901,11593,11593,55343,

%T 55343,55343,55343,55343,174929,174929,174929,225977,225977,225977,

%U 225977,225977,534889,534889,534889,534889,534889,534889,534889,534889,2492317,2492317

%N Smallest prime that begins a run of n consecutive primes that are not Ramanujan primes.

%C The run of 10 consecutive non-Ramanujan primes was mentioned by Sondow.

%H Dana Jacobsen, <a href="/A174641/b174641.txt">Table of n, a(n) for n = 1..107</a> (first 67 terms from T. D. Noe)

%H J. Sondow, <a href="http://arxiv.org/abs/0907.5232">Ramanujan primes and Bertrand's postulate</a>, arXiv:0907.5232 [math.NT], 2009-2010.

%H J. Sondow, <a href="https://www.jstor.org/stable/40391170">Ramanujan primes and Bertrand's postulate</a>, Amer. Math. Monthly, 116 (2009) 630-635.

%H J. Sondow, J. W. Nicholson, and T. D. Noe, <a href="https://arxiv.org/abs/1105.2249">Ramanujan Primes: Bounds, Runs, Twins, and Gaps</a>, arXiv:1105.2249 [math.NT], 2011.

%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.

%t nn=10000; t=Table[0, {nn}]; len=Prime[3*nn]; s=0; Do[If[PrimeQ[k], s++]; If[PrimeQ[k/2], s--]; If[s<nn, t[[s+1]]=k], {k, len}]; t=t+1; t=Complement[Prime[Range[PrimePi[t[[-1]]]]], t]; ind=PrimePi[t]; d=Differences[ind]; cnt=0; n=1; Join[{2}, Reap[Do[If[d[[i]]==1, cnt++; If[cnt==n, Sow[t[[i-n+1]]]; n++], cnt=0], {i, Length[d]}]][[2, 1]]]

%o (Perl) use ntheory ":all";

%o my($k, $max, $start, $end, $inc, $p, $q, $r, $pi)

%o = (0, 0, 0, 10, 1e9, 0, 2, [], prime_iterator(3));

%o while (1) {

%o if (!@$r) {

%o ($start, $end) = ($end+1, $end+$inc);

%o $r = ramanujan_primes($start, $end);

%o }

%o ($p, $q, $k) = ($q, shift(@$r), 0);

%o # $k = prime_count($p+1,$q-1);

%o $k++ while $pi->() < $q;

%o say ++$max," ",next_prime($p) while $k > $max;

%o }

%o # _Dana Jacobsen_, Jul 14 2016

%Y Cf. A104272 (Ramanujan primes), A174635 (non-Ramanujan primes).

%Y Cf. A174602 (runs of Ramanujan primes).

%Y Cf. A202187, A202188.

%K nonn

%O 1,1

%A _T. D. Noe_, Nov 29 2010