|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
LINKS
|
|
|
FORMULA
|
|
|
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
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|