     t = t.mod(n)
   #console.log t.toString()
   ret = (t.compareTo(nbv(2)) is 0)
+  #fta.stop()
   ret
 
 #--------------

  msrf = new MS_RandomFountain()

  for i in [0...iter]
    a = ms_random_zn msrf, n
    y = a.modPow(r,n)
    if y.compareTo(BigInteger.ONE) isnt 0

exports.miller_rabin = miller_rabin
exports.random_prime = random_prime

#=================================================================

progress_hook = (obj) ->
  s = obj.p.toString()
  interval = if obj.total? and obj.i? then "(#{obj.i} of #{obj.total})" else ""
  console.log "+ #{obj.what} #{interval} #{s[0...3]}....#{s[(s.length-6)...]}"
await random_prime 3072, 10, defer(p), progress_hook
console.log p.toString()
process.exit -1

