include mpfr.e mpz f = mpz_init() integer n = 2 bool still_running = true, still_printing = true while still_running do atom t0 = time() mpz_fac_ui(f, n) still_running = (time()-t0)<10 -- (stop once over 10s) string ct = elapsed(time()-t0), res, what, pt t0 = time() if still_printing then res = shorten(mpz_get_str(f)) what = "printed" still_printing = (time()-t0)<10 -- (stop once over 10s) else res = sprintf("%,d digits",mpz_sizeinbase(f,10)) what = "size in base" end if pt = elapsed(time()-t0) printf(1,"factorial(%d):%s, calculated in %s, %s in %s\n", {n,res,ct,what,pt}) n *= 2 end while