Paste: A bad way to test primality ;)

Author: Harold
Mode: factor
Date: Mon, 3 Nov 2008 04:23:58
Plain Text |
! Copyright (C) 2008
! See http://factorcode.org/license.txt for BSD license.
IN: prime
USING: kernel math math.intervals math.ranges sequences ;

: divisors? ( divisor list -- list? ) [ swap tuck swap mod 0 = ] map swap drop ;

: prime? ( i -- ? ) dup 2 swap 1 - [a,b] divisors? f swap [ or ] each not ;

New Annotation

Summary:
Author:
Mode:
Body: