%I #33 Feb 13 2022 12:07:12
%S 43,73,283,619,1303,1669,1789,1873,1999,2143,2383,2689,2803,4519,5419,
%T 5443,5653,7879,9013,11833,13693,14563,17389,18133,18313,20359,21493,
%U 22159,24109,27283,32719,35533,36793,37573,41233,41959,42409,42463,44269,47149,50593,55219,55819,55933
%N Greatest of 4 consecutive primes with consecutive gaps 6, 4, 2.
%C All terms = {13, 19} mod 30.
%H Robert Israel, <a href="/A290635/b290635.txt">Table of n, a(n) for n = 1..10000</a>
%F a(n) = A078855(n) + 12.
%e 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.
%p 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
%p # More efficient:
%p primes:= select(isprime,[seq(seq(30*i+j,j=[13,19]),i=1..10^4)]):
%p select(t -> isprime(t-2) and isprime(t-6) and isprime(t-12) and not isprime(t-8), primes); # _Robert Israel_, Jun 28 2018
%t With[{s = Differences@ Prime@ Range[10^4]}, Prime[1 + SequencePosition[s, {6, 4, 2}][[All, -1]] ] ] (* _Michael De Vlieger_, Aug 16 2017 *)
%t Select[Partition[Prime[Range[6000]],4,1],Differences[#]=={6,4,2}&][[All,4]] (* _Harvey P. Dale_, Feb 13 2022 *)
%o (GAP)
%o K:=2*10^5+1;; # to get all terms <= K.
%o P:=Filtered([1,3..K],IsPrime);; I:=Reversed([2,4,6]);;
%o P1:=List([1..Length(P)-1],i->P[i+1]-P[i]);;
%o P2:=List([1..Length(P)-Length(I)],i->[P1[i],P1[i+1],P1[i+2]]);;
%o P3:=List(Positions(P2,I),i->P[i+Length(I)]);
%o # More efficient
%o (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
%o (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
%Y Subsequence of A006512 and A098413.
%Y Cf. A022005, A078855.
%K nonn
%O 1,1
%A _Muniru A Asiru_, Aug 08 2017