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.

A295705 The first of a pair of alternate primes the difference between which is twice a prime.

Original entry on oeis.org

3, 5, 7, 11, 13, 17, 19, 31, 37, 41, 43, 61, 67, 73, 79, 83, 97, 101, 103, 107, 127, 157, 163, 191, 193, 197, 223, 227, 229, 271, 277, 307, 311, 347, 349, 353, 359, 373, 379, 383, 433, 439, 443, 457, 461, 499, 509, 607, 613, 617, 619, 641, 643, 659, 673, 677, 719
Offset: 1

Views

Author

Geoffrey Marnell, Nov 25 2017

Keywords

Comments

Symbolically, the sequence is of p = prime(i) where q = (prime(i + 2) - prime(i))/2 and p and q are prime.
An examination of the first 10^9 primes (using Mathematica) shows that the largest value of q is 157 and it occurs just once: where p = 1907251013.
prime(k+1) where A052288(k) is prime. - Robert Israel, Dec 04 2017
Number of terms less than 10^k: 0, 3, 17, 72, 454, 3034, 22222, 174228, ... - Muniru A Asiru, Jan 24 2018

Examples

			{3, 7} represents a pair of alternate primes, their difference is 4 which is twice a prime (2). Likewise, {787, 809}, their difference being twice 11.
		

Crossrefs

Programs

  • GAP
    P:=Filtered([3..10^4], IsPrime);;
    B := List([1..Length(P)-2],i->(P[i+2]-P[i])/2);;
    o := [];; for i in [1..Length(B)] do if IsPrime(B[i]) then Add(o,P[i]); fi; od; o := A295705; # Muniru A Asiru, Jan 24 2018
  • Maple
    P:= select(isprime,[seq(i,i=3..10^4,2)]):
    P[select(t -> isprime((P[t+2]-P[t])/2), [$1..nops(P)-2])]; # Robert Israel, Dec 04 2017
  • Mathematica
    For[p = 1, p < 100000001, p++,
    a = Prime[p];
    b = Prime[p + 2];
    q = (b - a)/2;
    If[PrimeQ[q] == True, Print[a, " ", b, " ", q]];
    ] (* Marnell *)
    Select[Prime[Range[1000]], PrimeQ[(NextPrime[#, 2] - #)/2] &] (* Alonso del Arte, Nov 25 2017 *)
    searchMax = 200; primes = Prime[Range[searchMax + 2]]; halfAlternPrimeDiffs = Table[(primes[[n + 2]] - primes[[n]])/2, {n, searchMax}]; primes[[Select[Range[searchMax], PrimeQ[halfAlternPrimeDiffs[[#]]] &]]] (* Alonso del Arte, Nov 26 2017 *)
    Select[{#1, #2, (#2 - #1)/2} & @@ # & /@ Transpose@ {Take[#, Length@ # - 2], Drop[#, 2]} &@ Prime@ Range@ 130, PrimeQ@ Last@ # &][[All, 1]] (* Michael De Vlieger, Dec 04 2017 *)
    Select[Partition[Prime[Range[200]],3,1],PrimeQ[(#[[3]]-#[[1]])/2]&][[All,1]] (* Harvey P. Dale, Feb 20 2020 *)
  • PARI
    lista(nn) = {precp = 3; precq = 5; forprime(p=7, nn, if (isprime((p-precp)/2), print1(precp, ", ")); precp = precq; precq = p;);} \\ Michel Marcus, Jan 08 2018