login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A275534 Number of primes of the form x^2 + y^2 less than or equal to 2*n^2. 1

%I #23 Sep 02 2016 00:16:16

%S 1,2,4,5,7,9,12,15,18,22,25,29,33,37,43,46,51,56,62,68,75,79,86,93,

%T 102,107,114,119,127,136,143,150,160,169,179,184,195,206,215,223,233,

%U 242,254,264,274,285,297,307,318,330,339,350,362,376,386,400,415,428,441,452,465,483,498,510,525,541

%N Number of primes of the form x^2 + y^2 less than or equal to 2*n^2.

%C Number of terms in A002313 that are less than A001105(n).

%H William Boyles, <a href="/A275534/b275534.txt">Table of n, a(n) for n = 1..1000</a>

%t nn = 66; Table[Count[Take[#, PrimePi[2 n^2]], k_ /; k > 0], {n, nn}] &@

%t SquaresR[2, Prime@ Range@ PrimePi[2 nn^2]] (* _Michael De Vlieger_, Aug 01 2016 *)

%o (C++)

%o #include <iostream>

%o #include <cmath>

%o using namespace std;

%o bool IsPrime(int a){

%o int i = 3;

%o if(a == 2)

%o {return true;}

%o if(a <= 1 || a%2 == 0)

%o {return false;}

%o else{

%o while(i <= sqrt(a)){

%o if(a%i == 0)

%o {return false;}

%o else

%o {i = i+2;}}

%o return true;}}

%o int main(){

%o int Max, FourKPlusOne;

%o int limit=25; //Number of terms

%o for(int TermNum=1; TermNum<=limit; TermNum++){

%o Max = 2*TermNum*TermNum;

%o int Term=1;

%o for(int counter3=1; counter3<=(Max-1)/4; counter3++){

%o FourKPlusOne=((4*(counter3))+1);

%o if(IsPrime(FourKPlusOne) == true && FourKPlusOne<=Max)

%o {Term++;}}

%o cout<<Term<<endl;}}

%o (PARI) a(n)=my(s); forprime(p=2,2*n^2, if(p%4<3, s++)); s \\ _Charles R Greathouse IV_, Sep 02 2016

%Y Cf. A001105, A002313.

%K nonn

%O 1,2

%A _William Boyles_, Jul 31 2016

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 10:34 EDT 2024. Contains 371967 sequences. (Running on oeis4.)