diff --git a/ats-src/combinatorics-ffi.dats b/ats-src/combinatorics-ffi.dats
--- a/ats-src/combinatorics-ffi.dats
+++ b/ats-src/combinatorics-ffi.dats
@@ -14,6 +14,10 @@
   "mac#"
 
 extern
+fun permutations_ats {n : nat}{ m : nat | m <= n } : (int(n), int(m)) -> Intinf =
+  "mac#"
+
+extern
 fun double_factorial {n : nat} : int(n) -> Intinf =
   "mac#"
 
@@ -22,6 +26,9 @@
   "mac#"
 
 implement choose_ats (n, k) =
+  choose(n, k)
+
+implement permutations_ats (n, k) =
   choose(n, k)
 
 implement double_factorial (m) =
diff --git a/ats-src/number-theory.dats b/ats-src/number-theory.dats
--- a/ats-src/number-theory.dats
+++ b/ats-src/number-theory.dats
@@ -23,6 +23,7 @@
   else
     m
 
+// FIXME this should return an intinf.
 fn lcm {k : nat}{l : nat} (m : int(l), n : int(k)) : int =
   (m / gcd(m, n)) * n
 
@@ -55,6 +56,7 @@
     loop(n, 1)
   end
 
+// FIXME this should return an Intinf
 fn sum_divisors(n : intGte(1)) :<> int =
   let
     fun loop {k : nat}{ m : nat | m > 0 && k >= m } .<k-m>. (n : int(k), acc : int(m)) :<> int =
diff --git a/cbits/combinatorics.c b/cbits/combinatorics.c
--- a/cbits/combinatorics.c
+++ b/cbits/combinatorics.c
@@ -1,7 +1,7 @@
 /*
 **
 ** The C code is generated by [ATS/Postiats-0-3-8]
-** The starting compilation time is: 2018-1-6: 19h:39m
+** The starting compilation time is: 2018-1-7: 19h:36m
 **
 */
 
@@ -540,6 +540,12 @@
 #if(0)
 ATSextern()
 atstkind_type(atstype_ptrk)
+permutations_ats(atstkind_t0ype(atstype_int), atstkind_t0ype(atstype_int)) ;
+#endif // end of [QUALIFIED]
+
+#if(0)
+ATSextern()
+atstkind_type(atstype_ptrk)
 double_factorial(atstkind_t0ype(atstype_int)) ;
 #endif // end of [QUALIFIED]
 
@@ -2678,7 +2684,7 @@
 } /* end of [ATSCNTRB_056_HX_056_intinf_vt__intinf_free__19__2] */
 
 /*
-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 494(line=24, offs=22) -- 517(line=25, offs=15)
+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 593(line=28, offs=22) -- 616(line=29, offs=15)
 */
 /*
 local: choose_21$0(level=0)
@@ -2695,11 +2701,11 @@
 /* tmpvardeclst(end) */
 ATSfunbody_beg()
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 483(line=24, offs=11) -- 517(line=25, offs=15)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 582(line=28, offs=11) -- 616(line=29, offs=15)
 */
 ATSINSflab(__patsflab_choose_ats):
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 505(line=25, offs=3) -- 517(line=25, offs=15)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 604(line=29, offs=3) -- 616(line=29, offs=15)
 */
 ATSINSmove(tmpret83, choose_21(arg0, arg1)) ;
 
@@ -2708,11 +2714,41 @@
 } /* end of [choose_ats] */
 
 /*
-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 546(line=27, offs=28) -- 561(line=28, offs=10)
+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 645(line=31, offs=28) -- 668(line=32, offs=15)
 */
 /*
+local: choose_21$0(level=0)
+global: fact_0$0(level=0), choose_21$0(level=0), permutations_ats$37$0(level=0)
+local: 
+global: 
+*/
+ATSextern()
+atstkind_type(atstype_ptrk)
+permutations_ats(atstkind_t0ype(atstype_int) arg0, atstkind_t0ype(atstype_int) arg1)
+{
+/* tmpvardeclst(beg) */
+ATStmpdec(tmpret84, atstkind_type(atstype_ptrk)) ;
+/* tmpvardeclst(end) */
+ATSfunbody_beg()
+/*
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 628(line=31, offs=11) -- 668(line=32, offs=15)
+*/
+ATSINSflab(__patsflab_permutations_ats):
+/*
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 656(line=32, offs=3) -- 668(line=32, offs=15)
+*/
+ATSINSmove(tmpret84, choose_21(arg0, arg1)) ;
+
+ATSfunbody_end()
+ATSreturn(tmpret84) ;
+} /* end of [permutations_ats] */
+
+/*
+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 697(line=34, offs=28) -- 712(line=35, offs=10)
+*/
+/*
 local: dfact_10$0(level=0)
-global: dfact_10$0(level=0), double_factorial$37$0(level=0)
+global: dfact_10$0(level=0), double_factorial$38$0(level=0)
 local: 
 global: 
 */
@@ -2721,28 +2757,28 @@
 double_factorial(atstkind_t0ype(atstype_int) arg0)
 {
 /* tmpvardeclst(beg) */
-ATStmpdec(tmpret84, atstkind_type(atstype_ptrk)) ;
+ATStmpdec(tmpret85, atstkind_type(atstype_ptrk)) ;
 /* tmpvardeclst(end) */
 ATSfunbody_beg()
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 529(line=27, offs=11) -- 562(line=28, offs=11)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 680(line=34, offs=11) -- 713(line=35, offs=11)
 */
 ATSINSflab(__patsflab_double_factorial):
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 554(line=28, offs=3) -- 561(line=28, offs=10)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 705(line=35, offs=3) -- 712(line=35, offs=10)
 */
-ATSINSmove(tmpret84, dfact_10(arg0)) ;
+ATSINSmove(tmpret85, dfact_10(arg0)) ;
 
 ATSfunbody_end()
-ATSreturn(tmpret84) ;
+ATSreturn(tmpret85) ;
 } /* end of [double_factorial] */
 
 /*
-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 588(line=30, offs=25) -- 602(line=31, offs=9)
+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 739(line=37, offs=25) -- 753(line=38, offs=9)
 */
 /*
 local: fact_0$0(level=0)
-global: fact_0$0(level=0), factorial_ats$38$0(level=0)
+global: fact_0$0(level=0), factorial_ats$39$0(level=0)
 local: 
 global: 
 */
@@ -2751,20 +2787,20 @@
 factorial_ats(atstkind_t0ype(atstype_int) arg0)
 {
 /* tmpvardeclst(beg) */
-ATStmpdec(tmpret85, atstkind_type(atstype_ptrk)) ;
+ATStmpdec(tmpret86, atstkind_type(atstype_ptrk)) ;
 /* tmpvardeclst(end) */
 ATSfunbody_beg()
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 574(line=30, offs=11) -- 603(line=31, offs=10)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 725(line=37, offs=11) -- 754(line=38, offs=10)
 */
 ATSINSflab(__patsflab_factorial_ats):
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 596(line=31, offs=3) -- 602(line=31, offs=9)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/combinatorics-ffi.dats: 747(line=38, offs=3) -- 753(line=38, offs=9)
 */
-ATSINSmove(tmpret85, fact_0(arg0)) ;
+ATSINSmove(tmpret86, fact_0(arg0)) ;
 
 ATSfunbody_end()
-ATSreturn(tmpret85) ;
+ATSreturn(tmpret86) ;
 } /* end of [factorial_ats] */
 
 /*
diff --git a/cbits/number-theory.c b/cbits/number-theory.c
--- a/cbits/number-theory.c
+++ b/cbits/number-theory.c
@@ -1,7 +1,7 @@
 /*
 **
 ** The C code is generated by [ATS/Postiats-0-3-8]
-** The starting compilation time is: 2018-1-6: 19h:39m
+** The starting compilation time is: 2018-1-7: 19h:36m
 **
 */
 
