isPrime in One Line of Groovy
This line of code is inspired by this post on primality in Perl.
$ groovy -e "println new BigInteger(args[0]).isProbablePrime(99)" 19
$ true <--- i.e. 19 is prime
I suspect that this will be considered cheating: (a) it evaluates "probable" primes and (b) it isn't in the spirit of the game. But still neat, n'est-ce-pas?
Final Score
JVM Tunnelers 1 Cryptic Scripts 0
1 comment:
I think this divides a clever (writes clver code) from an excellent developer (reuses existing code).
Peace
-stephan
--
Stephan Schmidt :: stephan@reposita.org
Reposita Open Source - Monitor your software development
http://www.reposita.org
Blog at http://stephan.reposita.org - No signal. No noise.
Post a Comment