! 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 ;