cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

Original entry on oeis.org

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, 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, 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
Offset: 1

Views

Author

Gerasimov Sergey, Apr 10 2012

Keywords

Examples

			a(1)=0 because are no primes in half-open interval [1*sqrt((1-1)/2), (1+1)*sqrt(1/2)),
a(2)=1 because prime 2 is in half-open interval [2*sqrt((2-1)/2), (2+1)*sqrt(2/2)),
a(3)=1 because primes 3 is in half-open interval [3*sqrt((3-1)/2),(3+1)*sqrt(3/2)),
a(4)=2 because primes 5,7 are in half-open interval [4*sqrt((4-1)/2), (4+1)*sqrt(4/2)).
		

Crossrefs

Cf. A006002.

Programs

  • Maple
    with(numtheory);
    f:=proc(n) local t1,t2,eps;
    t1:=floor((n+1)*sqrt(n/2));
    if t1 = (n+1)*sqrt(n/2) then t1:=t1-1; fi;
    t2:=ceil(n*sqrt((n-1)/2));
    eps:=0;
    if isprime(t2) then eps:=1; fi;
    pi(t1)-pi(t2)+eps;
    end;
    [seq(f(n),n=1..120)]; # N. J. A. Sloane, Apr 26 2012