math/mp-nthrt.c: Implement nth-root, and perfect-power detection.
[catacomb] / math / t / mp
index b50ea8d..8d0942d 100644 (file)
--- a/math/t/mp
+++ b/math/t/mp
@@ -115,6 +115,39 @@ sqrt {
 14565040310136678240 3816417208;
 }
 
+nthrt {
+  0 27 0 1;
+  1 1 1 1;
+  99 2 9 0;
+  100 2 10 1;
+  101 2 10 0;
+
+  2432442434617858985744608211960343276041892998697958012044143077567778256072696563501333460622383626492631158845093813667916645390906408185968436731121086804986194010729874783817632607960227495980162127756247771205609001938726 37 1234566 0;
+  2432442434617858985744608211960343276041892998697958012044143077567778256072696563501333460622383626492631158845093813667916645390906408185968436731121086804986194010729874783817632607960227495980162127756247771205609001938727 37 1234567 1;
+  2432442434617858985744608211960343276041892998697958012044143077567778256072696563501333460622383626492631158845093813667916645390906408185968436731121086804986194010729874783817632607960227495980162127756247771205609001938728 37 1234567 0;
+
+  -26 3 -3 0;
+  -27 3 -3 1;
+  -28 3 -4 0;
+}
+
+perfect-power-p {
+  0 0 0 1;
+  1 0 1 1;
+  -1 0 -1 1;
+
+  -4 0 -4 1;
+  -8 1 -2 3;
+  -64 1 -4 3;
+
+  80 0 80 1;
+  81 1 3 4;
+  82 0 82 1;
+
+  2432442434617858985744608211960343276041892998697958012044143077567778256072696563501333460622383626492631158845093813667916645390906408185968436731121086804986194010729874783817632607960227495980162127756247771205609001938727 1 1234567 37;
+  42467986438630307821661186973460619303572935864570185492440237295438188325895624954701633272891586038903309915601221633039963682793644006385615600911359153716020597273608200491915551536581527267184634993651215467730190125236224 1 12 210;
+}
+
 gcd {
   # --- Simple tests ---