We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexDiscussionExhibition › PRIME Number Finder
Pages: 1 2 3 
PRIME Number Finder (Read 5758 times)
PRIME Number Finder
Nov 8th, 2009, 5:14pm
 
Hi I have recently been working on a prime number finder that has just reached 21 million and has found 1.3 million primes. I wondered if anyone else has been working on anything similar. Ta Smiley
Re: PRIME Number Finder
Reply #1 - Nov 8th, 2009, 5:32pm
 
I also made a second version which only tests the powers of two-1 (pow(2,x)-1) this reached 2147 million or x=32 which I find cool.


Re: PRIME Number Finder
Reply #2 - Nov 12th, 2009, 3:47pm
 
Not working on anything similar but sounds good. What program did you make it on? Could you make one for composite numbers and how would you get started?
Billy
Cool
Re: PRIME Number Finder
Reply #3 - Nov 12th, 2009, 3:47pm
 
Not working on anything similar but sounds good. What program did you make it on? Could you make one for composite numbers and how would you get started?
Billy
Cool
Re: PRIME Number Finder
Reply #4 - Nov 12th, 2009, 3:47pm
 
Not working on anything similar but sounds good. What program did you make it on? Could you make one for composite numbers and how would you get started?
Billy
Re: PRIME Number Finder
Reply #5 - Nov 12th, 2009, 3:48pm
 
Not working on anything similar but sounds good. What program did you make it on? Could you make one for composite numbers and how would you get started?
Billy
Re: PRIME Number Finder
Reply #6 - Nov 15th, 2009, 6:31pm
 
my friend made a Ulam Spiral program. As well as a program that generated prime numbers for it. ill get him to post what hes got
Re: PRIME Number Finder
Reply #7 - Nov 15th, 2009, 6:35pm
 
pwn monkey wrote on Nov 15th, 2009, 6:31pm:
my friend made a Ulam Spiral program. As well as a program that generated prime numbers for it. ill get him to post what hes got


Yeah, I made an Ulam spiral program and a generator...the generator is pretty slow but I'm sure it can be optimized.

Maybe I'll get a computer and devote it to processing prime #s all day!
Re: PRIME Number Finder
Reply #8 - Nov 15th, 2009, 7:07pm
 
that would be sweet
Re: PRIME Number Finder
Reply #9 - Nov 15th, 2009, 8:18pm
 
http://kodev.wordpress.com/
Here is a link to his prime generator, enjoy
Re: PRIME Number Finder
Reply #10 - Nov 17th, 2009, 2:19pm
 
Haha, my prime # gen crashed Processing. I left it on overnight trying to get all prime numbers less than 10^9, but unfortunately it simply couldn't handle the really big numbers. It started glitching somewhere before 2.1x10^6, as it started spitting out even numbers. Might be the % operator...idk yet. Before it even got to 2.11x10^6, it crashed processing. Oh, well! At least I know the limitations of my program!

I probably ended up generating 1 million primes or so...but none were saved; it doesn't save them to a text file until it's finished generating all of the primes up to a given number.
Re: PRIME Number Finder
Reply #11 - Nov 22nd, 2009, 4:55pm
 
Cool. My prime finder has now got to 25 million and has running for only 70 hours. I am still in high school so I can't run it all the time. I have parents and things.

Any way I have been using a Print-Writer command which means I don't lose primes if it crashes(which I am proud to say it hasn't). Grin

It has generated 1.6 million primes.
Re: PRIME Number Finder
Reply #12 - Nov 22nd, 2009, 9:05pm
 
Beatsy wrote on Nov 22nd, 2009, 4:55pm:
Cool. My prime finder has now got to 25 million and has running for only 70 hours. I am still in high school so I can't run it all the time. I have parents and things.

Any way I have been using a Print-Writer command which means I don't lose primes if it crashes(which I am proud to say it hasn't). Grin

It has generated 1.6 million primes.


Would you kindly share your source code Mine keeps screwing up after 16777213 for some odd reason. I'm using the % operator, but I don't think that has anything to do with it.

Mine saves the primes to a text document after it finishes, IF it doesn't crashes (which I'm not proud to say that it has!)  Sad

Kyle
Re: PRIME Number Finder
Reply #13 - Nov 23rd, 2009, 5:42pm
 
Alright, so I finally got around to trying out some more ideas. Instead of taking a number that follows 6n±1 and testing if it's prime by dividing them by all primes up to its square root, I am now using only odd numbers and dividing them by odd numbers up to the square root. Oddly enough, the latter method proves to be MUCH more efficient! I ran it in my physics class today (11:30am) and checked it at 2:45pm and found that it had generated all prime numbers less than 154 million!!!!! I don't know how this is so much more efficient, but it sure is! It still should be running and I'm waiting for it to get up to 1 billion, I believe. That'll be one huge text file!! Haha!

Kyle

P.S. And I'm now using PrintWriter, and that seems to do the trick!
Re: PRIME Number Finder
Reply #14 - Nov 24th, 2009, 6:15am
 
I think all this stuff it is really interesting, shall we share the code?
Pages: 1 2 3