[Omaha.pm] Talk about brute forcing a problem...

Jay Hannah jhannah at omnihotels.com
Fri Apr 1 12:28:10 PST 2005


Just when I thought *I* was guilty of brute forcing things too much... -grin-

http://www.cpan.org/authors/id/Q/QU/QUBE/primes.pl


PRIMETEST:
	for ($count1=1;$count1 <= $prime_candidate / 2;$count1++)
	{
		for ($count2=1;$count2 <= $prime_candidate /2;$count2++)
		{
			if ($count1 * $count2 == $prime_candidate)
			{
			$truth = 0;
			last PRIMETEST;
			}
		}
	}


Wow. Aren't there smarter/faster mathmetical ways to find primes?

j




More information about the Omaha-pm mailing list