login
Number of primes in the half-open interval [n*sqrt((n-1)/2), (n+1)*sqrt(n/2)).
0

%I #14 Feb 06 2019 22:11:40

%S 0,1,1,2,0,1,1,1,1,1,0,2,0,1,2,1,0,1,2,0,2,1,1,1,1,1,1,2,2,0,0,2,1,1,

%T 1,1,2,1,1,2,0,3,1,1,0,1,2,2,1,1,1,2,2,2,1,0,1,3,0,1,1,2,2,1,1,2,1,2,

%U 1,1,1,2,2,1,3,1,1,2,1,2,1,1,1,1,1,2,2,1,2,2,3,0,1,3,3,0,2,2,1,1,1,2,2,2,1,2,1,1,2,2,2,1,1,3,1,3,0,2,1,2

%N Number of primes in the half-open interval [n*sqrt((n-1)/2), (n+1)*sqrt(n/2)).

%e a(1)=0 because are no primes in half-open interval [1*sqrt((1-1)/2), (1+1)*sqrt(1/2)),

%e a(2)=1 because prime 2 is in half-open interval [2*sqrt((2-1)/2), (2+1)*sqrt(2/2)),

%e a(3)=1 because primes 3 is in half-open interval [3*sqrt((3-1)/2),(3+1)*sqrt(3/2)),

%e a(4)=2 because primes 5,7 are in half-open interval [4*sqrt((4-1)/2), (4+1)*sqrt(4/2)).

%p with(numtheory);

%p f:=proc(n) local t1,t2,eps;

%p t1:=floor((n+1)*sqrt(n/2));

%p if t1 = (n+1)*sqrt(n/2) then t1:=t1-1; fi;

%p t2:=ceil(n*sqrt((n-1)/2));

%p eps:=0;

%p if isprime(t2) then eps:=1; fi;

%p pi(t1)-pi(t2)+eps;

%p end;

%p [seq(f(n),n=1..120)]; # _N. J. A. Sloane_, Apr 26 2012

%Y Cf. A006002.

%K nonn

%O 1,4

%A _Gerasimov Sergey_, Apr 10 2012