@@ -1966,7 +1966,7 @@
 } /* end of [ATSLIB_056_prelude__gt_g1int_int__1__2] */
 
 /*
-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 604(line=26, offs=4) -- 681(line=27, offs=22)
+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 643(line=27, offs=4) -- 720(line=28, offs=22)
 */
 /*
 local: gcd_29$0(level=0)
@@ -1985,21 +1985,21 @@
 /* tmpvardeclst(end) */
 ATSfunbody_beg()
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 604(line=26, offs=4) -- 681(line=27, offs=22)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 643(line=27, offs=4) -- 720(line=28, offs=22)
 */
 ATSINSflab(__patsflab_lcm_31):
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 667(line=27, offs=8) -- 676(line=27, offs=17)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 706(line=28, offs=8) -- 715(line=28, offs=17)
 */
 ATSINSmove(tmp55, gcd_29(arg0, arg1)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 663(line=27, offs=4) -- 676(line=27, offs=17)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 702(line=28, offs=4) -- 715(line=28, offs=17)
 */
 ATSINSmove(tmp54, atspre_g0int_div_int(arg0, tmp55)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 662(line=27, offs=3) -- 681(line=27, offs=22)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 701(line=28, offs=3) -- 720(line=28, offs=22)
 */
 ATSINSmove(tmpret53, atspre_g0int_mul_int(tmp54, arg1)) ;
 
@@ -2008,7 +2008,7 @@
 } /* end of [lcm_31] */
 
 /*
-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 724(line=30, offs=4) -- 1128(line=42, offs=6)
+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 763(line=31, offs=4) -- 1167(line=43, offs=6)
 */
 /*
 local: 
@@ -2025,11 +2025,11 @@
 /* tmpvardeclst(end) */
 ATSfunbody_beg()
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 724(line=30, offs=4) -- 1128(line=42, offs=6)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 763(line=31, offs=4) -- 1167(line=43, offs=6)
 */
 ATSINSflab(__patsflab_divisors_33):
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 769(line=31, offs=3) -- 1128(line=42, offs=6)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 808(line=32, offs=3) -- 1167(line=43, offs=6)
 */
 /*
 letpush(beg)
@@ -2039,12 +2039,12 @@
 */
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1112(line=41, offs=5) -- 1122(line=41, offs=15)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1151(line=42, offs=5) -- 1161(line=42, offs=15)
 */
 ATSINSmove(tmpret56, loop_34(arg0, ATSPMVi0nt(1))) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 769(line=31, offs=3) -- 1128(line=42, offs=6)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 808(line=32, offs=3) -- 1167(line=43, offs=6)
 */
 /*
 INSletpop()
@@ -2054,7 +2054,7 @@
 } /* end of [divisors_33] */
 
 /*
-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 781(line=32, offs=9) -- 1102(line=39, offs=33)
+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 820(line=33, offs=9) -- 1141(line=40, offs=33)
 */
 /*
 local: loop_34$0(level=1)
@@ -2074,48 +2074,48 @@
 /* tmpvardeclst(end) */
 ATSfunbody_beg()
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 781(line=32, offs=9) -- 1102(line=39, offs=33)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 820(line=33, offs=9) -- 1141(line=40, offs=33)
 */
 ATSINSflab(__patsflab_loop_34):
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 888(line=33, offs=10) -- 896(line=33, offs=18)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 927(line=34, offs=10) -- 935(line=34, offs=18)
 */
 ATSINSmove(tmp58, ATSLIB_056_prelude__gte_g1int_int__35__1(arg1, arg0)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 885(line=33, offs=7) -- 1102(line=39, offs=33)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 924(line=34, offs=7) -- 1141(line=40, offs=33)
 */
 ATSif(
 tmp58
 ) ATSthen() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 910(line=34, offs=9) -- 962(line=34, offs=61)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 949(line=35, offs=9) -- 1001(line=35, offs=61)
 */
 ATSINSmove_ldelay(tmpret57, atstype_boxed, ATSPMVcfunlab(1, __patsfun_38, (arg1))) ;
 } ATSelse() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 985(line=36, offs=12) -- 992(line=36, offs=19)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1024(line=37, offs=12) -- 1031(line=37, offs=19)
 */
 ATSINSmove(tmp69, atspre_g0int_mod_int(arg0, arg1)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 985(line=36, offs=12) -- 996(line=36, offs=23)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1024(line=37, offs=12) -- 1035(line=37, offs=23)
 */
 ATSINSmove(tmp66, ATSLIB_056_prelude__eq_g0int_int__7__5(tmp69, ATSPMVi0nt(0))) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 982(line=36, offs=9) -- 1102(line=39, offs=33)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1021(line=37, offs=9) -- 1141(line=40, offs=33)
 */
 ATSif(
 tmp66
 ) ATSthen() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1012(line=37, offs=11) -- 1056(line=37, offs=55)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1051(line=38, offs=11) -- 1095(line=38, offs=55)
 */
 ATSINSmove_ldelay(tmpret57, atstype_boxed, ATSPMVcfunlab(1, __patsfun_41, (arg0, arg1))) ;
 } ATSelse() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1080(line=39, offs=11) -- 1102(line=39, offs=33)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1119(line=40, offs=11) -- 1141(line=40, offs=33)
 */
 ATSINSmove_ldelay(tmpret57, atstype_boxed, ATSPMVcfunlab(1, __patsfun_42, ())) ;
 } /* ATSendif */
