OFFSET
1,3
COMMENTS
a(25191) = -3 is the first negative term. - Robert Israel, Jan 12 2016
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
A. Granville and G. Martin, Prime number races, Amer. Math. Monthly, 113 (No. 1, 2006), 1-33.
MAPLE
N:= 10000: # to use primes up to N P1:= select(isprime, [seq(i, i=1..N, 4)]):
P3:= select(isprime, [seq(i, i=3..N, 4)]):
V:= Vector(N):
for n from 2 to nops(P1) do
V[P1[n-1]..P1[n]-1]:=n-1
od:
V[P1[nops(P1)]..N]:= nops(P1);
seq(n - V[P3[n]], n=1..nops(P3)); # Robert Israel, Jan 11 2016
MATHEMATICA
nn = 10000;
P1 = Select[Range[1, nn, 4], PrimeQ];
P3 = Select[Range[3, nn, 4], PrimeQ];
V = Table[0, nn];
For[n = 2, n <= Length[P1], n++,
V[[P1[[n-1]] ;; P1[[n]]-1]] = n-1
];
V[[P1[[Length[P1]]] ;; nn]] = Length[P1];
Table[n - V[[P3[[n]]]], {n, 1, Length[P3]}] (* Jean-François Alcover, Sep 18 2018, after Robert Israel *)
CROSSREFS
KEYWORD
sign
AUTHOR
Gionata Neri, Jan 10 2016
STATUS
approved