A092567 Duplicate of A055623.
5, 13, 89, 389, 2593, 12401, 77069, 262897, 11593, 373649, 766261, 3358169
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(3)=739 because here n=3 and 739 is the start of a run of exactly 3 consecutive primes congruent to 3 mod 4.
a(2)=17 because this is the 2nd prime in the first run of 2 primes where p == 1 mod 4.
Flatten[Table[SequencePosition[Table[If[Mod[p-1,4]==0,1,0],{p,Prime[Range[250000]]}],PadRight[ {},n,1],1],{n,12}],1][[;;,-1]]//Prime (* The program generates the first 12 terms of the sequence. *) (* Harvey P. Dale, Jul 14 2024 *)
r=0;c=0;forprime(p=2,4e9,if(p%4==1,if(c++>r,r=c;print1(p", ")),c=0)) \\ Charles R Greathouse IV, Mar 22 2011
10 'cluster primes 20 C=1:input "end #";L 40 for N=3 to L step 2 50 S=int(sqrt(N)) 60 for A=3 to S step 2 70 B=N/A 80 if int(B)*A=N then cancel for:goto 170 90 next A 100 C=C+1: E=int(N/4):R=N-(4*E) 120 if R=1 then print N;:C1=C1+1:T1=T1+1:print T1 130 if R=3 then T1=0:print " ";N;:C3=C3+1:T2=T2+1:print T2 150 if R=1 then T2=0 160 if T1>10 or T2>10 then stop 170 next 180 print "Total primes=";C;:print "Type A:";C1;" Type B:";C3
a(1)=11 because this sequence includes consecutive runs of any length >1 and this ending term in a run of 2 is 11.
A145994 := proc() local m,p,r,i,lp ; m := 3 ; p := 2 ; r := 0 ; for i from 2 to 1000 do if modp(p,4) = m then r := r+1 ; else if r > 1 then printf("%d,",prevprime(p)) ; end if; r := 0; end if; p := nextprime(p) ; end do: end proc: A145994() ; # R. J. Mathar, Aug 29 2018
Last /@ Select[Split[Select[4Range[1000]+3, PrimeQ], #2 == NextPrime[#1]&], Length[#]>1&] (* Jean-François Alcover, Mar 26 2020 *)
10 'cluster primes 20 C=1 30 input "end #";L 40 for N=3 to L step 2 50 S=int(sqrt(N)) 60 for A=3 to S step 2 70 B=N/A 80 if int(B)*A=N then cancel for:goto 170 90 next A 100 C=C+1 110 E=N/4:E=int(E):R=N-(4*E) 120 if R=1 then print N;:C1=C1+1:T1=T1+1:print T1 130 if R=3 then T1=0 140 if R=3 then print " ";N;:C3=C3+1:T2=T2+1:print T2 150 if R=1 then T2=0 160 if T1>10 or T2>10 then stop 170 next 180 print "Total primes=";C;:print "Type A";C1;"Type B";C3
pp = Table[{p = Prime[n], Mod[p, 6]}, {n, 10^6}]; sp = Split[pp, Mod[#1[[2]], 6] == Mod[#2[[2]], 6]&]; a[n_] := SelectFirst[sp, Length[#] == n && MatchQ[#, {{_Integer, 5} ..}]& ][[1, 1]]; Table[an = a[n]; Print[n, " ", an]; an, {n, 1, 13}] (* Jean-François Alcover, Nov 21 2018 *)
okchain(n, p) = {if ((precprime(p-1) % 6) == 5, return (0)); for (i=1, n, if ((p % 6) != 5, return (0)); p = nextprime(p+1);); if ((p % 6) == 5, 0, 1);} a(n) = {p = 5; while (! okchain(n, p), p = nextprime(p+1)); p;} \\ Michel Marcus, Dec 17 2013
a(9) = 11593 because "[t]his number is the first in a sequence of 9 consecutive primes all of the form 4n + 1."
NextPrime[ n_Integer ] := Module[ {k = n + 1}, While[ ! PrimeQ[ k ], k++ ]; Return[ k ] ]; PrevPrime[ n_Integer ] := Module[ {k = n - 1}, While[ ! PrimeQ[ k ], k-- ]; Return[ k ] ]; p = 0; Do[ a = Table[ -1, {n} ]; k = Max[ 1, p ]; While[ Union[ a ] != {1}, k = NextPrime[ k ]; a = Take[ AppendTo[ a, Mod[ k, 4 ] ], -n ] ]; p = NestList[ PrevPrime, k, n ]; Print[ p[ [ -2 ] ] ]; p = p[ [ -1 ] ], {n, 1, 19} ]
a(2)=11 because this is the 2nd prime in the first run of 2 primes where p == 3 mod 4.
Prime[#]&/@Flatten[Table[SequencePosition[If[Mod[#,4]==3,1,0]&/@Prime[ Range[ 615000]],PadRight[{},n,1],1],{n,15}],1][[All,2]] (* The program generates the first 15 terms of the sequence. *) (* Harvey P. Dale, Jun 17 2022 *)
r=0; c=0; forprime(p=2, 4e9, if(p%4==3, if(c++>r, r=c; print1(p", ")), c=0)) \\ Charles R Greathouse IV, Mar 22 2011
10 'cluster primes 20 C=1 30 input "end #";L 40 for N=3 to L step 2 50 S=int(sqrt(N)) 60 for A=3 to S step 2 70 B=N/A 80 if int(B)*A=N then cancel for:goto 170 90 next A 100 C=C+1 110 E=N/4:E=int(E):R=N-(4*E) 120 if R=1 then print N;:C1=C1+1:T1=T1+1:print T1 130 if R=3 then T1=0 140 if R=3 then print " ";N;:C3=C3+1:T2=T2+1:print T2 150 if R=1 then T2=0 160 if T1>10 or T2>10 then stop 170 next 180 print "Total primes=";C;:print "Type A";C1;"Type B";C3
a(1)=13 because this sequence includes consecutive runs of any length and this first term > 1 in a run of 2 is 13.
for i from 2 to 300 do if (ithprime(i) mod 4) = 1 and ithprime(i-1) mod 4 <> 1 and ithprime(i+1) mod 4 = 1 then printf("%d,",ithprime(i)) ; end if; end do: # R. J. Mathar, Sep 30 2011
Prime[#+1]&/@(SequencePosition[Table[If[Mod[n,4]==1,1,0],{n,Prime[ Range[ 350]]}],{0,1,1},Overlaps->False][[All,1]]) (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 02 2017 *)
10 'cluster primes 20 C=1 30 input "end #";L 40 for N=3 to L step 2 50 S=int(sqrt(N)) 60 for A=3 to S step 2 70 B=N/A 80 if int(B)*A=N then cancel for:goto 170 90 next A 100 C=C+1 110 E=N/4:E=int(E):R=N-(4*E) 120 if R=1 then print N;:C1=C1+1:T1=T1+1:print T1 130 if R=3 then T1=0 140 if R=3 then print " ";N;:C3=C3+1:T2=T2+1:print T2 150 if R=1 then T2=0 160 if T1>10 or T2>10 then stop 170 next 180 print "Total primes=";C;:print "Type A";C1;"Type B";C3
c See link in A085515.
pp = Table[{p = Prime[n], Mod[p, 6]}, {n, 10^6}]; sp = Split[pp, Mod[#1[[2]], 6] == Mod[#2[[2]], 6]&]; a[n_] := SelectFirst[sp, Length[#] == n && MatchQ[#, {{_Integer, 1} ..}]& ][[1, 1]]; Table[an = a[n]; Print[n, " ", an]; an, {n, 1, 13}] (* Jean-François Alcover, Nov 21 2018 *)
a(1)=2 because this sequence includes consecutive runs of any length and this first occurrence > 1 is a run of 2.
Length/@Select[Split[Table[If[Mod[p,4]==1,1,0],{p,Prime[Range[500]]}]],#[[1]]==1&&Length[#]>1&] (* Harvey P. Dale, Jul 27 2025 *)
10 'cluster primes 20 C=1 30 input "end #";L 40 for N=3 to L step 2 50 S=int(sqrt(N)) 60 for A=3 to S step 2 70 B=N/A 80 if int(B)*A=N then cancel for:goto 170 90 next A 100 C=C+1 110 E=N/4:E=int(E):R=N-(4*E) 120 if R=1 then print N;:C1=C1+1:T1=T1+1:print T1 130 if R=3 then T1=0 140 if R=3 then print " ";N;:C3=C3+1:T2=T2+1:print T2 150 if R=1 then T2=0 160 if T1>10 or T2>10 then stop 170 next 180 print "Total primes=";C;:print "Type A";C1;"Type B";C3
Comments