@@ -2209,7 +2209,7 @@
 } /* end of [ATSLIB_056_prelude__gte_g1int_int__35__1] */
 
 /*
-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 910(line=34, offs=9) -- 962(line=34, offs=61)
+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 949(line=35, offs=9) -- 1001(line=35, offs=61)
 */
 /*
 local: 
@@ -2227,21 +2227,21 @@
 /* tmpvardeclst(end) */
 ATSfunbody_beg()
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 910(line=34, offs=9) -- 962(line=34, offs=61)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 949(line=35, offs=9) -- 1001(line=35, offs=61)
 */
 ATSINSflab(__patsflab___patsfun_38):
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 910(line=34, offs=9) -- 962(line=34, offs=61)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 949(line=35, offs=9) -- 1001(line=35, offs=61)
 */
 ATSif(
 arg0
 ) ATSthen() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 938(line=34, offs=37) -- 960(line=34, offs=59)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 977(line=35, offs=37) -- 999(line=35, offs=59)
 */
 ATSINSmove_ldelay(tmp64, atstype_boxed, ATSPMVcfunlab(1, __patsfun_39, ())) ;
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 918(line=34, offs=17) -- 961(line=34, offs=60)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 957(line=35, offs=17) -- 1000(line=35, offs=60)
 */
 
 /*
@@ -2263,7 +2263,7 @@
 } /* end of [__patsfun_38] */
 
 /*
-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 938(line=34, offs=37) -- 960(line=34, offs=59)
+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 977(line=35, offs=37) -- 999(line=35, offs=59)
 */
 /*
 local: 
@@ -2280,17 +2280,17 @@
 /* tmpvardeclst(end) */
 ATSfunbody_beg()
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 938(line=34, offs=37) -- 960(line=34, offs=59)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 977(line=35, offs=37) -- 999(line=35, offs=59)
 */
 ATSINSflab(__patsflab___patsfun_39):
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 938(line=34, offs=37) -- 960(line=34, offs=59)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 977(line=35, offs=37) -- 999(line=35, offs=59)
 */
 ATSif(
 arg0
 ) ATSthen() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 946(line=34, offs=45) -- 959(line=34, offs=58)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 985(line=35, offs=45) -- 998(line=35, offs=58)
 */
 
 ATSINSmove_nil(tmpret65) ;
