[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Omaha.pm] Talk about brute forcing a problem...
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