in reply to Prime Number Finder
There's an interesting algorithm for finding whether a number is prime in the documentation of Quantum::Superpositions, which provides quantum-like superpositions in Perl :
Gu
Update : Removed assertion on the complexity of this algorithm
See the documentation for details on how quantum-like superpositions work.use Quantum::Superpositions ; sub is_prime { my ($n) = @_; return $n % all(2..sqrt($n)+1) != 0 }
Gu
Update : Removed assertion on the complexity of this algorithm
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Prime Number Finder
by blokhead (Monsignor) on Nov 11, 2005 at 13:46 UTC | |
by Roy Johnson (Monsignor) on Nov 11, 2005 at 21:47 UTC | |
by blokhead (Monsignor) on Nov 11, 2005 at 22:58 UTC | |
by gu (Beadle) on Nov 12, 2005 at 21:22 UTC | |
by Roy Johnson (Monsignor) on Nov 12, 2005 at 03:38 UTC | |
by blokhead (Monsignor) on Nov 12, 2005 at 15:01 UTC | |
Re^2: Prime Number Finder
by hv (Prior) on Nov 11, 2005 at 14:59 UTC |
In Section
Cool Uses for Perl