login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A247384
Find the first (maximal) string of consecutive primes of length exactly n which alternate between 4*k+1 and 4*k+3 or 4*k+3 and 4*k+1 as in A002144(4*n+1) and A002145(4*n+3). The first element is a(n).
3
97, 11, 3, 23, 47, 167, 131, 2011, 233, 23633, 34499, 1013, 9341, 90659, 521, 51749, 505049, 1391087, 2264839, 2556713, 17123893, 2569529, 15090641, 18246451, 6160043, 1557431471, 43679609, 198572029, 701575297, 5552898499, 6639843979, 61233611783, 9005520203
OFFSET
1,1
LINKS
Jens Kruse Andersen and Giovanni Resta, Table of n, a(n) for n = 1..45 (first 38 terms from Jens Kruse Andersen)
Jens Kruse Andersen, Consecutive Congruent Primes
FORMULA
a(n) = A289118(n) if and only if n > 1 and A289118(n) < A289118(n+1). - Jonathan Sondow, Jun 27 2017
EXAMPLE
a(4)=23 because 23,29,31,37 alternate 4*n+3,4*n+1,4*n+3,4*n+1 for exactly four primes and 23 is the least prime for a string of exactly four.
MAPLE
Primes:= select(isprime, [seq(2*i+1, i=1..10^7)]):
Pm4:= map(`modp`, [seq((-1)^j*Primes[j], j=1..nops(Primes))], 4):
Starts:= [1, op(select(t -> Pm4[t-1]<> Pm4[t], [$2..nops(Pm4)]))]:
Lengths:= [seq(Starts[i+1]-Starts[i], i=1..nops(Starts)-1)]:
for i from 1 to max(Lengths) do A[i]:= ListTools:-Search(i, Lengths) od:
R:=[seq(A[i], i=1..max(Lengths))]:
seq(`if`(a=0, 0, Primes[Starts[a]]), a=R); # Robert Israel, Sep 15 2014
MATHEMATICA
i = 2; While[ Mod[ Prime[i] - Prime[i - 1], 4] != 0 || Mod[ Prime[i + 1] - Prime[i], 4] != 0, i++]; T = {Prime[i]}; Do[j = 2; While[! (Product[ Mod[ Prime[k + 1] - Prime[k], 4], {k, j, j + n}] != 0 && (Mod[Prime[j] - Prime[j - 1], 4] == 0 || j == 2) && Mod[ Prime[j + n + 2] - Prime[j + n + 1], 4] == 0), j++]; T = Append[T, Prime[j]], {n, 0, 13}]; T (* Jonathan Sondow, Jun 28 2017 *)
PROG
(PARI) v=vector(100); v[1]=7; cur=1; p=3; forprime(q=5, 1e10, if((q-p)%4==0, if(!v[cur], v[cur]=back(p, cur); print("a("cur") = "v[cur])); cur=1, cur++); p=q) \\ Charles R Greathouse IV, Sep 15 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
J. M. Bergot, Sep 15 2014
EXTENSIONS
More terms from Jens Kruse Andersen, Oct 01 2014
Definition clarified by Jonathan Sondow, Jun 25 2017
STATUS
approved