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.

A290635 Greatest of 4 consecutive primes with consecutive gaps 6, 4, 2.

Original entry on oeis.org

43, 73, 283, 619, 1303, 1669, 1789, 1873, 1999, 2143, 2383, 2689, 2803, 4519, 5419, 5443, 5653, 7879, 9013, 11833, 13693, 14563, 17389, 18133, 18313, 20359, 21493, 22159, 24109, 27283, 32719, 35533, 36793, 37573, 41233, 41959, 42409, 42463, 44269, 47149, 50593, 55219, 55819, 55933
Offset: 1

Views

Author

Muniru A Asiru, Aug 08 2017

Keywords

Comments

All terms = {13, 19} mod 30.

Examples

			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.
		

Crossrefs

Subsequence of A006512 and A098413.

Programs

  • 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
    
  • 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 *)
  • 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

Formula

a(n) = A078855(n) + 12.