A295705 The first of a pair of alternate primes the difference between which is twice a prime.
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
Keywords
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.
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
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
Comments