@@ -2344,7 +2344,7 @@
 } /* end of [ATSLIB_056_prelude__eq_g0int_int__7__5] */
 
 /*
-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1012(line=37, offs=11) -- 1056(line=37, offs=55)
+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1051(line=38, offs=11) -- 1095(line=38, offs=55)
 */
 /*
 local: loop_34$0(level=1)
@@ -2363,27 +2363,27 @@
 /* tmpvardeclst(end) */
 ATSfunbody_beg()
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1012(line=37, offs=11) -- 1056(line=37, offs=55)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1051(line=38, offs=11) -- 1095(line=38, offs=55)
 */
 ATSINSflab(__patsflab___patsfun_41):
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1012(line=37, offs=11) -- 1056(line=37, offs=55)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1051(line=38, offs=11) -- 1095(line=38, offs=55)
 */
 ATSif(
 arg0
 ) ATSthen() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1046(line=37, offs=45) -- 1053(line=37, offs=52)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1085(line=38, offs=45) -- 1092(line=38, offs=52)
 */
 ATSINSmove(tmp72, atspre_g1int_add_int(env1, ATSPMVi0nt(1))) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1038(line=37, offs=37) -- 1054(line=37, offs=53)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1077(line=38, offs=37) -- 1093(line=38, offs=53)
 */
 ATSINSmove(tmp71, loop_34(env0, tmp72)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1020(line=37, offs=19) -- 1055(line=37, offs=54)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1059(line=38, offs=19) -- 1094(line=38, offs=54)
 */
 
 /*
@@ -2405,7 +2405,7 @@
 } /* end of [__patsfun_41] */
 
 /*
-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1080(line=39, offs=11) -- 1102(line=39, offs=33)
+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1119(line=40, offs=11) -- 1141(line=40, offs=33)
 */
 /*
 local: 
@@ -2422,17 +2422,17 @@
 /* tmpvardeclst(end) */
 ATSfunbody_beg()
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1080(line=39, offs=11) -- 1102(line=39, offs=33)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1119(line=40, offs=11) -- 1141(line=40, offs=33)
 */
 ATSINSflab(__patsflab___patsfun_42):
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1080(line=39, offs=11) -- 1102(line=39, offs=33)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1119(line=40, offs=11) -- 1141(line=40, offs=33)
 */
 ATSif(
 arg0
 ) ATSthen() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1088(line=39, offs=19) -- 1101(line=39, offs=32)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1127(line=40, offs=19) -- 1140(line=40, offs=32)
 */
 
 ATSINSmove_nil(tmpret73) ;
@@ -2445,7 +2445,7 @@
 } /* end of [__patsfun_42] */
 
 /*
-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1133(line=44, offs=4) -- 1444(line=56, offs=6)
+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1172(line=45, offs=4) -- 1483(line=57, offs=6)
 */
 /*
 local: 
@@ -2462,11 +2462,11 @@
 /* tmpvardeclst(end) */
 ATSfunbody_beg()
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1133(line=44, offs=4) -- 1444(line=56, offs=6)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1172(line=45, offs=4) -- 1483(line=57, offs=6)
 */
 ATSINSflab(__patsflab_count_divisors_43):
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1175(line=45, offs=3) -- 1444(line=56, offs=6)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1214(line=46, offs=3) -- 1483(line=57, offs=6)
 */
 /*
 letpush(beg)
@@ -2476,12 +2476,12 @@
 */
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1428(line=55, offs=5) -- 1438(line=55, offs=15)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1467(line=56, offs=5) -- 1477(line=56, offs=15)
 */
 ATSINSmove(tmpret74, loop_44(arg0, ATSPMVi0nt(1))) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1175(line=45, offs=3) -- 1444(line=56, offs=6)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1214(line=46, offs=3) -- 1483(line=57, offs=6)
 */
 /*
 INSletpop()
@@ -2491,7 +2491,7 @@
 } /* end of [count_divisors_43] */
 
 /*
-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1187(line=46, offs=9) -- 1418(line=53, offs=27)
+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1226(line=47, offs=9) -- 1457(line=54, offs=27)
 */
 /*
 local: loop_44$0(level=1)
@@ -2516,64 +2516,64 @@
 /* tmpvardeclst(end) */
 ATSfunbody_beg()
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1187(line=46, offs=9) -- 1418(line=53, offs=27)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1226(line=47, offs=9) -- 1457(line=54, offs=27)
 */
 ATSINSflab(__patsflab_loop_44):
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1285(line=47, offs=10) -- 1293(line=47, offs=18)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1324(line=48, offs=10) -- 1332(line=48, offs=18)
 */
 ATSINSmove(tmp76, ATSLIB_056_prelude__gte_g1int_int__35__2(arg1, arg0)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1282(line=47, offs=7) -- 1418(line=53, offs=27)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1321(line=48, offs=7) -- 1457(line=54, offs=27)
 */
 ATSif(
 tmp76
 ) ATSthen() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1307(line=48, offs=9) -- 1308(line=48, offs=10)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1346(line=49, offs=9) -- 1347(line=49, offs=10)
 */
 ATSINSmove(tmpret75, ATSPMVi0nt(1)) ;
 } ATSelse() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1331(line=50, offs=12) -- 1338(line=50, offs=19)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1370(line=51, offs=12) -- 1377(line=51, offs=19)
 */
 ATSINSmove(tmp82, atspre_g0int_mod_int(arg0, arg1)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1331(line=50, offs=12) -- 1342(line=50, offs=23)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1370(line=51, offs=12) -- 1381(line=51, offs=23)
 */
 ATSINSmove(tmp79, ATSLIB_056_prelude__eq_g0int_int__7__6(tmp82, ATSPMVi0nt(0))) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1328(line=50, offs=9) -- 1418(line=53, offs=27)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1367(line=51, offs=9) -- 1457(line=54, offs=27)
 */
 ATSif(
 tmp79
 ) ATSthen() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1370(line=51, offs=23) -- 1377(line=51, offs=30)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1409(line=52, offs=23) -- 1416(line=52, offs=30)
 */
 ATSINSmove(tmp84, atspre_g1int_add_int(arg1, ATSPMVi0nt(1))) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1362(line=51, offs=15) -- 1378(line=51, offs=31)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1401(line=52, offs=15) -- 1417(line=52, offs=31)
 */
 ATSINSmove(tmp83, loop_44(arg0, tmp84)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1358(line=51, offs=11) -- 1378(line=51, offs=31)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1397(line=52, offs=11) -- 1417(line=52, offs=31)
 */
 ATSINSmove(tmpret75, atspre_g0int_add_int(ATSPMVi0nt(1), tmp83)) ;
 
 } ATSelse() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1410(line=53, offs=19) -- 1417(line=53, offs=26)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1449(line=54, offs=19) -- 1456(line=54, offs=26)
 */
 ATSINSmove(tmp85, atspre_g1int_add_int(arg1, ATSPMVi0nt(1))) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1402(line=53, offs=11) -- 1418(line=53, offs=27)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1441(line=54, offs=11) -- 1457(line=54, offs=27)
 */
 ATStailcal_beg()
 ATSINSmove_tlcal(apy0, arg0) ;
@@ -2672,7 +2672,7 @@
 } /* end of [ATSLIB_056_prelude__eq_g0int_int__7__6] */
 
 /*
-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1449(line=58, offs=4) -- 1760(line=70, offs=6)
+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1526(line=60, offs=4) -- 1837(line=72, offs=6)
 */
 /*
 local: 
@@ -2689,11 +2689,11 @@
 /* tmpvardeclst(end) */
 ATSfunbody_beg()
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1449(line=58, offs=4) -- 1760(line=70, offs=6)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1526(line=60, offs=4) -- 1837(line=72, offs=6)
 */
 ATSINSflab(__patsflab_sum_divisors_48):
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1489(line=59, offs=3) -- 1760(line=70, offs=6)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1566(line=61, offs=3) -- 1837(line=72, offs=6)
 */
 /*
 letpush(beg)
@@ -2703,12 +2703,12 @@
 */
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1744(line=69, offs=5) -- 1754(line=69, offs=15)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1821(line=71, offs=5) -- 1831(line=71, offs=15)
 */
 ATSINSmove(tmpret86, loop_49(arg0, ATSPMVi0nt(1))) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1489(line=59, offs=3) -- 1760(line=70, offs=6)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1566(line=61, offs=3) -- 1837(line=72, offs=6)
 */
 /*
 INSletpop()
@@ -2718,7 +2718,7 @@
 } /* end of [sum_divisors_48] */
 
 /*
-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1501(line=60, offs=9) -- 1734(line=67, offs=27)
+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1578(line=62, offs=9) -- 1811(line=69, offs=27)
 */
 /*
 local: loop_49$0(level=1)
@@ -2743,64 +2743,64 @@
 /* tmpvardeclst(end) */
 ATSfunbody_beg()
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1501(line=60, offs=9) -- 1734(line=67, offs=27)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1578(line=62, offs=9) -- 1811(line=69, offs=27)
 */
 ATSINSflab(__patsflab_loop_49):
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1599(line=61, offs=10) -- 1607(line=61, offs=18)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1676(line=63, offs=10) -- 1684(line=63, offs=18)
 */
 ATSINSmove(tmp88, ATSLIB_056_prelude__gte_g1int_int__35__3(arg1, arg0)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1596(line=61, offs=7) -- 1734(line=67, offs=27)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1673(line=63, offs=7) -- 1811(line=69, offs=27)
 */
 ATSif(
 tmp88
 ) ATSthen() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1621(line=62, offs=9) -- 1622(line=62, offs=10)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1698(line=64, offs=9) -- 1699(line=64, offs=10)
 */
 ATSINSmove(tmpret87, ATSPMVi0nt(0)) ;
 } ATSelse() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1645(line=64, offs=12) -- 1652(line=64, offs=19)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1722(line=66, offs=12) -- 1729(line=66, offs=19)
 */
 ATSINSmove(tmp94, atspre_g0int_mod_int(arg0, arg1)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1645(line=64, offs=12) -- 1656(line=64, offs=23)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1722(line=66, offs=12) -- 1733(line=66, offs=23)
 */
 ATSINSmove(tmp91, ATSLIB_056_prelude__eq_g0int_int__7__7(tmp94, ATSPMVi0nt(0))) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1642(line=64, offs=9) -- 1734(line=67, offs=27)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1719(line=66, offs=9) -- 1811(line=69, offs=27)
 */
 ATSif(
 tmp91
 ) ATSthen() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1686(line=65, offs=25) -- 1693(line=65, offs=32)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1763(line=67, offs=25) -- 1770(line=67, offs=32)
 */
 ATSINSmove(tmp96, atspre_g1int_add_int(arg1, ATSPMVi0nt(1))) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1678(line=65, offs=17) -- 1694(line=65, offs=33)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1755(line=67, offs=17) -- 1771(line=67, offs=33)
 */
 ATSINSmove(tmp95, loop_49(arg0, tmp96)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1672(line=65, offs=11) -- 1694(line=65, offs=33)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1749(line=67, offs=11) -- 1771(line=67, offs=33)
 */
 ATSINSmove(tmpret87, atspre_g0int_add_int(arg1, tmp95)) ;
 
 } ATSelse() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1726(line=67, offs=19) -- 1733(line=67, offs=26)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1803(line=69, offs=19) -- 1810(line=69, offs=26)
 */
 ATSINSmove(tmp97, atspre_g1int_add_int(arg1, ATSPMVi0nt(1))) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1718(line=67, offs=11) -- 1734(line=67, offs=27)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1795(line=69, offs=11) -- 1811(line=69, offs=27)
 */
 ATStailcal_beg()
 ATSINSmove_tlcal(apy0, arg0) ;
@@ -2899,7 +2899,7 @@
 } /* end of [ATSLIB_056_prelude__eq_g0int_int__7__7] */
 
 /*
-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1826(line=73, offs=4) -- 1884(line=74, offs=22)
+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1903(line=75, offs=4) -- 1961(line=76, offs=22)
 */
 /*
 local: sum_divisors_48$0(level=0)
@@ -2917,16 +2917,16 @@
 /* tmpvardeclst(end) */
 ATSfunbody_beg()
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1826(line=73, offs=4) -- 1884(line=74, offs=22)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1903(line=75, offs=4) -- 1961(line=76, offs=22)
 */
 ATSINSflab(__patsflab_is_perfect_52):
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1865(line=74, offs=3) -- 1879(line=74, offs=17)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1942(line=76, offs=3) -- 1956(line=76, offs=17)
 */
 ATSINSmove(tmp101, sum_divisors_48(arg0)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1865(line=74, offs=3) -- 1884(line=74, offs=22)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1942(line=76, offs=3) -- 1961(line=76, offs=22)
 */
 ATSINSmove(tmpret98, ATSLIB_056_prelude__eq_g0int_int__7__8(tmp101, arg0)) ;
 
@@ -2976,7 +2976,7 @@
 } /* end of [ATSLIB_056_prelude__eq_g0int_int__7__8] */
 
 /*
-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1916(line=77, offs=4) -- 2297(line=92, offs=6)
+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1993(line=79, offs=4) -- 2374(line=94, offs=6)
 */
 /*
 local: is_prime_16$0(level=0)
@@ -2993,11 +2993,11 @@
 /* tmpvardeclst(end) */
 ATSfunbody_beg()
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1916(line=77, offs=4) -- 2297(line=92, offs=6)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1993(line=79, offs=4) -- 2374(line=94, offs=6)
 */
 ATSINSflab(__patsflab_little_omega_54):
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1956(line=78, offs=3) -- 2297(line=92, offs=6)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2033(line=80, offs=3) -- 2374(line=94, offs=6)
 */
 /*
 letpush(beg)
@@ -3007,12 +3007,12 @@
 */
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2281(line=91, offs=5) -- 2291(line=91, offs=15)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2358(line=93, offs=5) -- 2368(line=93, offs=15)
 */
 ATSINSmove(tmpret102, loop_55(arg0, ATSPMVi0nt(1))) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1956(line=78, offs=3) -- 2297(line=92, offs=6)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2033(line=80, offs=3) -- 2374(line=94, offs=6)
 */
 /*
 INSletpop()
@@ -3022,7 +3022,7 @@
 } /* end of [little_omega_54] */
 
 /*
-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1968(line=79, offs=9) -- 2271(line=89, offs=27)
+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2045(line=81, offs=9) -- 2348(line=91, offs=27)
 */
 /*
 local: is_prime_16$0(level=0), loop_55$0(level=1)
@@ -3049,98 +3049,98 @@
 /* tmpvardeclst(end) */
 ATSfunbody_beg()
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 1968(line=79, offs=9) -- 2271(line=89, offs=27)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2045(line=81, offs=9) -- 2348(line=91, offs=27)
 */
 ATSINSflab(__patsflab_loop_55):
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2066(line=80, offs=10) -- 2074(line=80, offs=18)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2143(line=82, offs=10) -- 2151(line=82, offs=18)
 */
 ATSINSmove(tmp104, ATSLIB_056_prelude__gte_g1int_int__35__4(arg1, arg0)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2063(line=80, offs=7) -- 2271(line=89, offs=27)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2140(line=82, offs=7) -- 2348(line=91, offs=27)
 */
 ATSif(
 tmp104
 ) ATSthen() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2091(line=81, offs=12) -- 2101(line=81, offs=22)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2168(line=83, offs=12) -- 2178(line=83, offs=22)
 */
 ATSINSmove(tmp107, is_prime_16(arg0)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2088(line=81, offs=9) -- 2144(line=84, offs=12)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2165(line=83, offs=9) -- 2221(line=86, offs=12)
 */
 ATSif(
 tmp107
 ) ATSthen() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2118(line=82, offs=11) -- 2119(line=82, offs=12)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2195(line=84, offs=11) -- 2196(line=84, offs=12)
 */
 ATSINSmove(tmpret103, ATSPMVi0nt(1)) ;
 } ATSelse() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2143(line=84, offs=11) -- 2144(line=84, offs=12)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2220(line=86, offs=11) -- 2221(line=86, offs=12)
 */
 ATSINSmove(tmpret103, ATSPMVi0nt(0)) ;
 } /* ATSendif */
 } ATSelse() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2167(line=86, offs=12) -- 2194(line=86, offs=39)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2244(line=88, offs=12) -- 2271(line=88, offs=39)
 */
 ATSINSmove(tmp112, atspre_g0int_mod_int(arg0, arg1)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2167(line=86, offs=12) -- 2194(line=86, offs=39)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2244(line=88, offs=12) -- 2271(line=88, offs=39)
 */
 ATSINSmove(tmp109, ATSLIB_056_prelude__eq_g0int_int__7__9(tmp112, ATSPMVi0nt(0))) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2167(line=86, offs=12) -- 2194(line=86, offs=39)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2244(line=88, offs=12) -- 2271(line=88, offs=39)
 */
 ATSif(
 tmp109
 ) ATSthen() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2167(line=86, offs=12) -- 2194(line=86, offs=39)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2244(line=88, offs=12) -- 2271(line=88, offs=39)
 */
 ATSINSmove(tmp108, is_prime_16(arg1)) ;
 
 } ATSelse() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2167(line=86, offs=12) -- 2194(line=86, offs=39)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2244(line=88, offs=12) -- 2271(line=88, offs=39)
 */
 ATSINSmove(tmp108, ATSPMVbool_false()) ;
 } /* ATSendif */
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2164(line=86, offs=9) -- 2271(line=89, offs=27)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2241(line=88, offs=9) -- 2348(line=91, offs=27)
 */
 ATSif(
 tmp108
 ) ATSthen() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2223(line=87, offs=23) -- 2230(line=87, offs=30)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2300(line=89, offs=23) -- 2307(line=89, offs=30)
 */
 ATSINSmove(tmp114, atspre_g1int_add_int(arg1, ATSPMVi0nt(1))) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2215(line=87, offs=15) -- 2231(line=87, offs=31)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2292(line=89, offs=15) -- 2308(line=89, offs=31)
 */
 ATSINSmove(tmp113, loop_55(arg0, tmp114)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2211(line=87, offs=11) -- 2231(line=87, offs=31)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2288(line=89, offs=11) -- 2308(line=89, offs=31)
 */
 ATSINSmove(tmpret103, atspre_g0int_add_int(ATSPMVi0nt(1), tmp113)) ;
 
 } ATSelse() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2263(line=89, offs=19) -- 2270(line=89, offs=26)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2340(line=91, offs=19) -- 2347(line=91, offs=26)
 */
 ATSINSmove(tmp115, atspre_g1int_add_int(arg1, ATSPMVi0nt(1))) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2255(line=89, offs=11) -- 2271(line=89, offs=27)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2332(line=91, offs=11) -- 2348(line=91, offs=27)
 */
 ATStailcal_beg()
 ATSINSmove_tlcal(apy0, arg0) ;
