         ] [
             r iota [
                 2^ s * a swap n ^mod n - -1 =
-            ] any? not 
+            ] any? not
         ] if
     ] any? not ;
 
 PRIVATE>
+
+: next-odd ( m -- n ) dup even? [ 1 + ] [ 2 + ] if ;
 
 : miller-rabin* ( n numtrials -- ? )
     over {

: >even ( n -- int ) 0 clear-bit ; foldable

: next-even ( m -- n ) >even 2 + ;

: next-odd ( m -- n ) dup even? [ 1 + ] [ 2 + ] if ;

TUPLE: positive-even-expected n ;


! Copyright (c) 2008-2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: combinators kernel locals math math.functions math.ranges
random sequences sets combinators.short-circuit math.bitwise
