A075579 Duplicate of A059788.
3, 5, 7, 13, 19, 23, 31, 37, 43, 53, 61, 73, 79, 83, 89, 103, 113, 113, 131, 139, 139, 157
Offset: 0
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.
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
a:= proc(n) option remember; local q, k, p; k:= nextprime(`if`(n=1, 1, a(n-1))); do q:= nextprime(floor(k/2)); p:= nextprime(k); if p<2*q then break fi; k:= p od; k end: seq(a(n), n=1..55); # Alois P. Heinz, Aug 30 2011
Reap[Do[q=NextPrime[p/2]; If[PrimePi[2*q] != PrimePi[p], Sow[p]], {p, Prime[Range[100]]}]][[2, 1]] (* Second program: *) fQ[n_] := PrimePi[ 2NextPrime[n/2]] != PrimePi[n]; Select[ Prime@ Range@ 105, fQ]
is(n)=nextprime(n+1)<2*nextprime(n/2) && isprime(n) \\ Charles R Greathouse IV, Apr 24 2015
4th prime is 7, twice the 4th prime is 14, the greatest prime < 14 is 13 that is the 6th prime, hence, a(4) = 6. - _Bernard Schott_, Feb 02 2020
PrimePi[NextPrime[#,-1]]&/@(2Prime[Range[70]]) (* Harvey P. Dale, Jul 05 2012 *)
a(n) = primepi(2*prime(n)); \\ Michel Marcus, Oct 25 2017; Feb 02 2020
a(15)=3 because there are 3 primes between the doubles of the 15th and 16th primes, that is between 2*47 and 2*53.
a102820 n = a102820_list !! (n-1) a102820_list = map (sum . (map a010051)) $ zipWith enumFromTo a100484_list (tail a100484_list) -- Reinhard Zumkeller, Apr 29 2012
Table[PrimePi[2 Prime[n+1]]-PrimePi[2 Prime[n]], {n, 150}] (* Zak Seidov *) Differences[PrimePi[2 Prime[Range[110]]]] (* Harvey P. Dale, Oct 29 2022 *)
a(n) = primepi(2*prime(n+1)) - primepi(2*prime(n)); \\ Michel Marcus, Sep 22 2017
nn = 100; R = Table[0, {nn}]; s = 0; Do[If[PrimeQ[k], s++]; If[PrimeQ[k/2], s--]; If[s < nn, R[[s + 1]] = k],{k, Prime[3 nn]} ]; R = R + 1; Complement[Prime[Range[PrimePi[Last[R]]]], R] (* Jean-François Alcover, Nov 05 2018, after T. D. Noe in A104272 *)
use ntheory ":all"; my @n = grep { !is_ramanujan_prime($) } @{primes(1e3)}; say "[@n]"; # _Dana Jacobsen, Jul 15 2016
use ntheory ":all"; my %r; $r{$} = 1 for @{ramanujan_primes(1e7)}; say for grep { !exists $r{$} } @{primes(1e7)}; # Dana Jacobsen, Jul 15 2016
The first prime chains of the mapping with A060308 initialized with members of A164368 are 2->3->5->7->13->23->43->83->163->317->631->1259->2503->.. 11->19->37->73->139->277->547->1093->2179->4357->8713->17419->.. 17->31->61->113->223->443->883->1759->3517->7027->14051->28099->.. 29->53->103->199->397->787->1571->3137->6271->12541->25073->.. 41->79->157->313->619->1237->2473->4943->9883->19763->39521->.. 47->89->173->337->673->1327->2647->5281->10559->21107->.. The a(1) to a(4) representing the first 4 primes are all on the first chain, and need 0 to 3 steps to be reached from 2 = A164368(1). a(5) asks for the number of steps for A000040(5)=11 which is on the second chain, and needs 0 steps.
A060308 := proc(n) prevprime(2*n+1) ; end: isA164368 := proc(p) local q ; q := nextprime(floor(p/2)) ; RETURN(numtheory[pi](2*q) -numtheory[pi](p) >= 1); end: A164368 := proc(n) option remember; local a; if n = 1 then 2; else a := nextprime( procname(n-1)) ; while not isA164368(a) do a := nextprime(a) ; od: RETURN(a) ; fi; end: A164917 := proc(n) local p,a,j,q,itr ; p := ithprime(n) ; a := 1000000000000000 ; for j from 1 do q := A164368(j) ; if q > p then break; fi; itr := 0 ; while q < p do q := A060308(q) ; itr := itr+1 ; od; if q = p then if itr < a then a := itr; fi; fi; od: a ; end: seq(A164917(n),n=1..120) ; # R. J. Mathar, Sep 24 2009
A060308[n_] := NextPrime[2*n + 1, -1]; isA164368[p_] := Module[{q}, q = NextPrime[Floor[p/2]]; Return[PrimePi[2*q] - PrimePi[p] >= 1]]; A164368[n_] := A164368[n] = Module[{a}, If[n == 1, 2, a = NextPrime[ A164368[n-1]]; While[Not @ isA164368[a], a = NextPrime[a]]; Return[a]]]; A164917[n_] := Module[{p, a, j, q, itr}, p = Prime[n]; a = 10^15; For[j = 1 , True, j++, q = A164368[j]; If[q > p, Break[]]; itr = 0; While[q < p, q = A060308[q]; itr++]; If[q == p, If[itr < a, a = itr]]]; a]; Table[A164917[n], {n, 1, 120}] (* Jean-François Alcover, Dec 14 2017, after R. J. Mathar *)
5 is a term since 7 is the prime preceding 2*5, 11 is the next prime and 5 is the largest of all prime factors of 8, 9 and 10.
Select[Range[300], PrimeQ[#] && NextPrime[2*#] < 2 * NextPrime[#] &] (* Amiram Eldar, Feb 07 2020 *)
{forprime(k=2,317,p=precprime(2*k); q=nextprime(p+1); m=0; for(j=p+1,q-1,f=factor(j); a=f[matsize(f)[1],1]; if(m
The only prime between 2 * 331 = 662 and 2 * nextprime(331) = 2 * 337 = 674 is 673, so the node labeled 331 is parent only to the node labeled 673. There are no primes between 2 * 673 = 1346 and 2 * nextprime(673) = 2 * 677 = 1354, so the node labeled 673 is a leaf. Thus the node labeled 331 has height 1. It is the least such prime, so a(1) = 331. The "tree of primes" defined above starts: Root +----------------------------+ 2 3 | | 5 7 +--------------+ +-------+ 11 13 17 19 | +-----------+ | +----+ 23 29 31 37 41 43 +----+ +----+ +----+----+ | | | 47 53 59 61 67 71 73 79 83 89 The subtree consisting of the node labeled 17 and all 5 of its descendants is: 17 | 37 | 79 | 163 | 331 | 673 From _Peter Munn_, Nov 22 2018: (Start) The subtree consisting of the node labeled with a(7) = 941593 and its descendants is: 941593 +------+--------+ 1883191 1883197 | | 3766387 3766397 | 7532813 +-----------------+-----------------+ 15065627 15065639 15065641 | +-----------+ | 30131267 30131279 30131281 30131291 | 60262597 | 120525217 (End)
lista(nbp) = {my(v = primes(nbp), nv, x); for (n=0, oo, nv = Set(apply(x->precprime(x >> 1), v)); x = vecmin(setminus(v, nv)); if (x > vecmax(nv), break); print1(x, ", "); v = nv;);} /* use nbp=6*10^6 for 7 terms and nbp=2*10^7 for 8 terms */ \\ Michel Marcus, Nov 19 2018
ntimes(p, n) = for (k=1, n, p = precprime(p>>1)); p; a(n) = {p = 2; x = ntimes(p, n); p = nextprime(p+1); q = 5; y = ntimes(q, n+1); q = nextprime(q+1); for (k= 1, oo, if (y != x, return (x)); until((ny = ntimes(q, n+1)) != x, q = nextprime(q+1)); until((nx = ntimes(p, n)) != x, p = nextprime(p+1)); x = nx; y = ny;);} \\ Michel Marcus, Dec 08 2018
5 < 3*2 < 7 < 3*3 < 11 < 13 < 3*5, so (a(1), a(2), a(3)) = (5,7,13).
Table[Prime[PrimePi[3*Prime[n]]], {n,1,200}]
a(n) = precprime(3*prime(n)); \\ Michel Marcus, Feb 10 2024
For n = 1: prime(1) = 2, 2*prime(1) = 4 is between 3 and 5, their difference is 2 = a(1). For n = 6: prime(6) = 13, 2*prime(6) = 26 is between 23 and 29 and their difference is 6 = a(6).
with(numtheory): [seq(nextprime(2*ithprime(j))-prevprime(2*ithprime(j)),j=1...256)];
dsplp[n_]:=Module[{np=2Prime[n]},NextPrime[np]-NextPrime[np,-1]]; Array[ dsplp,90] (* Harvey P. Dale, Mar 20 2013 *)
a(n) = {my(m = 2*prime(n)); nextprime(m+1) - precprime(m-1);} \\ Amiram Eldar, Feb 08 2025
Comments