! Copyright (C) 2009 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: combinators fry kernel locals math math.primes combinators.short-circuit ; IN: math.primes.lucas-lehmer ERROR: invalid-lucas-lehmer-candidate obj ; ] } 1&& [ invalid-lucas-lehmer-candidate ] unless ; PRIVATE> : lucas-lehmer ( p -- ? ) lucas-lehmer-guard { { [ dup 2 = ] [ drop t ] } { [ dup prime? ] [ do-lucas-lehmer ] } [ drop f ] } cond ;