login
A267135
a(n) = n minus the number of primes of form 4m + 1 that are less than n-th prime of form 4m + 3.
1
1, 1, 2, 1, 2, 2, 1, 2, 2, 2, 3, 3, 4, 2, 3, 2, 3, 3, 3, 3, 4, 4, 4, 3, 4, 5, 6, 5, 5, 5, 5, 4, 4, 5, 4, 4, 3, 4, 4, 5, 2, 2, 2, 3, 1, 2, 3, 4, 5, 6, 7, 6, 6, 6, 6, 6, 6, 6, 5, 6, 6, 7, 7, 5, 6, 5, 6, 6, 7, 8, 5, 4, 4, 5, 5, 4, 5, 4, 5, 6, 7, 8, 6, 6, 7, 7, 8, 6, 6, 6, 6, 6, 6, 7, 6, 5, 5, 5, 6, 6
OFFSET
1,3
COMMENTS
a(25191) = -3 is the first negative term. - Robert Israel, Jan 12 2016
LINKS
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