Prime Numbers...

Everyone cares about what you have to say.
Post Reply
Denial
Deck16 Whore
Posts: 628
Joined: Tue Apr 20, 2004 4:52 am

Prime Numbers...

Post by Denial » Mon Apr 26, 2004 5:53 pm

I wrote a program that will calculate prime numbers till whenever...

http://datakill.org/~denial/bin/PrimeNumberFinder/

Prime100K was through 100,000
Prime1Mil only went to about 390,000 before I had to kill it...When i'm home I'll set it running before i go to sleep or w/e so I get all the prime numbers heh

Como se dice 'Nerd' en espanol?

ps you may have to rename prime to prime.exe if you want to run it yourself :roll:
Image

User avatar
Captain_Obvious
Site Admin
Posts: 2819
Joined: Tue Apr 20, 2004 4:36 am
Favorite Weapon: Impact Hammer!
Location: Mazon, AS
Contact:

Post by Captain_Obvious » Mon May 31, 2004 7:56 pm

heh I just found this on my server from a while back.

http://www.freeworldz.net/testsite/php/primes.php

It counts up to 100,000. You could make it count higher pretty easily by changing the $n<=100000 to a higher number, or just replacing 100000 with a variable.

here's the code if you're interested:

Code: Select all

<?php
for ($n = 1; $n<=100000; $n++) {
	if ( ($n == 1) OR ($n == 2) OR
	($n == 3) OR ($n == 5)) {
		print("$n<br>\n");
	} elseif (($n % 2 != 0) AND
	($n % 3 !=0) AND ($n % 5 !=0)){
		print("$n<br>\n");
	}
}
?>
:mrgreen:
You and the Cap'n make it happen!

Post Reply