Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » sci.math.* » sci.math

Topic: I do not need any primality test...I've just created the perfect sieve
Replies: 12   Last Post: Sep 5, 2013 6:28 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
amzoti

Posts: 1,108
Registered: 3/6/07
Re: I do not need any primality test...I've just created the perfect sieve
Posted: Sep 5, 2013 10:38 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Thursday, September 5, 2013 7:27:36 AM UTC-7, jonas.t...@gmail.com wrote:
> I've just created the perfect sieve.
>
> https://skydrive.live.com/?cid=b818a757899dc189#cid=B818A757899DC189&id=B818A757899DC189!2901&v=3
>
>
>
> <!DOCTYPE html>
>
> <html>
>
> <body>
>
>
>
> <canvas id="myCanvas" width="4000" height="4000">Your browser does not support the HTML5 canvas tag.</canvas>
>
>
>
> <script>
>
> function isPrime(n) {
>
> if (isNaN(n) || !isFinite(n) || n%1 || n<2) return false;
>
> var m=Math.sqrt(n);
>
> for (var i=2;i<=m;i++) if (n%i==0) return false;
>
> return true;
>
> }
>
>
>
> number=42;
>
> row=1;
>
> column=1;
>
> height=5;
>
> width=5;
>
> x2=5;
>
> y2=10;
>
> h_inner=0;
>
> h_outer=0;
>
> v_outer=0;
>
> i=1;
>
> down=1;
>
> back=2;
>
>
>
> var sieve= new Array();
>
> sieve[0]=2;
>
> sieve[1]=3;
>
> sieve[2]=5;
>
> sieve[3]=7;
>
> sieve[4]=11;
>
> sieve[5]=13;
>
> sieve[6]=17;
>
> sieve[7]=19;
>
> var c=document.getElementById('myCanvas');
>
> var ctx=c.getContext('2d');
>
>
>
> //ctx.fillStyle='yellow';
>
> //ctx.fillRect(h_inner,v_outer,width,height);
>
> //ctx.fillStyle = "blue";
>
> //ctx.font = "bold 10px Arial";
>
> //ctx.fillText(number, h_inner+3, y2);
>
> //h_inner=h_inner+60;
>
>
>
> number=number+1;
>
> h_outer=h_outer+5;
>
>
>
> while(number<6400){
>
>
>
> vertical=0;
>
> v_outer=0;
>
> v_inner=v_outer;
>
> h_inner=h_outer;
>
> while(vertical<down){
>
>
>
> //if (number %sieve[0]==0 && number!=sieve[0]){number=number+1;}
>
> //if (number %sieve[1]==0 && number!=sieve[1]){number=number+2;}
>
> //if (number %sieve[2]==0 && number!=sieve[2]){number=number+2;}
>
> //if (number %sieve[3]==0 && number!=sieve[3]){number=number+2;}
>
> //if (number %sieve[4]==0 && number!=sieve[4]){number=number+2;}
>
> //if (number %sieve[5]==0 && number!=sieve[5]){number=number+2;}
>
> //if (number %sieve[6]==0 && number!=sieve[6]){number=number+2;}
>
> //if (number %sieve[7]==0 && number!=sieve[7]){number=number+2;}
>
>
>
> ctx.fillStyle='yellow';
>
> if(isPrime(number)){ctx.fillStyle='blue';}
>
> ctx.fillRect(h_inner,v_inner,width,height);
>
> ctx.fillStyle = "black";
>
> ctx.font = "bold 10px Arial";
>
> ctx.fillText(number, h_inner+3, v_inner+12);
>
> v_inner=v_inner+5;
>
> vertical++;
>
> number+2;
>
> }
>
>
>
> down++;
>
> q=0;
>
> h_inner=h_outer;
>
>
>
> while(q<back){
>
> //if (number %sieve[0]==0 && number!=sieve[0]){number=number+1;}
>
> //if (number %sieve[1]==0 && number!=sieve[1]){number=number+2;}
>
> //if (number %sieve[2]==0 && number!=sieve[2]){number=number+2;}
>
> //if (number %sieve[3]==0 && number!=sieve[3]){number=number+2;}
>
> //if (number %sieve[4]==0 && number!=sieve[4]){number=number+2;}
>
> //if (number %sieve[5]==0 && number!=sieve[5]){number=number+2;}
>
> //if (number %sieve[6]==0 && number!=sieve[6]){number=number+2;}
>
> //if (number %sieve[7]==0 && number!=sieve[7]){number=number+2;}
>
> ctx.fillStyle='yellow';
>
> if(isPrime(number)){ctx.fillStyle='blue';}
>
> ctx.fillRect(h_inner,v_inner,width,height);
>
> ctx.fillStyle = "black";
>
> ctx.font = "bold 10px Arial";
>
> ctx.fillText(number, h_inner+3, v_inner+12);
>
> h_inner=h_inner-5;
>
> q++;
>
> number+2;
>
> }
>
> back++;
>
>
>
> h_outer=h_outer+5;
>
>
>
> }
>
>
>
> </script>
>
>
>
> </body>
>
> </html>


Can you please generate a 16,000 bit prime number and provide running times?



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.