From 8b4815c01eaa60456feab800135dbefe43e003e9 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Wed, 6 May 2009 14:10:29 -0500 Subject: [PATCH] fix miller-rabin --- basis/math/miller-rabin/miller-rabin.factor | 3 +++ 1 file changed, 3 insertions(+) diff --git a/basis/math/miller-rabin/miller-rabin.factor b/basis/math/miller-rabin/miller-rabin.factor index 8c36dd96fe..5e999aa956 100755 --- a/basis/math/miller-rabin/miller-rabin.factor +++ b/basis/math/miller-rabin/miller-rabin.factor @@ -8,6 +8,8 @@ IN: math.miller-rabin : >odd ( n -- int ) dup even? [ 1 + ] when ; foldable +: >even ( n -- int ) 0 clear-bit ; foldable + TUPLE: positive-even-expected n ; :: (miller-rabin) ( n trials -- ? ) @@ -97,6 +99,7 @@ PRIVATE> } 1&& ; : next-safe-prime ( n -- q ) + 1 - >even 2 / next-safe-prime-candidate dup >safe-prime-form dup miller-rabin