@@ -3239,7 +3239,7 @@
 } /* end of [ATSLIB_056_prelude__eq_g0int_int__7__9] */
 
 /*
-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2331(line=95, offs=4) -- 2879(line=115, offs=10)
+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2408(line=97, offs=4) -- 2956(line=117, offs=10)
 */
 /*
 local: is_prime_16$0(level=0)
@@ -3256,11 +3256,11 @@
 /* tmpvardeclst(end) */
 ATSfunbody_beg()
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2331(line=95, offs=4) -- 2879(line=115, offs=10)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2408(line=97, offs=4) -- 2956(line=117, offs=10)
 */
 ATSINSflab(__patsflab_totient_58):
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2364(line=96, offs=3) -- 2879(line=115, offs=10)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2441(line=98, offs=3) -- 2956(line=117, offs=10)
 */
 ATScaseof_beg()
 /*
@@ -3268,15 +3268,15 @@
 */
 ATSbranch_beg()
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2381(line=97, offs=7) -- 2382(line=97, offs=8)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2458(line=99, offs=7) -- 2459(line=99, offs=8)
 */
 ATSINSlab(__atstmplab6):
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2339(line=95, offs=12) -- 2340(line=95, offs=13)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2416(line=97, offs=12) -- 2417(line=97, offs=13)
 */
 ATSifnthen(ATSCKpat_int(arg0, ATSPMVint(1))) { ATSINSgoto(__atstmplab8) ; } ;
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2382(line=97, offs=8) -- 2382(line=97, offs=8)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2459(line=99, offs=8) -- 2459(line=99, offs=8)
 */
 ATSINSlab(__atstmplab7):
 /*
@@ -3286,14 +3286,14 @@
 ibranch-mbody:
 */
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2386(line=97, offs=12) -- 2387(line=97, offs=13)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2463(line=99, offs=12) -- 2464(line=99, offs=13)
 */
 ATSINSmove(tmpret116, ATSPMVi0nt(1)) ;
 ATSbranch_end()
 
 ATSbranch_beg()
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2395(line=98, offs=8) -- 2395(line=98, offs=8)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2472(line=100, offs=8) -- 2472(line=100, offs=8)
 */
 ATSINSlab(__atstmplab8):
 /*
@@ -3303,7 +3303,7 @@
 ibranch-mbody:
 */
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2421(line=100, offs=9) -- 2869(line=114, offs=12)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2498(line=102, offs=9) -- 2946(line=116, offs=12)
 */
 /*
 letpush(beg)
@@ -3313,12 +3313,12 @@
 */
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2847(line=113, offs=11) -- 2857(line=113, offs=21)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2924(line=115, offs=11) -- 2934(line=115, offs=21)
 */
 ATSINSmove(tmpret116, loop_59(ATSPMVi0nt(1), arg0)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2421(line=100, offs=9) -- 2869(line=114, offs=12)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2498(line=102, offs=9) -- 2946(line=116, offs=12)
 */
 /*
 INSletpop()
@@ -3335,7 +3335,7 @@
 } /* end of [totient_58] */
 
 /*
-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2439(line=101, offs=15) -- 2825(line=111, offs=31)
+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2516(line=103, offs=15) -- 2902(line=113, offs=31)
 */
 /*
 local: is_prime_16$0(level=0), loop_59$0(level=1)
@@ -3368,126 +3368,126 @@
 */
 ATSfunbody_beg()
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2439(line=101, offs=15) -- 2825(line=111, offs=31)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2516(line=103, offs=15) -- 2902(line=113, offs=31)
 */
 ATSINSflab(__patsflab_loop_59):
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2550(line=102, offs=16) -- 2556(line=102, offs=22)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2627(line=104, offs=16) -- 2633(line=104, offs=22)
 */
 ATSINSmove(tmp118, ATSLIB_056_prelude__gte_g1int_int__35__5(arg0, arg1)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2547(line=102, offs=13) -- 2825(line=111, offs=31)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2624(line=104, offs=13) -- 2902(line=113, offs=31)
 */
 ATSif(
 tmp118
 ) ATSthen() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2579(line=103, offs=18) -- 2589(line=103, offs=28)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2656(line=105, offs=18) -- 2666(line=105, offs=28)
 */
 ATSINSmove(tmp121, is_prime_16(arg1)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2576(line=103, offs=15) -- 2654(line=106, offs=18)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2653(line=105, offs=15) -- 2731(line=108, offs=18)
 */
 ATSif(
 tmp121
 ) ATSthen() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2612(line=104, offs=17) -- 2617(line=104, offs=22)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2689(line=106, offs=17) -- 2694(line=106, offs=22)
 */
 ATSINSmove(tmpret117, atspre_g1int_sub_int(arg1, ATSPMVi0nt(1))) ;
 
 } ATSelse() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2653(line=106, offs=17) -- 2654(line=106, offs=18)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2730(line=108, offs=17) -- 2731(line=108, offs=18)
 */
 ATSINSmove(tmpret117, arg1) ;
 } /* ATSendif */
 } ATSelse() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2689(line=108, offs=18) -- 2723(line=108, offs=52)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2766(line=110, offs=18) -- 2800(line=110, offs=52)
 */
 ATSINSmove(tmp127, atspre_g0int_mod_int(arg1, arg0)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2689(line=108, offs=18) -- 2723(line=108, offs=52)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2766(line=110, offs=18) -- 2800(line=110, offs=52)
 */
 ATSINSmove(tmp124, ATSLIB_056_prelude__eq_g0int_int__7__10(tmp127, ATSPMVi0nt(0))) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2689(line=108, offs=18) -- 2723(line=108, offs=52)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2766(line=110, offs=18) -- 2800(line=110, offs=52)
 */
 ATSif(
 tmp124
 ) ATSthen() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2689(line=108, offs=18) -- 2723(line=108, offs=52)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2766(line=110, offs=18) -- 2800(line=110, offs=52)
 */
 ATSINSmove(tmp123, is_prime_16(arg0)) ;
 
 } ATSelse() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2689(line=108, offs=18) -- 2723(line=108, offs=52)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2766(line=110, offs=18) -- 2800(line=110, offs=52)
 */
 ATSINSmove(tmp123, ATSPMVbool_false()) ;
 } /* ATSendif */
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2689(line=108, offs=18) -- 2723(line=108, offs=52)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2766(line=110, offs=18) -- 2800(line=110, offs=52)
 */
 ATSif(
 tmp123
 ) ATSthen() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2689(line=108, offs=18) -- 2723(line=108, offs=52)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2766(line=110, offs=18) -- 2800(line=110, offs=52)
 */
 ATSINSmove(tmp122, ATSLIB_056_prelude__neq_g1int_int__63__1(arg0, arg1)) ;
 
 } ATSelse() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2689(line=108, offs=18) -- 2723(line=108, offs=52)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2766(line=110, offs=18) -- 2800(line=110, offs=52)
 */
 ATSINSmove(tmp122, ATSPMVbool_false()) ;
 } /* ATSendif */
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2686(line=108, offs=15) -- 2825(line=111, offs=31)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2763(line=110, offs=15) -- 2902(line=113, offs=31)
 */
 ATSif(
 tmp122
 ) ATSthen() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2751(line=109, offs=23) -- 2756(line=109, offs=28)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2828(line=111, offs=23) -- 2833(line=111, offs=28)
 */
 ATSINSmove(tmp134, atspre_g1int_add_int(arg0, ATSPMVi0nt(1))) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2746(line=109, offs=18) -- 2760(line=109, offs=32)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2823(line=111, offs=18) -- 2837(line=111, offs=32)
 */
 ATSINSmove(tmp133, loop_59(tmp134, arg1)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2746(line=109, offs=18) -- 2764(line=109, offs=36)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2823(line=111, offs=18) -- 2841(line=111, offs=36)
 */
 ATSINSmove(tmp132, atspre_g0int_div_int(tmp133, arg0)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2769(line=109, offs=41) -- 2774(line=109, offs=46)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2846(line=111, offs=41) -- 2851(line=111, offs=46)
 */
 ATSINSmove(tmp135, atspre_g1int_sub_int(arg0, ATSPMVi0nt(1))) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2745(line=109, offs=17) -- 2775(line=109, offs=47)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2822(line=111, offs=17) -- 2852(line=111, offs=47)
 */
 ATSINSmove(tmpret117, atspre_g0int_mul_int(tmp132, tmp135)) ;
 
 } ATSelse() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2816(line=111, offs=22) -- 2821(line=111, offs=27)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2893(line=113, offs=22) -- 2898(line=113, offs=27)
 */
 ATSINSmove(tmp136, atspre_g1int_add_int(arg0, ATSPMVi0nt(1))) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2811(line=111, offs=17) -- 2825(line=111, offs=31)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2888(line=113, offs=17) -- 2902(line=113, offs=31)
 */
 ATStailcal_beg()
 ATSINSmove_tlcal(apy0, tmp136) ;
@@ -3673,7 +3673,7 @@
 } /* end of [ATSLIB_056_prelude__neq_g1int_int__63__1] */
 
 /*
-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2932(line=118, offs=5) -- 3320(line=132, offs=6)
+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3009(line=120, offs=5) -- 3397(line=134, offs=6)
 */
 /*
 local: witness_12$0(level=0), totient_58$0(level=0)
@@ -3690,11 +3690,11 @@
 /* tmpvardeclst(end) */
 ATSfunbody_beg()
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2932(line=118, offs=5) -- 3320(line=132, offs=6)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3009(line=120, offs=5) -- 3397(line=134, offs=6)
 */
 ATSINSflab(__patsflab_totient_sum_66):
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2972(line=119, offs=3) -- 3320(line=132, offs=6)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3049(line=121, offs=3) -- 3397(line=134, offs=6)
 */
 /*
 letpush(beg)
@@ -3704,12 +3704,12 @@
 */
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3304(line=131, offs=5) -- 3314(line=131, offs=15)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3381(line=133, offs=5) -- 3391(line=133, offs=15)
 */
 ATSINSmove(tmpret137, loop_67(ATSPMVi0nt(1), arg0)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2972(line=119, offs=3) -- 3320(line=132, offs=6)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3049(line=121, offs=3) -- 3397(line=134, offs=6)
 */
 /*
 INSletpop()
@@ -3719,7 +3719,7 @@
 } /* end of [totient_sum_66] */
 
 /*
-/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2984(line=120, offs=9) -- 3294(line=129, offs=40)
+/home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3061(line=122, offs=9) -- 3371(line=131, offs=40)
 */
 /*
 local: witness_12$0(level=0), totient_58$0(level=0), loop_67$0(level=1)
@@ -3748,33 +3748,33 @@
 */
 ATSfunbody_beg()
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 2984(line=120, offs=9) -- 3294(line=129, offs=40)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3061(line=122, offs=9) -- 3371(line=131, offs=40)
 */
 ATSINSflab(__patsflab_loop_67):
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3087(line=121, offs=10) -- 3096(line=121, offs=19)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3164(line=123, offs=10) -- 3173(line=123, offs=19)
 */
 ATSINSmove(tmp139, ATSLIB_056_prelude__lt_g1int_int__18__2(arg0, arg1)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3084(line=121, offs=7) -- 3294(line=129, offs=40)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3161(line=123, offs=7) -- 3371(line=131, offs=40)
 */
 ATSif(
 tmp139
 ) ATSthen() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3110(line=122, offs=9) -- 3243(line=127, offs=12)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3187(line=124, offs=9) -- 3320(line=129, offs=12)
 */
 /*
 letpush(beg)
 */
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3137(line=123, offs=24) -- 3142(line=123, offs=29)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3214(line=125, offs=24) -- 3219(line=125, offs=29)
 */
 ATSINSmove(tmp143, atspre_g1int_add_int(arg0, ATSPMVi0nt(1))) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3132(line=123, offs=19) -- 3150(line=123, offs=37)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3209(line=125, offs=19) -- 3227(line=125, offs=37)
 */
 ATSINSmove(tmp142, loop_67(tmp143, arg1)) ;
 
@@ -3783,39 +3783,39 @@
 */
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3196(line=124, offs=46) -- 3205(line=124, offs=55)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3273(line=126, offs=46) -- 3282(line=126, offs=55)
 */
 ATSINSmove(tmp149, totient_58(arg0)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3188(line=124, offs=38) -- 3207(line=124, offs=57)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3265(line=126, offs=38) -- 3284(line=126, offs=57)
 */
 ATSINSmove(tmp148, witness_12(tmp149)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3169(line=124, offs=19) -- 3208(line=124, offs=58)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3246(line=126, offs=19) -- 3285(line=126, offs=58)
 */
 ATSINSmove(tmpret138, ATSCNTRB_056_HX_056_intinf_vt__add_intinf0_int__69__1(tmp142, tmp148)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3110(line=122, offs=9) -- 3243(line=127, offs=12)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3187(line=124, offs=9) -- 3320(line=129, offs=12)
 */
 /*
 INSletpop()
 */
 } ATSelse() {
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3263(line=129, offs=9) -- 3294(line=129, offs=40)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3340(line=131, offs=9) -- 3371(line=131, offs=40)
 */
 ATSINSmove(tmp159, totient_58(arg0)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3263(line=129, offs=9) -- 3294(line=129, offs=40)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3340(line=131, offs=9) -- 3371(line=131, offs=40)
 */
 ATSINSmove(tmp158, witness_12(tmp159)) ;
 
 /*
-emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3263(line=129, offs=9) -- 3294(line=129, offs=40)
+emit_instr: loc0 = /home/vanessa/programming/haskell/done/fast-arithmetic/ats-src/number-theory.dats: 3340(line=131, offs=9) -- 3371(line=131, offs=40)
 */
 ATSINSmove(tmpret138, ATSCNTRB_056_HX_056_intinf_vt__intinf_make_int__71__1(tmp158)) ;
 
diff --git a/cbits/numerics.c b/cbits/numerics.c
--- a/cbits/numerics.c
+++ b/cbits/numerics.c
@@ -1,7 +1,7 @@
 /*
 **
 ** The C code is generated by [ATS/Postiats-0-3-8]
-** The starting compilation time is: 2018-1-6: 19h:39m
+** The starting compilation time is: 2018-1-7: 19h:36m
 **
 */
 
diff --git a/fast-arithmetic.cabal b/fast-arithmetic.cabal
--- a/fast-arithmetic.cabal
+++ b/fast-arithmetic.cabal
@@ -1,7 +1,8 @@
 name:                fast-arithmetic
-version:             0.1.1.2
-synopsis:            Fast number-theoretic functions.
-description:         Fast number-theoretic code with a high level of safety guaranteed by ATS.
+version:             0.1.1.3
+synopsis:            Fast functions on integers.
+description:         Fast functions for number theory and combinatorics with a high level of safety guaranteed by [ATS](http://www.ats-lang.org/). This package also provides a
+                     'Storable' instance for GMP's @mpz@ type.
 homepage:            https://github.com/vmchale/fast-arithmetic#readme
 license:             BSD3
 license-file:        LICENSE
@@ -68,6 +69,7 @@
   build-depends:       base
                      , fast-arithmetic
                      , hspec
+                     , QuickCheck
   if flag(development)
     ghc-options: -Werror
   if impl(ghc >= 8.0)
diff --git a/shake.hs b/shake.hs
--- a/shake.hs
+++ b/shake.hs
@@ -25,8 +25,11 @@
          ]
 
     "ci" ~> do
-        need ["cbits/number-theory.c", "cbits/numerics.c"]
+        need ["cbits/number-theory.c", "cbits/numerics.c", "cbits/combinatorics.c"]
         cmd_ ["cabal", "new-build"]
+        cmd_ ["cabal", "new-build", "-w", "ghc-8.0.2"]
+        cmd_ ["cabal", "new-build", "-w", "ghc-7.10.3"]
+        cmd_ ["cabal", "new-build", "-w", "ghc-7.8.4"]
         cmd_ ["cabal", "new-test"]
         cmd_ ["cabal", "new-haddock"]
         cmd_ ["hlint", "bench", "src", "test/", "Setup.hs"]
diff --git a/src/Data/GMP.hs b/src/Data/GMP.hs
--- a/src/Data/GMP.hs
+++ b/src/Data/GMP.hs
@@ -1,7 +1,14 @@
 {-# LANGUAGE CPP #-}
 
--- | This module defines a storable instance for GMP's integer type.
+{-|
+Module      : Data.GMP
+Copyright   : Copyright (c) 2017 Vanessa McHale
 
+This module defines a storable instance for GMP's @mpz@ integer type.
+-}
+
+
+
 module Data.GMP ( GMPInt (..)
                 , gmpToInteger
                 ) where
@@ -17,7 +24,11 @@
 
 -- | The GMP integer type holds information about array size as well as
 -- a pointer to an array.
-data GMPInt = GMPInt { _mp_alloc :: Word32, _mp_size :: Word32, _mp_d :: Ptr Word64 }
+data GMPInt = GMPInt {
+                       _mp_alloc :: Word32 -- ^ Number of limbs allocated.
+                     , _mp_size  :: Word32 -- ^ Number of limbs used.
+                     , _mp_d     :: Ptr Word64 -- ^ Pointer to an array containing the limbs.
+                     }
 
 wordWidth :: Int
 wordWidth = sizeOf (undefined :: Word32)
@@ -33,7 +44,7 @@
     a Nil         = 0
     a (Cons x xs) = fromIntegral x + (2 ^ (64 :: Integer)) * xs
 
--- | Convert a GMPInt to Haskell's 'Integer' type.
+-- | Convert a GMP @mpz@ to Haskell's 'Integer' type.
 gmpToInteger :: GMPInt -> IO Integer
 gmpToInteger = fmap wordListToInteger . gmpToList
 
diff --git a/src/Numeric/Combinatorics.hs b/src/Numeric/Combinatorics.hs
--- a/src/Numeric/Combinatorics.hs
+++ b/src/Numeric/Combinatorics.hs
@@ -1,5 +1,11 @@
--- | This provides a few facilities for working with common combinatorial
--- functions.
+{-|
+Module      : Numeric.Combinatorics
+Copyright   : Copyright (c) 2017 Vanessa McHale
+
+This provides a few facilities for working with common combinatorial
+functions.
+-}
+
 module Numeric.Combinatorics ( factorial
                              , choose
                              ) where
diff --git a/src/Numeric/Common.hs b/src/Numeric/Common.hs
--- a/src/Numeric/Common.hs
+++ b/src/Numeric/Common.hs
@@ -1,11 +1,18 @@
 {-# LANGUAGE CPP #-}
 
-module Numeric.Common ( convertBool
-                      , conjugate
+module Numeric.Common ( conjugate
+                      , asTest
                       ) where
 
 import           Data.Word
 import           Foreign.C
+
+#if __GLASGOW_HASKELL__ >= 820
+asTest :: Integral a => (CInt -> CBool) -> a -> Bool
+#else
+asTest :: Integral a => (CInt -> CUChar) -> a -> Bool
+#endif
+asTest f = convertBool . f . fromIntegral
 
 conjugate :: (Integral a, Integral b) => (CInt -> CInt) -> a -> b
 conjugate f = fromIntegral . f . fromIntegral
diff --git a/src/Numeric/Integer.hs b/src/Numeric/Integer.hs
--- a/src/Numeric/Integer.hs
+++ b/src/Numeric/Integer.hs
@@ -2,9 +2,9 @@
 
 {-|
 Module      : Numeric.Combinatorics
-Description : Fast computation of common functions on integers.
 Copyright   : Copyright (c) 2017 Vanessa McHale
 
+This module provides a fast primality check.
 -}
 
 module Numeric.Integer ( isPrime
@@ -21,4 +21,4 @@
 
 -- | O(√n)
 isPrime :: Int -> Bool
-isPrime = convertBool . is_prime_ats . fromIntegral
+isPrime = asTest is_prime_ats
diff --git a/src/Numeric/NumberTheory.hs b/src/Numeric/NumberTheory.hs
--- a/src/Numeric/NumberTheory.hs
+++ b/src/Numeric/NumberTheory.hs
@@ -2,9 +2,9 @@
 
 {-|
 Module      : Numeric.NumberTheory
-Description : Fast computation of number theoretic functions
 Copyright   : Copyright (c) 2017 Vanessa McHale
 
+This module provides fast number theoretic functions when possible.
 -}
 
 module Numeric.NumberTheory ( totient
@@ -27,7 +27,7 @@
 
 -- | See [here](http://mathworld.wolfram.com/PerfectNumber.html)
 isPerfect :: Int -> Bool
-isPerfect = convertBool . is_perfect_ats . fromIntegral
+isPerfect = asTest is_perfect_ats
 
 -- Number of distinct prime factors
 littleOmega :: Int -> Int
diff --git a/src/Numeric/Pure.hs b/src/Numeric/Pure.hs
--- a/src/Numeric/Pure.hs
+++ b/src/Numeric/Pure.hs
@@ -1,4 +1,5 @@
 {-# LANGUAGE CPP #-}
+
 -- | Pure Haskell functions for testing and benchmarking. Specialized for
 -- 'Int's.
 module Numeric.Pure ( hsIsPrime
diff --git a/test/Spec.hs b/test/Spec.hs
--- a/test/Spec.hs
+++ b/test/Spec.hs
@@ -1,10 +1,11 @@
-import           Data.List             (zipWith4)
+import           Data.List                 (zipWith4)
 import           Numeric.Combinatorics
 import           Numeric.Integer
 import           Numeric.NumberTheory
 import           Numeric.Pure
 import           Test.Hspec
 import           Test.Hspec.QuickCheck
+import           Test.QuickCheck.Arbitrary
 
 tooBig :: Int -> Int -> Bool
 tooBig x y = go x y >= 2 ^ (16 :: Integer)
@@ -12,7 +13,7 @@
         go :: Int -> Int -> Integer
         go m n = fromIntegral m ^ (fromIntegral n :: Integer)
 
-agree :: (Eq a) => String -> (Int -> a) -> (Int -> a) -> SpecWith ()
+agree :: (Eq a, Show b, Integral b, Arbitrary b) => String -> (b -> a) -> (b -> a) -> SpecWith ()
 agree s f g = describe s $
     prop "should agree with the pure Haskell function" $
         \n -> n < 1 || f n == g n
