cp's OEIS Frontend

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.

Previous Showing 11-14 of 14 results.

A268914 Minimum difference between two distinct primes whose sum is 2*prime(n), n>4.

Original entry on oeis.org

12, 12, 12, 24, 12, 24, 24, 12, 24, 48, 12, 12, 24, 36, 12, 24, 12, 36, 48, 36, 60, 24, 12, 12, 60, 48, 48, 36, 60, 24, 36, 24, 12, 72, 60, 12, 24, 36, 84, 60, 60, 84, 24, 120, 60, 96, 12, 24, 60, 24, 12, 12, 24, 84, 12, 24, 108, 48, 48, 84, 72, 72, 36, 60, 72, 36, 12, 84, 60, 12, 60, 72, 60, 48, 36, 24, 60, 24, 24, 48, 36, 48, 36, 168, 36, 48
Offset: 5

Views

Author

Barry Cherkas, Feb 15 2016

Keywords

Comments

If p>4 is prime, any two primes that add to 2p must be equidistant from p. If p is congruent to 1 Mod 3, then p+2 and p-4 are divisible by 3. Alternatively, if p is congruent to 2 Mod 3, the p-2 and p+4 are divisible by 3. Thus, the equidistant pairs (p-2,p+2) and (p-4,p+4) cannot be primes that add to 2p. On the other hand, adding or subtracting any multiple of 6 will be congruent to the same congruence class as p and may be prime. Thus, the minimal difference between distinct primes that add to p must be a multiple of 12.
Extrapolating from computational evidence for all primes up to 10^9, we conjecture: For each multiple of 12 there are infinitely many primes p such that p-6k and p+6k are prime and 12k is the minimal difference for two distinct primes whose sum is 2p.

Examples

			For n=5, 2*prime(5)=2*11=5+17 and 17-5=12.
For n=6, 2*prime(6)=2*13=7+19 and 19-7=12.
...
For n=8, 2*prime(8)=2*19=7+31 and 31-7=24.
		

Crossrefs

Programs

  • Maple
    N:= 1000: # to get a(5) .. a(N)
    p:= 7:
    for n from 5 to N do
      p:= nextprime(p);
      for k from 6 by 6 while not isprime(p+k) or not isprime(p-k) do od:
      A[n]:= 2*k
    od:
    seq(A[n],n=5..N); # Robert Israel, Mar 09 2016
  • Mathematica
    f[n_]:=Block[{p=Prime[n],k},k=p+6;
    While[!PrimeQ[k]||!PrimeQ[2p-k],k=k+6];2(k-p)];
    seq=Reap[Do[Sow[f[n]],{n,5,200}]][[2]][[1]];
    seq
    (*For large data sets (say, N>5000), replace 200 with N and the above algorithm is comparatively efficient.*)
    Table[2 SelectFirst[Range[#/2], Function[k, AllTrue[{#/2 + k, #/2 - k}, PrimeQ]]] &[2 Prime@ n], {n, 5, 120}] (* Michael De Vlieger, Mar 09 2016, Version 10 *)
  • PARI
    a(n) = {p = prime(n); d = 2; while (! (isprime(p-d) && isprime(p+d)),  d+=2); 2*d;} \\ Michel Marcus, Mar 17 2016

Formula

a(n) = 2*A078611(n+2).

A115206 Least number d such that prime(n) -/+ 2d form a prime pair; prime(n) being the n-th prime.

Original entry on oeis.org

1, 2, 3, 3, 3, 6, 3, 6, 6, 3, 6, 12, 3, 3, 6, 9, 3, 6, 3, 9, 12, 9, 15, 6, 3, 3, 15, 12, 12, 9, 15, 6, 9, 6, 3, 18, 15, 3, 6, 9, 21, 15, 15, 21, 6, 30, 15, 24, 3, 6, 15, 6, 3, 3, 6, 21, 3, 6, 27, 12, 12, 21, 18, 18, 9, 15, 18, 9, 3, 21, 15, 3, 15, 18, 15, 12, 9, 6, 15, 6, 6, 12, 9, 12, 9, 42, 9
Offset: 3

Views

Author

Lekraj Beedassy, Mar 04 2006

Keywords

Crossrefs

Cf. A078611.

Programs

  • Mathematica
    f[n_] := Block[{k = 1, p = Prime@n}, While[ !PrimeQ[p - 2k] || !PrimeQ[p + 2k], k++ ]; k]; Table[f[n], {n, 3, 90}] (* Robert G. Wilson v, Mar 14 2006 *)

Formula

a(n) = A078611(n)/2.

Extensions

Corrected by N. J. A. Sloane, Mar 05 2006
More terms from Robert G. Wilson v, Mar 14 2006

A176815 Radius of the second-shortest interval (of positive length) centered at prime(n) that has prime endpoints, (zero if no solution exists).

Original entry on oeis.org

0, 0, 0, 0, 8, 10, 12, 0, 18, 18, 28, 24, 18, 30, 24, 30, 30, 42, 30, 18, 30, 48, 30, 42, 54, 30, 24, 24, 42, 54, 30, 42, 36, 42, 42, 42, 54, 60, 60, 24, 48, 30, 60, 36, 60, 72, 18, 84, 36, 78, 36, 42, 42, 18, 24, 30, 42, 60, 36, 30, 84, 54, 30, 48, 84, 66, 48, 60, 54, 72, 36
Offset: 1

Views

Author

Keywords

Comments

7+-10->primes;but 7-10=-3,so,term #4(for number 7) is 0, 11+-8->primes, 13+-10->primes, 17+-12->primes, 19+-22->primes;but 19-22=-3,so,term #8(for number 19)is 0, 23+-18->primes,..

Crossrefs

Programs

  • Mathematica
    f[n_]:=Module[{a=1},While[ !PrimeQ[n-a]||!PrimeQ[n+a],a++ ];r[n,++a]]; r[n_,k_]:=Module[{a=k},While[ !PrimeQ[n-a]||!PrimeQ[n+a],a++ ];If[a>n,0,a]]; Table[f[Prime[n]],{n,1,5!}]

A177462 Smallest k such that A000125(n)+k and A000125(n)-k are both prime.

Original entry on oeis.org

1, 3, 2, 3, 1, 3, 4, 21, 3, 9, 18, 5, 9, 55, 36, 5, 21, 57, 30, 9, 7, 21, 14, 33, 49, 3, 150, 39, 117, 19, 12, 11, 27, 17, 66, 27, 21, 87, 10, 75, 7, 21, 14, 33, 39, 45, 30, 47, 3, 5, 210, 49, 27, 3, 30, 63, 5, 21, 58, 69, 5, 9, 168, 153, 9, 37, 204, 23, 33, 41, 78, 21, 123, 3, 100
Offset: 2

Views

Author

Keywords

Examples

			4+-1->primes. 8+-3->primes. 15+-2->primes. 26+-3->primes,..
		

Crossrefs

Programs

  • Mathematica
    g[n_]:=(n+1)*(n^2-n+6)/6; f[n_]:=Block[{k},If[OddQ[n],k=2,k=1];While[ !PrimeQ[n-k]||!PrimeQ[n+k],k+=2];k]; Table[f[g[n]],{n,2,5!}]

Extensions

Definition rephrased and offset adapted by R. J. Mathar, Aug 15 2010
Previous Showing 11-14 of 14 results.