OFFSET
1,1
COMMENTS
All terms = {13, 19} mod 30.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = A078855(n) + 12.
EXAMPLE
43 is a member of the sequence because 43 is the greatest of the 4 consecutive primes 31, 37, 41, 43 with consecutive gaps 6, 4, 2; that is, 37 - 31 = 6, 41 - 37 = 4, 43 - 41 = 2.
MAPLE
for i from 1 to 10^5 do if ithprime(i+1)=ithprime(i)+6 and ithprime(i+2)=ithprime(i)+4 and ithprime(i+3)=ithprime(i)+2 then print(ithprime(i+3)); fi; od; # Corrected by Robert Israel, Jun 28 2018
# More efficient:
primes:= select(isprime, [seq(seq(30*i+j, j=[13, 19]), i=1..10^4)]):
select(t -> isprime(t-2) and isprime(t-6) and isprime(t-12) and not isprime(t-8), primes); # Robert Israel, Jun 28 2018
MATHEMATICA
With[{s = Differences@ Prime@ Range[10^4]}, Prime[1 + SequencePosition[s, {6, 4, 2}][[All, -1]] ] ] (* Michael De Vlieger, Aug 16 2017 *)
Select[Partition[Prime[Range[6000]], 4, 1], Differences[#]=={6, 4, 2}&][[All, 4]] (* Harvey P. Dale, Feb 13 2022 *)
PROG
(GAP)
K:=2*10^5+1;; # to get all terms <= K.
P:=Filtered([1, 3..K], IsPrime);; I:=Reversed([2, 4, 6]);;
P1:=List([1..Length(P)-1], i->P[i+1]-P[i]);;
P2:=List([1..Length(P)-Length(I)], i->[P1[i], P1[i+1], P1[i+2]]);;
P3:=List(Positions(P2, I), i->P[i+Length(I)]);
# More efficient
(GAP) Filtered(Set(Flat(List([13, 19], j->List([1..2000], i->30*i+j)))), j->IsPrime(j) and IsPrime(j-12) and not IsPrime(j-10) and not IsPrime(j-8) and IsPrime(j-6) and not IsPrime(j-4) and IsPrime(j-2)); # Muniru A Asiru, Jul 03 2018
(PARI) is(n) = if(!ispseudoprime(n), return(0), my(v=[n-2, n-6, n-12]); if(v[1]==precprime(n-1) && v[2]==precprime(v[1]-1) && v[3]==precprime(v[2]-1), return(1))); 0 \\ Felix Fröhlich, Aug 10 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Muniru A Asiru, Aug 08 2017
STATUS
approved