[crap] posting our own shitty code [lol-worthy] (15)

6 Name: #!/usr/bin/anonymous : 2006-11-27 18:36 ID:Heaven

>>5
wrong.
1 is not prime. your is_prime returns true for 1.
this one works:

sub is_prime{$_='x'x pop;/xx/^/^(xx+)\1+$/}

but that method is extremely slow... it takes 10.20 seconds of cpu time on my computer to tell me that 65537 is prime... compare that with less than 0.01 seconds for the one in >>4...

This thread has been closed. You cannot post in this thread any longer.