PSX5Central

Non Gaming Discussions => Off-Topic => Topic started by: Avatarr on January 26, 2003, 06:51:20 PM

Title: How fast can your box identify prime numbers?
Post by: Avatarr on January 26, 2003, 06:51:20 PM
One day, I wanted a list of all the prime numbers between 99999 and 1. I thought this operation wouldn\'t take /that/ long, but it can take a noticable amount of time. This\'d be an interesting twist on the 3dMark contests you may have had in the past. :p

Download the binary from here:
http://homepages.ihug.com.au/~lagunad/plgen/plgen.htm
(click on PLGEN Binary on the side bar)

And then tell us ur results. I\'m not sure why, but it does get a tad faster each time you run the .exe . Prolly all the branch prediction stuff working along. So for consistency\'s sake, only post your results for the first run.

Me:
157 seconds on the first run.
Title: How fast can your box identify prime numbers?
Post by: Mr. Kennedy on January 26, 2003, 07:54:02 PM
I actually wrote a program that can do that for you, I\'ll show you my personal version tomorrow.

I\'m a better programmer :)
Title: How fast can your box identify prime numbers?
Post by: Avatarr on January 26, 2003, 08:10:58 PM
If its already written, u can post the source code here. :p
Title: How fast can your box identify prime numbers?
Post by: Mr. Kennedy on January 26, 2003, 08:49:29 PM
what language you using, mine is written in Java.

But my program is at school so I\'ll have to wait til tomorrow.  I have several programs that are very effective, I\'ll be moving on to something new on Monday.
Title: How fast can your box identify prime numbers?
Post by: Avatarr on January 26, 2003, 09:03:25 PM
C++

I\'ll bet its slower just given the fact that its written in Java, even if you did use the Euclidian Algorithm. Did u use the Euclidian Algorithm, btw. Why do you claim its "better"? Can u tell us a little bit about your "better" program?
Title: How fast can your box identify prime numbers?
Post by: videoholic on January 27, 2003, 04:33:40 AM
192 seconds.  I suck.

I do like the naked picture of Tyra Banks at the end. Nice touch.
Title: How fast can your box identify prime numbers?
Post by: Avatarr on January 27, 2003, 04:52:42 AM
:)
Title: How fast can your box identify prime numbers?
Post by: §ôµÏG®ïñD on January 27, 2003, 05:54:07 AM
156 seconds for me..
Title: How fast can your box identify prime numbers?
Post by: Kurt Angle on January 27, 2003, 08:32:23 AM
I set it going 10 mins ago, its just past the half way mark.

EDIT: the second half was much quicker, total time 1140 secs!:laughing:
Title: How fast can your box identify prime numbers?
Post by: Tyrant on January 27, 2003, 09:00:01 AM
155 seconds.
did i win ;).
Title: How fast can your box identify prime numbers?
Post by: Mr. Kennedy on January 27, 2003, 04:08:50 PM
bah you guys suck

102 seconds!!!!!!
Title: How fast can your box identify prime numbers?
Post by: Avatarr on January 27, 2003, 04:15:27 PM
Quote
Originally posted by Kurt Angle
I set it going 10 mins ago, its just past the half way mark.

EDIT: the second half was much quicker, total time 1140 secs!:laughing:


:D yes. The primality checker thingy goes through each number between the number itself down to 1, seeing if there\'s a number in there that is a factor. I\'ve been told that you only need to start checking from the square root of the number. (sounds fairly reasonable). And that Euclidian Algorithm puts it down to just a bearable number of steps. :p

But sif you\'d trade efficiency for a total time of 1140 secs!!

Still waiting for that little program of urs Hurri. HURRY :D :p
(pun intended)
Title: How fast can your box identify prime numbers?
Post by: THX on January 27, 2003, 08:05:25 PM
p2.4b oc\'ed to 2.7 for this test & 3dmark.

83 sec
Title: How fast can your box identify prime numbers?
Post by: Avatarr on January 28, 2003, 04:24:08 AM
Gee THX, that\'s really really fast! Let\'s see if anyone can break the 60 seconds barrier! But while we\'re on the subject of fast, lets jump to the subject of slow. Hurricane is really taking his time with that program of his. :p Just thought I\'d put in a reminder. :)
Title: How fast can your box identify prime numbers?
Post by: Mr. Kennedy on January 28, 2003, 04:43:50 AM
well I didn\'t go to school yesterday cause I was sick and thats where my program is.

it doesn\'t do 1 to 9999, it does 1 to n where n can be any number greater than 1, I\'ll post it today when I get the chance.
Title: How fast can your box identify prime numbers?
Post by: Mr. Kennedy on January 28, 2003, 08:00:30 AM
Actually this program is used for factors...

public class testloop2
{
   //Andrew Loomis      01-23-03
   //Project Name:      test-loop-2
   //This program is designed to find the factors from one to any positive
   //integer (n).
   
   public static void main(String args[])
   throws java.io.IOException
   {
      EasyReader Keyboard = new EasyReader();
      
      int n;
      char again;
      
      System.out.print("This program is designed to find the factors ");
      System.out.print("\\nfrom one up to and including a positive integer (n). ");
      
      do
      {   
         System.out.print("\\n\\nFind the factors from 1 to ");
         n = Keyboard.readInt();
         
         while (n <= 0)
         {
            System.out.print("\\nPlease enter a positive non-zero integer:  ");
            n = Keyboard.readInt();
         }
         
         System.out.print("\\n");
         
         for (int i = 1; i <= n; i++)
            if (n % i == 0)
               System.out.print(i + ", ");
         
         System.out.print("\\n\\nWould you like to use this program again?  ");
         again = Keyboard.readChar();
         Keyboard.readLine();
      }
      while ((again == \'Y\') || (again == \'y\'));
      
      System.out.print("\\n\\nThank you for using my program.");
   }
}
Title: How fast can your box identify prime numbers?
Post by: Avatarr on January 28, 2003, 03:27:37 PM
a mod operation inside a for loop...
isn\'t that cute.
Title: How fast can your box identify prime numbers?
Post by: Mr. Kennedy on January 28, 2003, 04:34:53 PM
well, I\'m still working on improvements.  I\'ll have better stuff in coming months.
Title: How fast can your box identify prime numbers?
Post by: Styx on January 28, 2003, 06:58:31 PM
576 god i need a new pc. Come on tax return
Title: How fast can your box identify prime numbers?
Post by: -____- on January 30, 2003, 04:38:14 PM
124 sec.
Title: How fast can your box identify prime numbers?
Post by: Ace on January 30, 2003, 04:51:38 PM
104
Title: How fast can your box identify prime numbers?
Post by: Sublimesjg on February 01, 2003, 04:54:49 AM
201 not too bad but its a pos p3 1.0 so its to be expected
Title: How fast can your box identify prime numbers?
Post by: Bobs_Hardware on February 01, 2003, 06:24:00 AM
131