 
 ERROR: no-relative-prime n ;
 
+<PRIVATE
+
 : (find-relative-prime) ( n guess -- p )
     over 1 <= [ over no-relative-prime ] when
     dup 1 <= [ drop 3 ] when
     2dup gcd nip 1 > [ 2 + (find-relative-prime) ] [ nip ] if ;
+
+PRIVATE>
 
 : find-relative-prime* ( n guess -- p )
     #! find a prime relative to n with initial guess

math.ranges namespaces random sequences hashtables sets ;
IN: math.miller-rabin

: >even ( n -- int ) dup even? [ 1- ] unless ; foldable
: >odd ( n -- int ) dup even? [ 1+ ] when ; foldable
: next-odd ( m -- n ) dup even? [ 1+ ] [ 2 + ] if ;

TUPLE: positive-even-expected n ;


            ] unless drop
        ] each prime? ] ;

PRIVATE>

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

: miller-rabin* ( n numtrials -- ? )
    over {
        { [ dup 1 <= ] [ 3drop f ] }
