A099734 Duplicate of A033451.
251, 1741, 3301, 5101, 5381, 6311, 6361, 12641, 13451, 14741, 15791, 15901
Offset: 1
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.
a(1) = 251 = prime(54) = A000040(54) and prime(55) - prime(54) = prime(56)-prime(55) = 6. - _Zak Seidov_, Apr 23 2011
Select[Partition[Prime[Range[9000]],4,1],Length[Union[Differences[#]]] == 1&][[All,1]] (* Harvey P. Dale, Aug 08 2017 *)
p=2;q=3;r=5;forprime(s=7,1e4, t=s-r; if(t==r-q&&t==q-p, print1(p", ")); p=q;q=r;r=s) \\ Charles R Greathouse IV, Feb 14 2013
First and smallest occurrence of n, n >= 1, consecutive primes in arithmetic progression: a(1) = 2: (2) (degenerate arithmetic progression); a(2) = 2: (2, 3) (degenerate arithmetic progression); a(3) = 3: (3, 5, 7); a(4) = 251: (251, 257, 263, 269); a(5) = 9843019: (9843019, 9843049, 9843079, 9843109, 9843139); a(6) = 121174811: (121174811, 121174841, 121174871, 121174901, 121174931, 121174961);
Join[{2},Table[SelectFirst[Partition[Prime[Range[691*10^4]],n,1], Length[ Union[ Differences[ #]]] == 1&][[1]],{n,2,6}]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 10 2019 *)
17, 17+2 = 19, 17+2+4 = 23, 17+2+4+6 = 29 are consecutive primes.
d = Differences[Prime[Range[10000]]]; Prime[Flatten[Position[Partition[d, 3, 1], {2, 4, 6}]]] (* T. D. Noe, May 23 2011 *) Transpose[Select[Partition[Prime[Range[10000]],4,1],Differences[#] == {2,4,6}&]][[1]] (* Harvey P. Dale, Aug 07 2013 *)
47 is a term as the next two primes are 53 and 59.
ok[p_] := (q = NextPrime[p]) == p+6 && NextPrime[q] == q+6; Select[Prime /@ Range[1000], ok][[;; 45]] (* Jean-François Alcover, Jul 11 2011 *) Transpose[Select[Partition[Prime[Range[1000]],3,1],Differences[#]=={6,6}&]] [[1]] (* Harvey P. Dale, Apr 25 2014 *)
is_A047948(n)={nextprime(n+1)==n+6 && nextprime(n+7)==n+12 && isprime(n)} \\ Charles R Greathouse IV, Aug 17 2011, simplified by M. F. Hasler, Jan 13 2013
p=2;q=3;forprime(r=5,1e4,if(r-p==12&&q-p==6,print1(p", "));p=q;q=r) \\ Charles R Greathouse IV, Aug 17 2011
A033447 = Reap[For[p = 2, p < 1100000, p = NextPrime[p], p2 = NextPrime[p]; If[p2 - p == 12, p3 = NextPrime[p2]; If[p3 - p2 == 12, p4 = NextPrime[p3]; If[p4 - p3 == 12, Sow[p]]]]]][[2, 1]] (* Jean-François Alcover, Jun 28 2012 *) Transpose[Select[Partition[Prime[Range[160000]],4,1],Union[ Differences[#]] =={12}&]][[1]] (* Harvey P. Dale, Jun 17 2014 *)
A033447(n, p=2, show_all=1, g=12,c,o)={forprime(q=p+1,, if(p+g!=p=q, next, q!=o+2*g, c=2, c++>3, show_all&& print1(o-g", "); n--||break); o=q-g); o-g} \\ Can be used as next(p)=A033447(1, p+1) to get the next term, e.g.: p=0; A033447_vec=vector(30,i,p=A033447(1,p+1)) \\ M. F. Hasler, Oct 26 2018
642427, 642457, 642487, 642517 are consecutive primes, so 642427 is in the sequence.
f:=func; a:=[]; for p in PrimesInInterval(2,13000000) do if (f(p)-p eq 30) and (f(f(p))-p eq 60) and (f(f(f(p)))-p eq 90) then Append(~a,p); end if; end for; a; // Marius A. Burtea, Jan 04 2020
p := 2 : q := 3 : r := 5 : s := 7 : for i from 1 do if q-p = 30 and r-q=30 and s-r=30 then printf("%d,\n",p) ; fi ; p := q ; q := r ; r := s ; s := nextprime(r) ; od: # R. J. Mathar, Apr 12 2008
p=2; q=3; r=5; s=7; A052243 = Reap[For[i=1, i<1000000, i++, If[ q-p == 30 && r-q == 30 && s-r == 30 , Print[p]; Sow[p]]; p=q; q=r; r=s; s=NextPrime[r]]][[2, 1]] (* Jean-François Alcover, Jun 28 2012, after R. J. Mathar *) Transpose[Select[Partition[Prime[Range[1100000]],4,1],Union[ Differences[#]] =={30}&]][[1]] (* Harvey P. Dale, Jun 17 2014 *)
A052243(n,p=2,print_all=0,g=30,c,o)={forprime(q=p+1,,if(p+g!=p=q, next, q!=o+2*g, c=2, c++>3, print_all&& print1(o-g","); n--||break); o=q-g);o-g} \\ optional 2nd arg specifies starting point, allows to define: next_A052243(p)=A052243(1,p+1) \\ replacing older code from 2008. - M. F. Hasler, Oct 26 2018
p(271)=1741: 1741,1747,1753,1759 are consecutive primes,1747=1741+6,1753=1741+12,1759=1741+18
p[n_]:=Prime[n];Select[Range[15000],p[ #+1]-p[ # ]==p[ #+2]-p[ #+1]==p[ #+3]-p[ #+2]==6&] (* Zak Seidov, Mar 05 2006 *) PrimePi[#[[1]]]&/@Select[Partition[Prime[Range[11000]],4,1],Differences[#]=={6,6,6}&] (* Harvey P. Dale, Oct 28 2023 *)
{74453, 74471, 74489, 74507} is the first such set of 4 consecutive primes with common difference 18, so a(1) = 74453.
A033448 = Reap[For[p = 2, p < 2100000, p = NextPrime[p], p2 = NextPrime[p]; If[p2 - p == 18, p3 = NextPrime[p2]; If[p3 - p2 == 18, p4 = NextPrime[p3]; If[p4 - p3 == 18, Sow[p]]]]]][[2, 1]] (* Jean-François Alcover, Jun 28 2012 *) Transpose[Select[Partition[Prime[Range[160000]],4,1],Union[ Differences[ #]] == {18}&]][[1]] (* Harvey P. Dale, Jun 17 2014 *)
A033448(n,show_all=1,g=18,p=2,o,c)={forprime(q=p+1,,if(p+g!=p=q,next, q!=o+2*g, c=3, c++>4, print1(o-g","); n--||break); o=q-g);o-g} \\ Can be used as nxt(p)=A033448(1,,,p+1), e.g.: {p=0;vector(20,i,p=nxt(p))} or {p=0;for(i=1,1e4,write("b.txt",i" "nxt(p)))}. - M. F. Hasler, Oct 26 2018
p=47,47+6=53,47+6+6=59,47+6+6+2=61 are consecutive primes.
Select[Partition[Prime[Range[10000]],4,1],Differences[#]=={6,6,2}&][[All,1]] (* Harvey P. Dale, Apr 29 2017 *)
Comments