[BACK]Return to gfs.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / engine

Diff for /OpenXM_contrib2/asir2000/engine/gfs.c between version 1.5 and 1.17

version 1.5, 2001/05/28 08:22:01 version 1.17, 2003/05/07 06:26:49
Line 45 
Line 45 
  * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,   * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
  * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.   * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.
  *   *
  * $OpenXM: OpenXM_contrib2/asir2000/engine/gfs.c,v 1.4 2001/03/29 09:49:58 noro Exp $   * $OpenXM: OpenXM_contrib2/asir2000/engine/gfs.c,v 1.16 2003/01/16 00:33:28 noro Exp $
 */  */
 #include "ca.h"  #include "ca.h"
   #include "inline.h"
   
 /* q = p^n */  /* q = p^n */
   
Line 59  int *current_gfs_plus1;
Line 60  int *current_gfs_plus1;
 int *current_gfs_ntoi;  int *current_gfs_ntoi;
 int *current_gfs_iton;  int *current_gfs_iton;
   
 void chsgngfs();  struct prim_root_info {
 void generate_defpoly_um();          int p;
           int extdeg;
           int defpoly;
           int prim_root;
   };
   
 void dec_um(p,a,u)  /* if p >= SF_THRESHOLD, usual representation is used */
 int p,a;  
 UM u;  #define SF_THRESHOLD 16384
   
   struct prim_root_info prim_root_info_tab[] = {
   {2,1,0,0}, {2,2,7,2}, {2,3,11,2}, {2,4,19,2}, {2,5,37,2}, {2,6,67,2},
   {2,7,131,2}, {2,8,283,3}, {2,9,515,7}, {2,10,1033,2}, {2,11,2053,2},
   {2,12,4105,3}, {2,13,8219,2}, {2,14,16417,7}, {2,15,32771,2}, {3,1,0,2},
   {3,2,10,4}, {3,3,34,3}, {3,4,86,3}, {3,5,250,3}, {3,6,734,3}, {3,7,2198,5},
   {3,8,6572,38}, {3,9,19747,3}, {3,10,59068,34}, {5,1,0,2}, {5,2,27,6},
   {5,3,131,9}, {5,4,627,6}, {5,5,3146,10}, {5,6,15632,5}, {7,1,0,3},
   {7,2,50,9}, {7,3,345,22}, {7,4,2409,12}, {7,5,16817,9}, {11,1,0,2},
   {11,2,122,15}, {11,3,1346,11}, {11,4,14654,11}, {13,1,0,2}, {13,2,171,15},
   {13,3,2199,15}, {13,4,28563,17}, {17,1,0,3}, {17,2,292,19}, {17,3,4933,17},
   {19,1,0,2}, {19,2,362,22}, {19,3,6861,29}, {23,1,0,5}, {23,2,530,25},
   {23,3,12193,23}, {29,1,0,2}, {29,2,843,30}, {29,3,24422,30}, {31,1,0,3},
   {31,2,962,35}, {31,3,29794,34}, {37,1,0,2}, {37,2,1371,41}, {37,3,50655,75},
   {41,1,0,6}, {41,2,1684,43}, {43,1,0,3}, {43,2,1850,45}, {47,1,0,5},
   {47,2,2210,49}, {53,1,0,2}, {53,2,2811,54}, {59,1,0,2}, {59,2,3482,62},
   {61,1,0,2}, {61,2,3723,63}, {67,1,0,2}, {67,2,4490,74}, {71,1,0,7},
   {71,2,5042,79}, {73,1,0,5}, {73,2,5334,76}, {79,1,0,3}, {79,2,6242,85},
   {83,1,0,2}, {83,2,6890,93}, {89,1,0,3}, {89,2,7924,91}, {97,1,0,5},
   {97,2,9414,101}, {101,1,0,2}, {101,2,10203,102},
   {103,1,0,5}, {103,2,10610,105}, {107,1,0,2}, {107,2,11450,109},
   {109,1,0,6}, {109,2,11883,111}, {113,1,0,3}, {113,2,12772,117},
   {127,1,0,3}, {127,2,16130,135}, {131,1,0,2}, {131,2,17162,134},
   {137,1,0,3}, {137,2,18772,145}, {139,1,0,2}, {139,2,19322,143},
   {149,1,0,2}, {149,2,22203,152}, {151,1,0,6}, {151,2,22802,160},
   {157,1,0,5}, {157,2,24651,159}, {163,1,0,2}, {163,2,26570,170},
   {167,1,0,5}, {167,2,27890,169}, {173,1,0,2}, {173,2,29931,174},
   {179,1,0,2}, {179,2,32042,182}, {181,1,0,2}, {181,2,32763,185},
   {191,1,0,19}, {191,2,36482,201}, {193,1,0,5}, {193,2,37254,198},
   {197,1,0,2}, {197,2,38811,200}, {199,1,0,3}, {199,2,39602,212},
   {211,1,0,2}, {211,2,44522,215}, {223,1,0,3}, {223,2,49730,225},
   {227,1,0,2}, {227,2,51530,229}, {229,1,0,6}, {229,2,52443,231},
   {233,1,0,3}, {233,2,54292,241}, {239,1,0,7}, {239,2,57122,247},
   {241,1,0,7}, {241,2,58088,248}, {251,1,0,6}, {251,2,63002,256},
   {257,1,0,3}, {263,1,0,5}, {269,1,0,2}, {271,1,0,6}, {277,1,0,5}, {281,1,0,3},
   {283,1,0,3}, {293,1,0,2}, {307,1,0,5}, {311,1,0,17}, {313,1,0,10},
   {317,1,0,2}, {331,1,0,3}, {337,1,0,10}, {347,1,0,2}, {349,1,0,2},
   {353,1,0,3}, {359,1,0,7}, {367,1,0,6}, {373,1,0,2}, {379,1,0,2},
   {383,1,0,5}, {389,1,0,2}, {397,1,0,5}, {401,1,0,3}, {409,1,0,21},
   {419,1,0,2}, {421,1,0,2}, {431,1,0,7}, {433,1,0,5}, {439,1,0,15},
   {443,1,0,2}, {449,1,0,3}, {457,1,0,13}, {461,1,0,2}, {463,1,0,3},
   {467,1,0,2}, {479,1,0,13}, {487,1,0,3}, {491,1,0,2}, {499,1,0,7},
   {503,1,0,5}, {509,1,0,2}, {521,1,0,3}, {523,1,0,2}, {541,1,0,2},
   {547,1,0,2}, {557,1,0,2}, {563,1,0,2}, {569,1,0,3}, {571,1,0,3},
   {577,1,0,5}, {587,1,0,2}, {593,1,0,3}, {599,1,0,7}, {601,1,0,7},
   {607,1,0,3}, {613,1,0,2}, {617,1,0,3}, {619,1,0,2}, {631,1,0,3},
   {641,1,0,3}, {643,1,0,11}, {647,1,0,5}, {653,1,0,2}, {659,1,0,2},
   {661,1,0,2}, {673,1,0,5}, {677,1,0,2}, {683,1,0,5}, {691,1,0,3},
   {701,1,0,2}, {709,1,0,2}, {719,1,0,11}, {727,1,0,5}, {733,1,0,6},
   {739,1,0,3}, {743,1,0,5}, {751,1,0,3}, {757,1,0,2}, {761,1,0,6},
   {769,1,0,11}, {773,1,0,2}, {787,1,0,2}, {797,1,0,2}, {809,1,0,3},
   {811,1,0,3}, {821,1,0,2}, {823,1,0,3}, {827,1,0,2}, {829,1,0,2},
   {839,1,0,11}, {853,1,0,2}, {857,1,0,3}, {859,1,0,2}, {863,1,0,5},
   {877,1,0,2}, {881,1,0,3}, {883,1,0,2}, {887,1,0,5}, {907,1,0,2},
   {911,1,0,17}, {919,1,0,7}, {929,1,0,3}, {937,1,0,5}, {941,1,0,2},
   {947,1,0,2}, {953,1,0,3}, {967,1,0,5}, {971,1,0,6}, {977,1,0,3},
   {983,1,0,5}, {991,1,0,6}, {997,1,0,7}, {1009,1,0,11}, {1013,1,0,3},
   {1019,1,0,2}, {1021,1,0,10}, {1031,1,0,14}, {1033,1,0,5}, {1039,1,0,3},
   {1049,1,0,3}, {1051,1,0,7}, {1061,1,0,2}, {1063,1,0,3}, {1069,1,0,6},
   {1087,1,0,3}, {1091,1,0,2}, {1093,1,0,5}, {1097,1,0,3}, {1103,1,0,5},
   {1109,1,0,2}, {1117,1,0,2}, {1123,1,0,2}, {1129,1,0,11}, {1151,1,0,17},
   {1153,1,0,5}, {1163,1,0,5}, {1171,1,0,2}, {1181,1,0,7}, {1187,1,0,2},
   {1193,1,0,3}, {1201,1,0,11}, {1213,1,0,2}, {1217,1,0,3}, {1223,1,0,5},
   {1229,1,0,2}, {1231,1,0,3}, {1237,1,0,2}, {1249,1,0,7}, {1259,1,0,2},
   {1277,1,0,2}, {1279,1,0,3}, {1283,1,0,2}, {1289,1,0,6}, {1291,1,0,2},
   {1297,1,0,10}, {1301,1,0,2}, {1303,1,0,6}, {1307,1,0,2}, {1319,1,0,13},
   {1321,1,0,13}, {1327,1,0,3}, {1361,1,0,3}, {1367,1,0,5}, {1373,1,0,2},
   {1381,1,0,2}, {1399,1,0,13}, {1409,1,0,3}, {1423,1,0,3}, {1427,1,0,2},
   {1429,1,0,6}, {1433,1,0,3}, {1439,1,0,7}, {1447,1,0,3}, {1451,1,0,2},
   {1453,1,0,2}, {1459,1,0,3}, {1471,1,0,6}, {1481,1,0,3}, {1483,1,0,2},
   {1487,1,0,5}, {1489,1,0,14}, {1493,1,0,2}, {1499,1,0,2}, {1511,1,0,11},
   {1523,1,0,2}, {1531,1,0,2}, {1543,1,0,5}, {1549,1,0,2}, {1553,1,0,3},
   {1559,1,0,19}, {1567,1,0,3}, {1571,1,0,2}, {1579,1,0,3}, {1583,1,0,5},
   {1597,1,0,11}, {1601,1,0,3}, {1607,1,0,5}, {1609,1,0,7}, {1613,1,0,3},
   {1619,1,0,2}, {1621,1,0,2}, {1627,1,0,3}, {1637,1,0,2}, {1657,1,0,11},
   {1663,1,0,3}, {1667,1,0,2}, {1669,1,0,2}, {1693,1,0,2}, {1697,1,0,3},
   {1699,1,0,3}, {1709,1,0,3}, {1721,1,0,3}, {1723,1,0,3}, {1733,1,0,2},
   {1741,1,0,2}, {1747,1,0,2}, {1753,1,0,7}, {1759,1,0,6}, {1777,1,0,5},
   {1783,1,0,10}, {1787,1,0,2}, {1789,1,0,6}, {1801,1,0,11}, {1811,1,0,6},
   {1823,1,0,5}, {1831,1,0,3}, {1847,1,0,5}, {1861,1,0,2}, {1867,1,0,2},
   {1871,1,0,14}, {1873,1,0,10}, {1877,1,0,2}, {1879,1,0,6}, {1889,1,0,3},
   {1901,1,0,2}, {1907,1,0,2}, {1913,1,0,3}, {1931,1,0,2}, {1933,1,0,5},
   {1949,1,0,2}, {1951,1,0,3}, {1973,1,0,2}, {1979,1,0,2}, {1987,1,0,2},
   {1993,1,0,5}, {1997,1,0,2}, {1999,1,0,3}, {2003,1,0,5}, {2011,1,0,3},
   {2017,1,0,5}, {2027,1,0,2}, {2029,1,0,2}, {2039,1,0,7}, {2053,1,0,2},
   {2063,1,0,5}, {2069,1,0,2}, {2081,1,0,3}, {2083,1,0,2}, {2087,1,0,5},
   {2089,1,0,7}, {2099,1,0,2}, {2111,1,0,7}, {2113,1,0,5}, {2129,1,0,3},
   {2131,1,0,2}, {2137,1,0,10}, {2141,1,0,2}, {2143,1,0,3}, {2153,1,0,3},
   {2161,1,0,23}, {2179,1,0,7}, {2203,1,0,5}, {2207,1,0,5}, {2213,1,0,2},
   {2221,1,0,2}, {2237,1,0,2}, {2239,1,0,3}, {2243,1,0,2}, {2251,1,0,7},
   {2267,1,0,2}, {2269,1,0,2}, {2273,1,0,3}, {2281,1,0,7}, {2287,1,0,19},
   {2293,1,0,2}, {2297,1,0,5}, {2309,1,0,2}, {2311,1,0,3}, {2333,1,0,2},
   {2339,1,0,2}, {2341,1,0,7}, {2347,1,0,3}, {2351,1,0,13}, {2357,1,0,2},
   {2371,1,0,2}, {2377,1,0,5}, {2381,1,0,3}, {2383,1,0,5}, {2389,1,0,2},
   {2393,1,0,3}, {2399,1,0,11}, {2411,1,0,6}, {2417,1,0,3}, {2423,1,0,5},
   {2437,1,0,2}, {2441,1,0,6}, {2447,1,0,5}, {2459,1,0,2}, {2467,1,0,2},
   {2473,1,0,5}, {2477,1,0,2}, {2503,1,0,3}, {2521,1,0,17}, {2531,1,0,2},
   {2539,1,0,2}, {2543,1,0,5}, {2549,1,0,2}, {2551,1,0,6}, {2557,1,0,2},
   {2579,1,0,2}, {2591,1,0,7}, {2593,1,0,7}, {2609,1,0,3}, {2617,1,0,5},
   {2621,1,0,2}, {2633,1,0,3}, {2647,1,0,3}, {2657,1,0,3}, {2659,1,0,2},
   {2663,1,0,5}, {2671,1,0,7}, {2677,1,0,2}, {2683,1,0,2}, {2687,1,0,5},
   {2689,1,0,19}, {2693,1,0,2}, {2699,1,0,2}, {2707,1,0,2}, {2711,1,0,7},
   {2713,1,0,5}, {2719,1,0,3}, {2729,1,0,3}, {2731,1,0,3}, {2741,1,0,2},
   {2749,1,0,6}, {2753,1,0,3}, {2767,1,0,3}, {2777,1,0,3}, {2789,1,0,2},
   {2791,1,0,6}, {2797,1,0,2}, {2801,1,0,3}, {2803,1,0,2}, {2819,1,0,2},
   {2833,1,0,5}, {2837,1,0,2}, {2843,1,0,2}, {2851,1,0,2}, {2857,1,0,11},
   {2861,1,0,2}, {2879,1,0,7}, {2887,1,0,5}, {2897,1,0,3}, {2903,1,0,5},
   {2909,1,0,2}, {2917,1,0,5}, {2927,1,0,5}, {2939,1,0,2}, {2953,1,0,13},
   {2957,1,0,2}, {2963,1,0,2}, {2969,1,0,3}, {2971,1,0,10}, {2999,1,0,17},
   {3001,1,0,14}, {3011,1,0,2}, {3019,1,0,2}, {3023,1,0,5}, {3037,1,0,2},
   {3041,1,0,3}, {3049,1,0,11}, {3061,1,0,6}, {3067,1,0,2}, {3079,1,0,6},
   {3083,1,0,2}, {3089,1,0,3}, {3109,1,0,6}, {3119,1,0,7}, {3121,1,0,7},
   {3137,1,0,3}, {3163,1,0,3}, {3167,1,0,5}, {3169,1,0,7}, {3181,1,0,7},
   {3187,1,0,2}, {3191,1,0,11}, {3203,1,0,2}, {3209,1,0,3}, {3217,1,0,5},
   {3221,1,0,10}, {3229,1,0,6}, {3251,1,0,6}, {3253,1,0,2}, {3257,1,0,3},
   {3259,1,0,3}, {3271,1,0,3}, {3299,1,0,2}, {3301,1,0,6}, {3307,1,0,2},
   {3313,1,0,10}, {3319,1,0,6}, {3323,1,0,2}, {3329,1,0,3}, {3331,1,0,3},
   {3343,1,0,5}, {3347,1,0,2}, {3359,1,0,11}, {3361,1,0,22}, {3371,1,0,2},
   {3373,1,0,5}, {3389,1,0,3}, {3391,1,0,3}, {3407,1,0,5}, {3413,1,0,2},
   {3433,1,0,5}, {3449,1,0,3}, {3457,1,0,7}, {3461,1,0,2}, {3463,1,0,3},
   {3467,1,0,2}, {3469,1,0,2}, {3491,1,0,2}, {3499,1,0,2}, {3511,1,0,7},
   {3517,1,0,2}, {3527,1,0,5}, {3529,1,0,17}, {3533,1,0,2}, {3539,1,0,2},
   {3541,1,0,7}, {3547,1,0,2}, {3557,1,0,2}, {3559,1,0,3}, {3571,1,0,2},
   {3581,1,0,2}, {3583,1,0,3}, {3593,1,0,3}, {3607,1,0,5}, {3613,1,0,2},
   {3617,1,0,3}, {3623,1,0,5}, {3631,1,0,15}, {3637,1,0,2}, {3643,1,0,2},
   {3659,1,0,2}, {3671,1,0,13}, {3673,1,0,5}, {3677,1,0,2}, {3691,1,0,2},
   {3697,1,0,5}, {3701,1,0,2}, {3709,1,0,2}, {3719,1,0,7}, {3727,1,0,3},
   {3733,1,0,2}, {3739,1,0,7}, {3761,1,0,3}, {3767,1,0,5}, {3769,1,0,7},
   {3779,1,0,2}, {3793,1,0,5}, {3797,1,0,2}, {3803,1,0,2}, {3821,1,0,3},
   {3823,1,0,3}, {3833,1,0,3}, {3847,1,0,5}, {3851,1,0,2}, {3853,1,0,2},
   {3863,1,0,5}, {3877,1,0,2}, {3881,1,0,13}, {3889,1,0,11}, {3907,1,0,2},
   {3911,1,0,13}, {3917,1,0,2}, {3919,1,0,3}, {3923,1,0,2}, {3929,1,0,3},
   {3931,1,0,2}, {3943,1,0,3}, {3947,1,0,2}, {3967,1,0,6}, {3989,1,0,2},
   {4001,1,0,3}, {4003,1,0,2}, {4007,1,0,5}, {4013,1,0,2}, {4019,1,0,2},
   {4021,1,0,2}, {4027,1,0,3}, {4049,1,0,3}, {4051,1,0,10}, {4057,1,0,5},
   {4073,1,0,3}, {4079,1,0,11}, {4091,1,0,2}, {4093,1,0,2}, {4099,1,0,2},
   {4111,1,0,12}, {4127,1,0,5}, {4129,1,0,13}, {4133,1,0,2}, {4139,1,0,2},
   {4153,1,0,5}, {4157,1,0,2}, {4159,1,0,3}, {4177,1,0,5}, {4201,1,0,11},
   {4211,1,0,6}, {4217,1,0,3}, {4219,1,0,2}, {4229,1,0,2}, {4231,1,0,3},
   {4241,1,0,3}, {4243,1,0,2}, {4253,1,0,2}, {4259,1,0,2}, {4261,1,0,2},
   {4271,1,0,7}, {4273,1,0,5}, {4283,1,0,2}, {4289,1,0,3}, {4297,1,0,5},
   {4327,1,0,3}, {4337,1,0,3}, {4339,1,0,10}, {4349,1,0,2}, {4357,1,0,2},
   {4363,1,0,2}, {4373,1,0,2}, {4391,1,0,14}, {4397,1,0,2}, {4409,1,0,3},
   {4421,1,0,3}, {4423,1,0,3}, {4441,1,0,21}, {4447,1,0,3}, {4451,1,0,2},
   {4457,1,0,3}, {4463,1,0,5}, {4481,1,0,3}, {4483,1,0,2}, {4493,1,0,2},
   {4507,1,0,2}, {4513,1,0,7}, {4517,1,0,2}, {4519,1,0,3}, {4523,1,0,5},
   {4547,1,0,2}, {4549,1,0,6}, {4561,1,0,11}, {4567,1,0,3}, {4583,1,0,5},
   {4591,1,0,11}, {4597,1,0,5}, {4603,1,0,2}, {4621,1,0,2}, {4637,1,0,2},
   {4639,1,0,3}, {4643,1,0,5}, {4649,1,0,3}, {4651,1,0,3}, {4657,1,0,15},
   {4663,1,0,3}, {4673,1,0,3}, {4679,1,0,11}, {4691,1,0,2}, {4703,1,0,5},
   {4721,1,0,6}, {4723,1,0,2}, {4729,1,0,17}, {4733,1,0,5}, {4751,1,0,19},
   {4759,1,0,3}, {4783,1,0,6}, {4787,1,0,2}, {4789,1,0,2}, {4793,1,0,3},
   {4799,1,0,7}, {4801,1,0,7}, {4813,1,0,2}, {4817,1,0,3}, {4831,1,0,3},
   {4861,1,0,11}, {4871,1,0,11}, {4877,1,0,2}, {4889,1,0,3}, {4903,1,0,3},
   {4909,1,0,6}, {4919,1,0,13}, {4931,1,0,6}, {4933,1,0,2}, {4937,1,0,3},
   {4943,1,0,7}, {4951,1,0,6}, {4957,1,0,2}, {4967,1,0,5}, {4969,1,0,11},
   {4973,1,0,2}, {4987,1,0,2}, {4993,1,0,5}, {4999,1,0,3}, {5003,1,0,2},
   {5009,1,0,3}, {5011,1,0,2}, {5021,1,0,3}, {5023,1,0,3}, {5039,1,0,11},
   {5051,1,0,2}, {5059,1,0,2}, {5077,1,0,2}, {5081,1,0,3}, {5087,1,0,5},
   {5099,1,0,2}, {5101,1,0,6}, {5107,1,0,2}, {5113,1,0,19}, {5119,1,0,3},
   {5147,1,0,2}, {5153,1,0,5}, {5167,1,0,6}, {5171,1,0,2}, {5179,1,0,2},
   {5189,1,0,2}, {5197,1,0,7}, {5209,1,0,17}, {5227,1,0,2}, {5231,1,0,7},
   {5233,1,0,10}, {5237,1,0,3}, {5261,1,0,2}, {5273,1,0,3}, {5279,1,0,7},
   {5281,1,0,7}, {5297,1,0,3}, {5303,1,0,5}, {5309,1,0,2}, {5323,1,0,5},
   {5333,1,0,2}, {5347,1,0,3}, {5351,1,0,11}, {5381,1,0,3}, {5387,1,0,2},
   {5393,1,0,3}, {5399,1,0,7}, {5407,1,0,3}, {5413,1,0,5}, {5417,1,0,3},
   {5419,1,0,3}, {5431,1,0,3}, {5437,1,0,5}, {5441,1,0,3}, {5443,1,0,2},
   {5449,1,0,7}, {5471,1,0,7}, {5477,1,0,2}, {5479,1,0,3}, {5483,1,0,2},
   {5501,1,0,2}, {5503,1,0,3}, {5507,1,0,2}, {5519,1,0,13}, {5521,1,0,11},
   {5527,1,0,5}, {5531,1,0,10}, {5557,1,0,2}, {5563,1,0,2}, {5569,1,0,13},
   {5573,1,0,2}, {5581,1,0,6}, {5591,1,0,11}, {5623,1,0,5}, {5639,1,0,7},
   {5641,1,0,14}, {5647,1,0,3}, {5651,1,0,2}, {5653,1,0,5}, {5657,1,0,3},
   {5659,1,0,2}, {5669,1,0,3}, {5683,1,0,2}, {5689,1,0,11}, {5693,1,0,2},
   {5701,1,0,2}, {5711,1,0,19}, {5717,1,0,2}, {5737,1,0,5}, {5741,1,0,2},
   {5743,1,0,10}, {5749,1,0,2}, {5779,1,0,2}, {5783,1,0,7}, {5791,1,0,6},
   {5801,1,0,3}, {5807,1,0,5}, {5813,1,0,2}, {5821,1,0,6}, {5827,1,0,2},
   {5839,1,0,6}, {5843,1,0,2}, {5849,1,0,3}, {5851,1,0,2}, {5857,1,0,7},
   {5861,1,0,3}, {5867,1,0,5}, {5869,1,0,2}, {5879,1,0,11}, {5881,1,0,31},
   {5897,1,0,3}, {5903,1,0,5}, {5923,1,0,2}, {5927,1,0,5}, {5939,1,0,2},
   {5953,1,0,7}, {5981,1,0,3}, {5987,1,0,2}, {6007,1,0,3}, {6011,1,0,2},
   {6029,1,0,2}, {6037,1,0,5}, {6043,1,0,5}, {6047,1,0,5}, {6053,1,0,2},
   {6067,1,0,2}, {6073,1,0,10}, {6079,1,0,17}, {6089,1,0,3}, {6091,1,0,7},
   {6101,1,0,2}, {6113,1,0,3}, {6121,1,0,7}, {6131,1,0,2}, {6133,1,0,5},
   {6143,1,0,5}, {6151,1,0,3}, {6163,1,0,3}, {6173,1,0,2}, {6197,1,0,2},
   {6199,1,0,3}, {6203,1,0,2}, {6211,1,0,2}, {6217,1,0,5}, {6221,1,0,3},
   {6229,1,0,2}, {6247,1,0,5}, {6257,1,0,3}, {6263,1,0,5}, {6269,1,0,2},
   {6271,1,0,11}, {6277,1,0,2}, {6287,1,0,7}, {6299,1,0,2}, {6301,1,0,10},
   {6311,1,0,7}, {6317,1,0,2}, {6323,1,0,2}, {6329,1,0,3}, {6337,1,0,10},
   {6343,1,0,3}, {6353,1,0,3}, {6359,1,0,13}, {6361,1,0,19}, {6367,1,0,3},
   {6373,1,0,2}, {6379,1,0,2}, {6389,1,0,2}, {6397,1,0,2}, {6421,1,0,6},
   {6427,1,0,3}, {6449,1,0,3}, {6451,1,0,3}, {6469,1,0,2}, {6473,1,0,3},
   {6481,1,0,7}, {6491,1,0,2}, {6521,1,0,6}, {6529,1,0,7}, {6547,1,0,2},
   {6551,1,0,17}, {6553,1,0,10}, {6563,1,0,5}, {6569,1,0,3}, {6571,1,0,3},
   {6577,1,0,5}, {6581,1,0,14}, {6599,1,0,13}, {6607,1,0,3}, {6619,1,0,2},
   {6637,1,0,2}, {6653,1,0,2}, {6659,1,0,2}, {6661,1,0,6}, {6673,1,0,5},
   {6679,1,0,7}, {6689,1,0,3}, {6691,1,0,2}, {6701,1,0,2}, {6703,1,0,5},
   {6709,1,0,2}, {6719,1,0,11}, {6733,1,0,2}, {6737,1,0,3}, {6761,1,0,3},
   {6763,1,0,2}, {6779,1,0,2}, {6781,1,0,2}, {6791,1,0,7}, {6793,1,0,10},
   {6803,1,0,2}, {6823,1,0,3}, {6827,1,0,2}, {6829,1,0,2}, {6833,1,0,3},
   {6841,1,0,22}, {6857,1,0,3}, {6863,1,0,5}, {6869,1,0,2}, {6871,1,0,3},
   {6883,1,0,2}, {6899,1,0,2}, {6907,1,0,2}, {6911,1,0,7}, {6917,1,0,2},
   {6947,1,0,2}, {6949,1,0,2}, {6959,1,0,7}, {6961,1,0,13}, {6967,1,0,5},
   {6971,1,0,2}, {6977,1,0,3}, {6983,1,0,5}, {6991,1,0,6}, {6997,1,0,5},
   {7001,1,0,3}, {7013,1,0,2}, {7019,1,0,2}, {7027,1,0,2}, {7039,1,0,3},
   {7043,1,0,2}, {7057,1,0,5}, {7069,1,0,2}, {7079,1,0,7}, {7103,1,0,5},
   {7109,1,0,2}, {7121,1,0,3}, {7127,1,0,5}, {7129,1,0,7}, {7151,1,0,7},
   {7159,1,0,3}, {7177,1,0,10}, {7187,1,0,2}, {7193,1,0,3}, {7207,1,0,3},
   {7211,1,0,2}, {7213,1,0,5}, {7219,1,0,2}, {7229,1,0,2}, {7237,1,0,2},
   {7243,1,0,2}, {7247,1,0,5}, {7253,1,0,2}, {7283,1,0,2}, {7297,1,0,5},
   {7307,1,0,2}, {7309,1,0,6}, {7321,1,0,7}, {7331,1,0,2}, {7333,1,0,6},
   {7349,1,0,2}, {7351,1,0,6}, {7369,1,0,7}, {7393,1,0,5}, {7411,1,0,2},
   {7417,1,0,5}, {7433,1,0,3}, {7451,1,0,2}, {7457,1,0,3}, {7459,1,0,2},
   {7477,1,0,2}, {7481,1,0,6}, {7487,1,0,5}, {7489,1,0,7}, {7499,1,0,2},
   {7507,1,0,2}, {7517,1,0,2}, {7523,1,0,2}, {7529,1,0,3}, {7537,1,0,7},
   {7541,1,0,2}, {7547,1,0,2}, {7549,1,0,2}, {7559,1,0,13}, {7561,1,0,13},
   {7573,1,0,2}, {7577,1,0,3}, {7583,1,0,5}, {7589,1,0,2}, {7591,1,0,6},
   {7603,1,0,2}, {7607,1,0,5}, {7621,1,0,2}, {7639,1,0,7}, {7643,1,0,2},
   {7649,1,0,3}, {7669,1,0,2}, {7673,1,0,3}, {7681,1,0,17}, {7687,1,0,6},
   {7691,1,0,2}, {7699,1,0,3}, {7703,1,0,5}, {7717,1,0,2}, {7723,1,0,3},
   {7727,1,0,5}, {7741,1,0,7}, {7753,1,0,10}, {7757,1,0,2}, {7759,1,0,3},
   {7789,1,0,2}, {7793,1,0,3}, {7817,1,0,3}, {7823,1,0,5}, {7829,1,0,2},
   {7841,1,0,12}, {7853,1,0,2}, {7867,1,0,3}, {7873,1,0,5}, {7877,1,0,2},
   {7879,1,0,3}, {7883,1,0,2}, {7901,1,0,2}, {7907,1,0,2}, {7919,1,0,7},
   {7927,1,0,3}, {7933,1,0,2}, {7937,1,0,3}, {7949,1,0,2}, {7951,1,0,6},
   {7963,1,0,5}, {7993,1,0,5}, {8009,1,0,3}, {8011,1,0,14}, {8017,1,0,5},
   {8039,1,0,11}, {8053,1,0,2}, {8059,1,0,3}, {8069,1,0,2}, {8081,1,0,3},
   {8087,1,0,5}, {8089,1,0,17}, {8093,1,0,2}, {8101,1,0,6}, {8111,1,0,11},
   {8117,1,0,2}, {8123,1,0,2}, {8147,1,0,2}, {8161,1,0,7}, {8167,1,0,3},
   {8171,1,0,2}, {8179,1,0,2}, {8191,1,0,17}, {8209,1,0,7}, {8219,1,0,2},
   {8221,1,0,2}, {8231,1,0,11}, {8233,1,0,10}, {8237,1,0,2}, {8243,1,0,2},
   {8263,1,0,3}, {8269,1,0,2}, {8273,1,0,3}, {8287,1,0,3}, {8291,1,0,2},
   {8293,1,0,2}, {8297,1,0,3}, {8311,1,0,3}, {8317,1,0,6}, {8329,1,0,7},
   {8353,1,0,5}, {8363,1,0,2}, {8369,1,0,3}, {8377,1,0,5}, {8387,1,0,2},
   {8389,1,0,6}, {8419,1,0,3}, {8423,1,0,5}, {8429,1,0,2}, {8431,1,0,3},
   {8443,1,0,2}, {8447,1,0,5}, {8461,1,0,6}, {8467,1,0,2}, {8501,1,0,7},
   {8513,1,0,5}, {8521,1,0,13}, {8527,1,0,5}, {8537,1,0,3}, {8539,1,0,2},
   {8543,1,0,5}, {8563,1,0,2}, {8573,1,0,2}, {8581,1,0,6}, {8597,1,0,2},
   {8599,1,0,3}, {8609,1,0,3}, {8623,1,0,3}, {8627,1,0,2}, {8629,1,0,6},
   {8641,1,0,17}, {8647,1,0,3}, {8663,1,0,5}, {8669,1,0,2}, {8677,1,0,2},
   {8681,1,0,15}, {8689,1,0,13}, {8693,1,0,2}, {8699,1,0,2}, {8707,1,0,5},
   {8713,1,0,5}, {8719,1,0,3}, {8731,1,0,2}, {8737,1,0,5}, {8741,1,0,2},
   {8747,1,0,2}, {8753,1,0,3}, {8761,1,0,23}, {8779,1,0,11}, {8783,1,0,5},
   {8803,1,0,2}, {8807,1,0,5}, {8819,1,0,2}, {8821,1,0,2}, {8831,1,0,7},
   {8837,1,0,2}, {8839,1,0,3}, {8849,1,0,3}, {8861,1,0,2}, {8863,1,0,3},
   {8867,1,0,2}, {8887,1,0,3}, {8893,1,0,5}, {8923,1,0,2}, {8929,1,0,11},
   {8933,1,0,2}, {8941,1,0,6}, {8951,1,0,13}, {8963,1,0,2}, {8969,1,0,3},
   {8971,1,0,2}, {8999,1,0,7}, {9001,1,0,7}, {9007,1,0,3}, {9011,1,0,2},
   {9013,1,0,5}, {9029,1,0,2}, {9041,1,0,3}, {9043,1,0,3}, {9049,1,0,7},
   {9059,1,0,2}, {9067,1,0,3}, {9091,1,0,3}, {9103,1,0,6}, {9109,1,0,10},
   {9127,1,0,3}, {9133,1,0,6}, {9137,1,0,3}, {9151,1,0,3}, {9157,1,0,6},
   {9161,1,0,3}, {9173,1,0,2}, {9181,1,0,2}, {9187,1,0,3}, {9199,1,0,3},
   {9203,1,0,2}, {9209,1,0,3}, {9221,1,0,2}, {9227,1,0,2}, {9239,1,0,19},
   {9241,1,0,13}, {9257,1,0,3}, {9277,1,0,5}, {9281,1,0,3}, {9283,1,0,2},
   {9293,1,0,2}, {9311,1,0,7}, {9319,1,0,3}, {9323,1,0,2}, {9337,1,0,5},
   {9341,1,0,2}, {9343,1,0,5}, {9349,1,0,2}, {9371,1,0,2}, {9377,1,0,3},
   {9391,1,0,3}, {9397,1,0,2}, {9403,1,0,3}, {9413,1,0,3}, {9419,1,0,2},
   {9421,1,0,2}, {9431,1,0,7}, {9433,1,0,5}, {9437,1,0,2}, {9439,1,0,22},
   {9461,1,0,3}, {9463,1,0,3}, {9467,1,0,2}, {9473,1,0,3}, {9479,1,0,7},
   {9491,1,0,2}, {9497,1,0,3}, {9511,1,0,3}, {9521,1,0,3}, {9533,1,0,2},
   {9539,1,0,2}, {9547,1,0,2}, {9551,1,0,11}, {9587,1,0,2}, {9601,1,0,13},
   {9613,1,0,2}, {9619,1,0,2}, {9623,1,0,5}, {9629,1,0,2}, {9631,1,0,3},
   {9643,1,0,2}, {9649,1,0,7}, {9661,1,0,2}, {9677,1,0,2}, {9679,1,0,3},
   {9689,1,0,3}, {9697,1,0,10}, {9719,1,0,17}, {9721,1,0,7}, {9733,1,0,2},
   {9739,1,0,3}, {9743,1,0,5}, {9749,1,0,2}, {9767,1,0,5}, {9769,1,0,13},
   {9781,1,0,6}, {9787,1,0,3}, {9791,1,0,11}, {9803,1,0,2}, {9811,1,0,3},
   {9817,1,0,5}, {9829,1,0,10}, {9833,1,0,3}, {9839,1,0,7}, {9851,1,0,2},
   {9857,1,0,5}, {9859,1,0,2}, {9871,1,0,3}, {9883,1,0,2}, {9887,1,0,5},
   {9901,1,0,2}, {9907,1,0,2}, {9923,1,0,2}, {9929,1,0,3}, {9931,1,0,10},
   {9941,1,0,2}, {9949,1,0,2}, {9967,1,0,3}, {9973,1,0,11}, {10007,1,0,5},
   {10009,1,0,11}, {10037,1,0,2}, {10039,1,0,3}, {10061,1,0,3}, {10067,1,0,2},
   {10069,1,0,2}, {10079,1,0,11}, {10091,1,0,2}, {10093,1,0,2}, {10099,1,0,2},
   {10103,1,0,5}, {10111,1,0,12}, {10133,1,0,2}, {10139,1,0,2}, {10141,1,0,2},
   {10151,1,0,7}, {10159,1,0,3}, {10163,1,0,2}, {10169,1,0,3}, {10177,1,0,7},
   {10181,1,0,2}, {10193,1,0,3}, {10211,1,0,6}, {10223,1,0,5}, {10243,1,0,7},
   {10247,1,0,5}, {10253,1,0,2}, {10259,1,0,2}, {10267,1,0,2}, {10271,1,0,7},
   {10273,1,0,10}, {10289,1,0,3}, {10301,1,0,2}, {10303,1,0,3}, {10313,1,0,3},
   {10321,1,0,7}, {10331,1,0,2}, {10333,1,0,5}, {10337,1,0,3}, {10343,1,0,5},
   {10357,1,0,2}, {10369,1,0,13}, {10391,1,0,19}, {10399,1,0,6}, {10427,1,0,2},
   {10429,1,0,7}, {10433,1,0,3}, {10453,1,0,5}, {10457,1,0,3}, {10459,1,0,2},
   {10463,1,0,5}, {10477,1,0,2}, {10487,1,0,5}, {10499,1,0,2}, {10501,1,0,2},
   {10513,1,0,7}, {10529,1,0,3}, {10531,1,0,3}, {10559,1,0,23}, {10567,1,0,6},
   {10589,1,0,2}, {10597,1,0,5}, {10601,1,0,3}, {10607,1,0,5}, {10613,1,0,2},
   {10627,1,0,5}, {10631,1,0,11}, {10639,1,0,6}, {10651,1,0,7}, {10657,1,0,7},
   {10663,1,0,3}, {10667,1,0,2}, {10687,1,0,5}, {10691,1,0,2}, {10709,1,0,2},
   {10711,1,0,3}, {10723,1,0,2}, {10729,1,0,7}, {10733,1,0,2}, {10739,1,0,6},
   {10753,1,0,11}, {10771,1,0,3}, {10781,1,0,10}, {10789,1,0,2}, {10799,1,0,19},
   {10831,1,0,7}, {10837,1,0,2}, {10847,1,0,5}, {10853,1,0,2}, {10859,1,0,2},
   {10861,1,0,2}, {10867,1,0,2}, {10883,1,0,2}, {10889,1,0,3}, {10891,1,0,2},
   {10903,1,0,3}, {10909,1,0,2}, {10937,1,0,3}, {10939,1,0,3}, {10949,1,0,2},
   {10957,1,0,5}, {10973,1,0,2}, {10979,1,0,2}, {10987,1,0,2}, {10993,1,0,7},
   {11003,1,0,2}, {11027,1,0,2}, {11047,1,0,3}, {11057,1,0,3}, {11059,1,0,10},
   {11069,1,0,2}, {11071,1,0,3}, {11083,1,0,2}, {11087,1,0,5}, {11093,1,0,2},
   {11113,1,0,13}, {11117,1,0,3}, {11119,1,0,3}, {11131,1,0,2}, {11149,1,0,10},
   {11159,1,0,7}, {11161,1,0,7}, {11171,1,0,2}, {11173,1,0,5}, {11177,1,0,3},
   {11197,1,0,2}, {11213,1,0,2}, {11239,1,0,3}, {11243,1,0,5}, {11251,1,0,13},
   {11257,1,0,10}, {11261,1,0,2}, {11273,1,0,3}, {11279,1,0,7}, {11287,1,0,3},
   {11299,1,0,3}, {11311,1,0,3}, {11317,1,0,2}, {11321,1,0,3}, {11329,1,0,7},
   {11351,1,0,7}, {11353,1,0,7}, {11369,1,0,3}, {11383,1,0,5}, {11393,1,0,3},
   {11399,1,0,11}, {11411,1,0,7}, {11423,1,0,5}, {11437,1,0,2}, {11443,1,0,2},
   {11447,1,0,5}, {11467,1,0,5}, {11471,1,0,11}, {11483,1,0,2}, {11489,1,0,3},
   {11491,1,0,3}, {11497,1,0,7}, {11503,1,0,3}, {11519,1,0,7}, {11527,1,0,5},
   {11549,1,0,2}, {11551,1,0,7}, {11579,1,0,2}, {11587,1,0,2}, {11593,1,0,5},
   {11597,1,0,3}, {11617,1,0,10}, {11621,1,0,2}, {11633,1,0,3}, {11657,1,0,3},
   {11677,1,0,2}, {11681,1,0,3}, {11689,1,0,7}, {11699,1,0,2}, {11701,1,0,6},
   {11717,1,0,2}, {11719,1,0,6}, {11731,1,0,3}, {11743,1,0,3}, {11777,1,0,3},
   {11779,1,0,2}, {11783,1,0,5}, {11789,1,0,2}, {11801,1,0,3}, {11807,1,0,5},
   {11813,1,0,2}, {11821,1,0,2}, {11827,1,0,2}, {11831,1,0,7}, {11833,1,0,5},
   {11839,1,0,3}, {11863,1,0,3}, {11867,1,0,2}, {11887,1,0,3}, {11897,1,0,3},
   {11903,1,0,5}, {11909,1,0,2}, {11923,1,0,5}, {11927,1,0,5}, {11933,1,0,2},
   {11939,1,0,2}, {11941,1,0,10}, {11953,1,0,5}, {11959,1,0,3}, {11969,1,0,3},
   {11971,1,0,10}, {11981,1,0,2}, {11987,1,0,2}, {12007,1,0,13}, {12011,1,0,2},
   {12037,1,0,5}, {12041,1,0,3}, {12043,1,0,2}, {12049,1,0,13}, {12071,1,0,11},
   {12073,1,0,7}, {12097,1,0,5}, {12101,1,0,3}, {12107,1,0,2}, {12109,1,0,6},
   {12113,1,0,3}, {12119,1,0,7}, {12143,1,0,10}, {12149,1,0,2}, {12157,1,0,2},
   {12161,1,0,3}, {12163,1,0,5}, {12197,1,0,2}, {12203,1,0,2}, {12211,1,0,2},
   {12227,1,0,2}, {12239,1,0,13}, {12241,1,0,7}, {12251,1,0,2}, {12253,1,0,2},
   {12263,1,0,5}, {12269,1,0,2}, {12277,1,0,2}, {12281,1,0,3}, {12289,1,0,11},
   {12301,1,0,2}, {12323,1,0,2}, {12329,1,0,3}, {12343,1,0,7}, {12347,1,0,2},
   {12373,1,0,2}, {12377,1,0,6}, {12379,1,0,2}, {12391,1,0,26}, {12401,1,0,3},
   {12409,1,0,7}, {12413,1,0,2}, {12421,1,0,7}, {12433,1,0,13}, {12437,1,0,2},
   {12451,1,0,3}, {12457,1,0,10}, {12473,1,0,3}, {12479,1,0,23}, {12487,1,0,3},
   {12491,1,0,2}, {12497,1,0,3}, {12503,1,0,5}, {12511,1,0,3}, {12517,1,0,6},
   {12527,1,0,5}, {12539,1,0,2}, {12541,1,0,14}, {12547,1,0,2}, {12553,1,0,5},
   {12569,1,0,3}, {12577,1,0,10}, {12583,1,0,5}, {12589,1,0,2}, {12601,1,0,11},
   {12611,1,0,2}, {12613,1,0,2}, {12619,1,0,2}, {12637,1,0,2}, {12641,1,0,3},
   {12647,1,0,5}, {12653,1,0,2}, {12659,1,0,2}, {12671,1,0,14}, {12689,1,0,3},
   {12697,1,0,7}, {12703,1,0,3}, {12713,1,0,3}, {12721,1,0,13}, {12739,1,0,2},
   {12743,1,0,5}, {12757,1,0,2}, {12763,1,0,2}, {12781,1,0,2}, {12791,1,0,7},
   {12799,1,0,13}, {12809,1,0,3}, {12821,1,0,2}, {12823,1,0,3}, {12829,1,0,2},
   {12841,1,0,21}, {12853,1,0,5}, {12889,1,0,13}, {12893,1,0,3}, {12899,1,0,2},
   {12907,1,0,2}, {12911,1,0,23}, {12917,1,0,2}, {12919,1,0,6}, {12923,1,0,2},
   {12941,1,0,2}, {12953,1,0,3}, {12959,1,0,7}, {12967,1,0,3}, {12973,1,0,14},
   {12979,1,0,2}, {12983,1,0,5}, {13001,1,0,3}, {13003,1,0,5}, {13007,1,0,5},
   {13009,1,0,7}, {13033,1,0,5}, {13037,1,0,2}, {13043,1,0,2}, {13049,1,0,3},
   {13063,1,0,5}, {13093,1,0,6}, {13099,1,0,3}, {13103,1,0,5}, {13109,1,0,2},
   {13121,1,0,7}, {13127,1,0,5}, {13147,1,0,2}, {13151,1,0,13}, {13159,1,0,3},
   {13163,1,0,2}, {13171,1,0,11}, {13177,1,0,5}, {13183,1,0,3}, {13187,1,0,2},
   {13217,1,0,3}, {13219,1,0,3}, {13229,1,0,2}, {13241,1,0,3}, {13249,1,0,7},
   {13259,1,0,6}, {13267,1,0,3}, {13291,1,0,2}, {13297,1,0,5}, {13309,1,0,6},
   {13313,1,0,3}, {13327,1,0,3}, {13331,1,0,2}, {13337,1,0,3}, {13339,1,0,2},
   {13367,1,0,5}, {13381,1,0,10}, {13397,1,0,2}, {13399,1,0,3}, {13411,1,0,2},
   {13417,1,0,5}, {13421,1,0,10}, {13441,1,0,11}, {13451,1,0,2}, {13457,1,0,3},
   {13463,1,0,5}, {13469,1,0,2}, {13477,1,0,2}, {13487,1,0,5}, {13499,1,0,6},
   {13513,1,0,5}, {13523,1,0,2}, {13537,1,0,7}, {13553,1,0,3}, {13567,1,0,3},
   {13577,1,0,3}, {13591,1,0,3}, {13597,1,0,5}, {13613,1,0,2}, {13619,1,0,2},
   {13627,1,0,2}, {13633,1,0,5}, {13649,1,0,3}, {13669,1,0,6}, {13679,1,0,7},
   {13681,1,0,22}, {13687,1,0,3}, {13691,1,0,2}, {13693,1,0,6}, {13697,1,0,3},
   {13709,1,0,2}, {13711,1,0,6}, {13721,1,0,3}, {13723,1,0,2}, {13729,1,0,23},
   {13751,1,0,11}, {13757,1,0,2}, {13759,1,0,6}, {13763,1,0,2}, {13781,1,0,7},
   {13789,1,0,7}, {13799,1,0,7}, {13807,1,0,5}, {13829,1,0,2}, {13831,1,0,6},
   {13841,1,0,6}, {13859,1,0,2}, {13873,1,0,5}, {13877,1,0,2}, {13879,1,0,6},
   {13883,1,0,2}, {13901,1,0,2}, {13903,1,0,3}, {13907,1,0,2}, {13913,1,0,3},
   {13921,1,0,7}, {13931,1,0,2}, {13933,1,0,2}, {13963,1,0,3}, {13967,1,0,5},
   {13997,1,0,2}, {13999,1,0,3}, {14009,1,0,3}, {14011,1,0,2}, {14029,1,0,6},
   {14033,1,0,3}, {14051,1,0,2}, {14057,1,0,3}, {14071,1,0,7}, {14081,1,0,3},
   {14083,1,0,3}, {14087,1,0,5}, {14107,1,0,2}, {14143,1,0,3}, {14149,1,0,6},
   {14153,1,0,3}, {14159,1,0,13}, {14173,1,0,2}, {14177,1,0,3}, {14197,1,0,11},
   {14207,1,0,5}, {14221,1,0,2}, {14243,1,0,2}, {14249,1,0,3}, {14251,1,0,3},
   {14281,1,0,19}, {14293,1,0,6}, {14303,1,0,5}, {14321,1,0,3}, {14323,1,0,5},
   {14327,1,0,5}, {14341,1,0,2}, {14347,1,0,3}, {14369,1,0,3}, {14387,1,0,2},
   {14389,1,0,2}, {14401,1,0,11}, {14407,1,0,19}, {14411,1,0,2}, {14419,1,0,2},
   {14423,1,0,5}, {14431,1,0,3}, {14437,1,0,5}, {14447,1,0,5}, {14449,1,0,22},
   {14461,1,0,2}, {14479,1,0,3}, {14489,1,0,3}, {14503,1,0,3}, {14519,1,0,13},
   {14533,1,0,2}, {14537,1,0,3}, {14543,1,0,5}, {14549,1,0,2}, {14551,1,0,3},
   {14557,1,0,2}, {14561,1,0,6}, {14563,1,0,3}, {14591,1,0,11}, {14593,1,0,5},
   {14621,1,0,2}, {14627,1,0,2}, {14629,1,0,2}, {14633,1,0,3}, {14639,1,0,11},
   {14653,1,0,2}, {14657,1,0,3}, {14669,1,0,2}, {14683,1,0,3}, {14699,1,0,2},
   {14713,1,0,5}, {14717,1,0,2}, {14723,1,0,2}, {14731,1,0,10}, {14737,1,0,10},
   {14741,1,0,2}, {14747,1,0,2}, {14753,1,0,3}, {14759,1,0,17}, {14767,1,0,3},
   {14771,1,0,2}, {14779,1,0,3}, {14783,1,0,5}, {14797,1,0,2}, {14813,1,0,2},
   {14821,1,0,2}, {14827,1,0,2}, {14831,1,0,11}, {14843,1,0,2}, {14851,1,0,2},
   {14867,1,0,2}, {14869,1,0,2}, {14879,1,0,7}, {14887,1,0,3}, {14891,1,0,2},
   {14897,1,0,3}, {14923,1,0,2}, {14929,1,0,7}, {14939,1,0,2}, {14947,1,0,2},
   {14951,1,0,19}, {14957,1,0,2}, {14969,1,0,3}, {14983,1,0,3}, {15013,1,0,2},
   {15017,1,0,3}, {15031,1,0,3}, {15053,1,0,2}, {15061,1,0,2}, {15073,1,0,5},
   {15077,1,0,2}, {15083,1,0,2}, {15091,1,0,2}, {15101,1,0,2}, {15107,1,0,2},
   {15121,1,0,11}, {15131,1,0,2}, {15137,1,0,3}, {15139,1,0,2}, {15149,1,0,2},
   {15161,1,0,3}, {15173,1,0,2}, {15187,1,0,2}, {15193,1,0,5}, {15199,1,0,6},
   {15217,1,0,10}, {15227,1,0,2}, {15233,1,0,3}, {15241,1,0,11}, {15259,1,0,2},
   {15263,1,0,5}, {15269,1,0,2}, {15271,1,0,11}, {15277,1,0,6}, {15287,1,0,5},
   {15289,1,0,11}, {15299,1,0,2}, {15307,1,0,3}, {15313,1,0,5}, {15319,1,0,3},
   {15329,1,0,3}, {15331,1,0,2}, {15349,1,0,2}, {15359,1,0,11}, {15361,1,0,7},
   {15373,1,0,2}, {15377,1,0,3}, {15383,1,0,5}, {15391,1,0,12}, {15401,1,0,6},
   {15413,1,0,2}, {15427,1,0,2}, {15439,1,0,3}, {15443,1,0,2}, {15451,1,0,3},
   {15461,1,0,2}, {15467,1,0,5}, {15473,1,0,3}, {15493,1,0,5}, {15497,1,0,3},
   {15511,1,0,3}, {15527,1,0,5}, {15541,1,0,6}, {15551,1,0,7}, {15559,1,0,3},
   {15569,1,0,3}, {15581,1,0,2}, {15583,1,0,5}, {15601,1,0,23}, {15607,1,0,3},
   {15619,1,0,7}, {15629,1,0,2}, {15641,1,0,3}, {15643,1,0,5}, {15647,1,0,5},
   {15649,1,0,11}, {15661,1,0,2}, {15667,1,0,2}, {15671,1,0,13}, {15679,1,0,11},
   {15683,1,0,2}, {15727,1,0,3}, {15731,1,0,2}, {15733,1,0,6}, {15737,1,0,3},
   {15739,1,0,2}, {15749,1,0,2}, {15761,1,0,3}, {15767,1,0,5}, {15773,1,0,2},
   {15787,1,0,2}, {15791,1,0,29}, {15797,1,0,2}, {15803,1,0,2}, {15809,1,0,3},
   {15817,1,0,5}, {15823,1,0,3}, {15859,1,0,2}, {15877,1,0,5}, {15881,1,0,3},
   {15887,1,0,5}, {15889,1,0,21}, {15901,1,0,10}, {15907,1,0,2}, {15913,1,0,5},
   {15919,1,0,6}, {15923,1,0,2}, {15937,1,0,7}, {15959,1,0,11}, {15971,1,0,2},
   {15973,1,0,7}, {15991,1,0,12}, {16001,1,0,3}, {16007,1,0,5}, {16033,1,0,5},
   {16057,1,0,7}, {16061,1,0,12}, {16063,1,0,5}, {16067,1,0,2}, {16069,1,0,2},
   {16073,1,0,3}, {16087,1,0,5}, {16091,1,0,6}, {16097,1,0,3}, {16103,1,0,5},
   {16111,1,0,7}, {16127,1,0,5}, {16139,1,0,2}, {16141,1,0,6}, {16183,1,0,3},
   {16187,1,0,2}, {16189,1,0,2}, {16193,1,0,5}, {16217,1,0,3}, {16223,1,0,5},
   {16229,1,0,2}, {16231,1,0,3}, {16249,1,0,17}, {16253,1,0,2}, {16267,1,0,3},
   {16273,1,0,7}, {16301,1,0,2}, {16319,1,0,7}, {16333,1,0,2}, {16339,1,0,2},
   {16349,1,0,2}, {16361,1,0,3}, {16363,1,0,2}, {16369,1,0,7}, {16381,1,0,2},
   };
   
   void dec_um(int p,int a,UM u)
 {  {
         int i;          int i;
   
Line 80  UM u;
Line 491  UM u;
  * current_gfs_iton[p-1] = 0   * current_gfs_iton[p-1] = 0
  */   */
   
 void setmod_sf(p,n)  void setmod_sf(int p,int n)
 int p,n;  
 {  {
         int r,i,q1,q,t,t1;          int r,i,q1,q,t,t1;
         UM dp;          UM dp;
   
           if ( p >= SF_THRESHOLD ) {
                   if ( n > 1 )
                           error("setmod_ff : p^n is too large");
                   current_gfs_p = p;
                   current_gfs_q = p;
                   current_gfs_q1 = p-1;
                   current_gfs_ext = 0;
                   current_gfs_ntoi = 0;
                   current_gfs_iton = 0;
                   current_gfs_plus1 = 0;
                   return;
           }
   
         for ( i = 0, q = 1; i < n; i++ )          for ( i = 0, q = 1; i < n; i++ )
                 q *= p;                  q *= p;
         dp = UMALLOC(n);          dp = UMALLOC(n);
         generate_defpoly_um(p,n,dp);          r = search_defpoly_and_primitive_root(p,n,dp);
         r = generate_primitive_root_enc(p,n,dp);          if ( !r ) {
                   generate_defpoly_um(p,n,dp);
                   r = generate_primitive_root_enc(p,n,dp);
                   if ( !r )
                           error("setmod_sf : primitive root not found");
           }
         current_gfs_p = p;          current_gfs_p = p;
         current_gfs_q = q;          current_gfs_q = q;
         current_gfs_q1 = q1 = q-1;          current_gfs_q1 = q1 = q-1;
Line 117  int p,n;
Line 545  int p,n;
         }          }
 }  }
   
 void generate_defpoly_um(p,n,dp)  int search_defpoly_and_primitive_root(int p,int n,UM dp)
 int p,n;  
 UM dp;  
 {  {
         int i,j,a,c,q;          int l,min,max,mid,p1,i,ind,t;
   
           l = sizeof(prim_root_info_tab)/sizeof(struct prim_root_info);
           min = 0; max = l-1;
           ind = -1;
           while ( max - min > 1 ) {
                   mid = (max+min)/2;
                   p1 = prim_root_info_tab[mid].p;
                   if ( p1 == p ) {
                           ind = mid; break;
                   } else if ( p1 > p )
                           max = mid;
                   else
                           min = mid;
           }
           if ( ind < 0 ) {
                   if ( prim_root_info_tab[min].p == p )
                           ind = min;
                   else if ( prim_root_info_tab[max].p == p )
                           ind = max;
                   else
                           return 0; /* XXX */
           }
           /* now prim_root_info_tab[ind].p = p */
           t = ind - (prim_root_info_tab[ind].extdeg-1);
           /* now prim_root_info_tab[t].extdeg = 1 */
           for ( i = t; prim_root_info_tab[i].p == p; i++ )
                   if ( prim_root_info_tab[i].extdeg == n )
                           break;
           if ( prim_root_info_tab[i].p != p )
                   return 0;
           dec_um(p,prim_root_info_tab[i].defpoly,dp);
           return prim_root_info_tab[i].prim_root;
   }
   
   void generate_defpoly_um(int p,int n,UM dp)
   {
           int i,j,a,q;
         UM wf,wdf,wgcd;          UM wf,wdf,wgcd;
   
         wf = W_UMALLOC(n);          wf = W_UMALLOC(n);
Line 147  UM dp;
Line 610  UM dp;
         }          }
 }  }
   
 int generate_primitive_root_enc(p,n,dp)  int generate_primitive_root_enc(int p,int n,UM dp)
 int p,n;  
 UM dp;  
 {  {
         int i,r,rj,j,q;          int i,r,rj,j,q;
   
Line 165  UM dp;
Line 626  UM dp;
                 if ( j == q-1 )                  if ( j == q-1 )
                         return r;                          return r;
         }          }
           /* not found */
           return 0;
 }  }
   
 /* [a(p)]*[b(p)] in GF(p^n) -> [a(x)*b(x) mod dp(x)]_{x->p} */  /* [a(p)]*[b(p)] in GF(p^n) -> [a(x)*b(x) mod dp(x)]_{x->p} */
   
 int mulremum_enc(p,n,dp,a,b)  int mulremum_enc(int p,int n,UM dp,int a,int b)
 int p,n;  
 UM dp;  
 int a,b;  
 {  {
         int i,dr,r;          int i,dr,r;
         UM wa,wb,wc,wq;          UM wa,wb,wc,wq;
Line 197  int a,b;
Line 657  int a,b;
         return r;          return r;
 }  }
   
 void gfs_galois_action(a,e,c)  /* sigma : alpha -> alpha^q */
 GFS a;  
 Q e;  void gfs_galois_action(GFS a,Q e,GFS *c)
 GFS *c;  
 {  {
         Q p;          Q p;
         int i,k;          int i,k;
Line 215  GFS *c;
Line 674  GFS *c;
         *c = t;          *c = t;
 }  }
   
 void qtogfs(a,c)  /* GF(pn)={0,1,a,a^2,...} -> GF(pm)={0,1,b,b^2,...}; a->b^k */
 Q a;  
 GFS *c;  void gfs_embed(GFS z,int k,int pm,GFS *c)
 {  {
           int t;
   
           if ( !z )
                   *c = 0;
           else {
                   t = dmar(k,CONT(z),0,pm-1);
                   MKGFS(t,*c);
           }
   }
   
   /* 0 <= index <= q-1 */
   
   void indextogfs(int index, GFS *c)
   {
           if ( index == 0 )
                   *c = 0;
           else if ( index >= current_gfs_q )
                   error("indextogfs : exhausted");
           else if ( !current_gfs_ntoi ) {
                   MKGFS(index,*c);
           } else {
                   MKGFS(index-1,*c);
           }
   }
   
   void itogfs(int n, GFS *c)
   {
           n = _itosf(n);
           if ( !n )
                   *c = 0;
           else {
                   n = IFTOF(n);
                   MKGFS(n,*c);
           }
   }
   
   void iftogfs(int n, GFS *c)
   {
           if ( !n )
                   *c = 0;
           else {
                   MKGFS(IFTOF(n),*c);
           }
   }
   
   void qtogfs(Q a,GFS *c)
   {
         int s;          int s;
   
           if ( a && (SGN(a) < 1) )
                   error("qtogfs : invalid argument");
         s = QTOS(a)%current_gfs_q;          s = QTOS(a)%current_gfs_q;
         if ( s < 0 )          itogfs(s,c);
                 s += current_gfs_q;  }
         if ( !s )  
   void mqtogfs(MQ a,GFS *c)
   {
           if ( !a )
                 *c = 0;                  *c = 0;
         else          else
                 MKGFS(current_gfs_ntoi[s],*c);                  itogfs(CONT(a),c);
 }  }
   
 void mqtogfs(a,c)  void gfstomq(GFS a,MQ *c)
 MQ a;  
 GFS *c;  
 {  {
         if ( !a )          if ( !a )
                 *c = 0;                  *c = 0;
         else {          else if ( !current_gfs_ntoi ) {
                 MKGFS(current_gfs_ntoi[CONT(a)],*c);                  UTOMQ(CONT(a),*c);
           } else {
                   UTOMQ(current_gfs_iton[CONT(a)],*c);
         }          }
 }  }
   
 void gfstomq(a,c)  void gfstopgfs(GFS a,V v,P *c)
 GFS a;  
 MQ *c;  
 {  {
           MQ t;
           Q q;
   
         if ( !a )          if ( !a )
                 *c = 0;                  *c = 0;
         else {          else if ( !current_gfs_ntoi ) {
                 UTOMQ(current_gfs_iton[CONT(a)],*c);                  UTOMQ(CONT(a),t);
         }                  STOQ(CONT(t),q);
                   *c = (P)q;
           } else
                   enc_to_p(current_gfs_p,current_gfs_iton[CONT(a)],v,c);
 }  }
   
 void ntogfs(a,b)  void ntogfs(Obj a,GFS *b)
 Obj a;  
 GFS *b;  
 {  {
         P t;          P t;
   
Line 263  GFS *b;
Line 776  GFS *b;
         if ( !a || (OID(a)==O_N && NID(a) == N_GFS) )          if ( !a || (OID(a)==O_N && NID(a) == N_GFS) )
                 *b = (GFS)a;                  *b = (GFS)a;
         else if ( OID(a) == O_N && NID(a) == N_M )          else if ( OID(a) == O_N && NID(a) == N_M )
                 mqtogfs(a,b);                  mqtogfs((MQ)a,b);
         else if ( OID(a) == O_N && NID(a) == N_Q ) {          else if ( OID(a) == O_N && NID(a) == N_Q ) {
                 ptomp(current_gfs_p,(P)a,&t); mqtogfs(t,b);                  ptomp(current_gfs_p,(P)a,&t); mqtogfs((MQ)t,b);
         } else          } else
                 error("ntogfs : invalid argument");                  error("ntogfs : invalid argument");
 }  }
   
 void addgfs(a,b,c)  void addgfs(GFS a,GFS b,GFS *c)
 GFS a,b;  
 GFS *c;  
 {  {
         int ai,bi,ci;          int ai,bi,ci;
         GFS z;          GFS z;
   
         ntogfs(a,&z); a = z;          ntogfs((Obj)a,&z); a = z;
         ntogfs(b,&z); b = z;          ntogfs((Obj)b,&z); b = z;
         if ( !a )          if ( !a )
                 *c = b;                  *c = b;
         else if ( !b )          else if ( !b )
                 *c = a;                  *c = a;
         else {          else if ( !current_gfs_ntoi ) {
                 ai = CONT(a); bi = CONT(b);                  ai = CONT(a); bi = CONT(b);
                   ci = ai+bi-current_gfs_q;
                   if ( ci == 0 )
                           *c = 0;
                   else {
                           if ( ci < 0 )
                                   ci += current_gfs_q;
                           MKGFS(ci,*c);
                   }
           } else {
                   ai = CONT(a); bi = CONT(b);
                 if ( ai > bi ) {                  if ( ai > bi ) {
                         /* tab[ai]+tab[bi] = tab[bi](tab[ai-bi]+1) */                          /* tab[ai]+tab[bi] = tab[bi](tab[ai-bi]+1) */
                         ci = current_gfs_plus1[ai-bi];                          ci = current_gfs_plus1[ai-bi];
Line 311  GFS *c;
Line 832  GFS *c;
         }          }
 }  }
   
 void subgfs(a,b,c)  void subgfs(GFS a,GFS b,GFS *c)
 GFS a,b;  
 GFS *c;  
 {  {
         GFS t,z;          GFS t,z;
   
         ntogfs(a,&z); a = z;          ntogfs((Obj)a,&z); a = z;
         ntogfs(b,&z); b = z;          ntogfs((Obj)b,&z); b = z;
         if ( !b )          if ( !b )
                 *c = a;                  *c = a;
         else {          else {
Line 327  GFS *c;
Line 846  GFS *c;
         }          }
 }  }
   
 void mulgfs(a,b,c)  void mulgfs(GFS a,GFS b,GFS *c)
 GFS a,b;  
 GFS *c;  
 {  {
         int ai;          int ai,bi,ci;
         GFS z;          GFS z;
   
         ntogfs(a,&z); a = z;          ntogfs((Obj)a,&z); a = z;
         ntogfs(b,&z); b = z;          ntogfs((Obj)b,&z); b = z;
         if ( !a || !b )          if ( !a || !b )
                 *c = 0;                  *c = 0;
         else {          else if ( !current_gfs_ntoi ) {
                   ai = CONT(a); bi = CONT(b);
                   DMAR(ai,bi,0,current_gfs_q,ci);
                   MKGFS(ci,*c);
           } else {
                 ai = CONT(a) + CONT(b);                  ai = CONT(a) + CONT(b);
                 if ( ai >= current_gfs_q1 )                  if ( ai >= current_gfs_q1 )
                         ai -= current_gfs_q1;                          ai -= current_gfs_q1;
Line 346  GFS *c;
Line 867  GFS *c;
         }          }
 }  }
   
 void divgfs(a,b,c)  void divgfs(GFS a,GFS b,GFS *c)
 GFS a,b;  
 GFS *c;  
 {  {
         int ai;          int ai,bi,ci;
         GFS z;          GFS z;
   
         ntogfs(a,&z); a = z;          ntogfs((Obj)a,&z); a = z;
         ntogfs(b,&z); b = z;          ntogfs((Obj)b,&z); b = z;
         if ( !b )          if ( !b )
                 error("divgfs : division by 0");                  error("divgfs : division by 0");
         else if ( !a )          else if ( !a )
                 *c = 0;                  *c = 0;
         else {          else if ( !current_gfs_ntoi ) {
                   ai = CONT(a); bi = invm(CONT(b),current_gfs_q);
                   DMAR(ai,bi,0,current_gfs_q,ci);
                   MKGFS(ci,*c);
           } else {
                 ai = CONT(a) - CONT(b);                  ai = CONT(a) - CONT(b);
                 if ( ai < 0 )                  if ( ai < 0 )
                         ai += current_gfs_q1;                          ai += current_gfs_q1;
Line 367  GFS *c;
Line 890  GFS *c;
         }          }
 }  }
   
 void chsgngfs(a,c)  void chsgngfs(GFS a,GFS *c)
 GFS a,*c;  
 {  {
         int ai;          int ai;
         GFS z;          GFS z;
   
         ntogfs(a,&z); a = z;          ntogfs((Obj)a,&z); a = z;
         if ( !a )          if ( !a )
                 *c = 0;                  *c = 0;
         else if ( current_gfs_q1&1 )          else if ( !current_gfs_ntoi ) {
                   ai = current_gfs_q - CONT(a);
                   MKGFS(ai,*c);
           } else if ( current_gfs_q1&1 )
                 *c = a;                  *c = a;
         else {          else {
                 /* r^((q-1)/2) = -1 */                  /* r^((q-1)/2) = -1 */
Line 387  GFS a,*c;
Line 912  GFS a,*c;
         }          }
 }  }
   
 void pwrgfs(a,b,c)  void pwrgfs(GFS a,Q b,GFS *c)
 GFS a;  
 Q b;  
 GFS *c;  
 {  {
         N an,tn,rn;          N an,tn,rn;
         GFS t,s,z;          GFS t,s,z;
           int ai;
   
         ntogfs(a,&z); a = z;          ntogfs((Obj)a,&z); a = z;
         if ( !b )          if ( !b )
                 MKGFS(0,*c);                  itogfs(1,c);
         else if ( !a )          else if ( !a )
                 *c = 0;                  *c = 0;
         else {          else if ( !current_gfs_ntoi) {
                   ai = pwrm(current_gfs_q,CONT(a),QTOS(b));
                   MKGFS(ai,*c);
           } else {
                 STON(CONT(a),an); muln(an,NM(b),&tn);                  STON(CONT(a),an); muln(an,NM(b),&tn);
                 STON(current_gfs_q1,an); remn(tn,an,&rn);                  STON(current_gfs_q1,an); remn(tn,an,&rn);
                 if ( !rn )                  if ( !rn )
                         MKGFS(0,*c);                          itogfs(1,c);
                 else if ( SGN(b) > 0 )                  else if ( SGN(b) > 0 )
                         MKGFS(BD(rn)[0],*c);                          MKGFS(BD(rn)[0],*c);
                 else {                  else {
                         MKGFS(0,t);                          itogfs(1,&t);
                         MKGFS(BD(rn)[0],s);                          MKGFS(BD(rn)[0],s);
                         divgfs(t,s,c);                          divgfs(t,s,c);
                 }                  }
         }          }
 }  }
   
 int cmpgfs(a,b)  int cmpgfs(GFS a,GFS b)
 GFS a,b;  
 {  {
         GFS z;          GFS z;
   
         ntogfs(a,&z); a = z;          ntogfs((Obj)a,&z); a = z;
         if ( !a )          if ( !a )
                 return !b ? 0 : -1;                  return !b ? 0 : -1;
         else          else
Line 436  GFS a,b;
Line 961  GFS a,b;
                 }                  }
 }  }
   
 void randomgfs(r)  void pthrootgfs(GFS a,GFS *b)
 GFS *r;  
 {  {
           Q p;
           int e,i;
           GFS t,s;
   
           STOQ(characteristic_sf(),p);
           e = extdeg_sf()-1;
           t = a;
           for ( i = 0; i < e; i++ ) {
                   pwrgfs(t,p,&s); t = s;
           }
           *b = t;
   }
   
   void randomgfs(GFS *r)
   {
         unsigned int t;          unsigned int t;
   
         if ( !current_gfs_q1 )          if ( !current_gfs_q1 )
                 error("addgfs : current_gfs_q is not set");                  error("addgfs : current_gfs_q is not set");
         t = mt_genrand()%current_gfs_q;          t = mt_genrand()%current_gfs_q;
         if ( !t )          indextogfs(t,r);
                 *r = 0;  }
   
   /* arithmetic operations for 'immediate values of GFS */
   
   int _addsf(int a,int b)
   {
           if ( !a )
                   return b;
           else if ( !b )
                   return a;
   
           a = IFTOF(a); b = IFTOF(b);
   
           if ( !current_gfs_ntoi ) {
                   a = a+b-current_gfs_q;
                   if ( a == 0 )
                           return 0;
                   else {
                           if ( a < 0 )
                                   a += current_gfs_q;
                           return FTOIF(a);
                   }
           }
   
           if ( a > b ) {
                   /* tab[a]+tab[b] = tab[b](tab[a-b]+1) */
                   a = current_gfs_plus1[a-b];
                   if ( a < 0 )
                           return 0;
                   else {
                           a += b;
                           if ( a >= current_gfs_q1 )
                                   a -= current_gfs_q1;
                           return FTOIF(a);
                   }
           } else {
                   /* tab[a]+tab[b] = tab[a](tab[b-a]+1) */
                   b = current_gfs_plus1[b-a];
                   if ( b < 0 )
                           return 0;
                   else {
                           b += a;
                           if ( b >= current_gfs_q1 )
                                   b -= current_gfs_q1;
                           return FTOIF(b);
                   }
           }
   }
   
   int _chsgnsf(int a)
   {
           if ( !a )
                   return 0;
           else if ( !current_gfs_ntoi ) {
                   a = current_gfs_q-IFTOF(a);
                   return FTOIF(a);
           } else if ( current_gfs_q1&1 )
                   return a;
           else {
                   /* r^((q-1)/2) = -1 */
                   a = IFTOF(a);
                   a += (current_gfs_q1>>1);
                   if ( a >= current_gfs_q1 )
                           a -= current_gfs_q1;
                   return FTOIF(a);
           }
   }
   
   int _subsf(int a,int b)
   {
           if ( !a )
                   return _chsgnsf(b);
           else if ( !b )
                   return a;
           else
                   return _addsf(a,_chsgnsf(b));
   }
   
   int _mulsf(int a,int b)
   {
           int c;
   
           if ( !a || !b )
                   return 0;
           else if ( !current_gfs_ntoi ) {
                   a = IFTOF(a); b = IFTOF(b);
                   DMAR(a,b,0,current_gfs_q,c);
                   return FTOIF(c);
           } else {
                   a = IFTOF(a) + IFTOF(b);
                   if ( a >= current_gfs_q1 )
                           a -= current_gfs_q1;
                   return FTOIF(a);
           }
   }
   
   int _invsf(int a)
   {
           if ( !a ) {
                   error("_invsf : division by 0");
                   /* NOTREACHED */
                   return -1;
           } else if ( !current_gfs_ntoi ) {
                   a = invm(IFTOF(a),current_gfs_q);
                   return FTOIF(a);
           } else {
                   a = current_gfs_q1 - IFTOF(a);
                   return FTOIF(a);
           }
   }
   
   int _divsf(int a,int b)
   {
           int c;
   
           if ( !b ) {
                   error("_divsf : division by 0");
                   /* NOTREACHED */
                   return -1;
           } else if ( !current_gfs_ntoi ) {
                   b = invm(IFTOF(b),current_gfs_q);
                   a = IFTOF(a);
                   DMAR(a,b,0,current_gfs_q,c);
                   return FTOIF(c);
           } else if ( !a )
                   return 0;
         else {          else {
                 if ( t == current_gfs_q1 )                  a = IFTOF(a) - IFTOF(b);
                         t = 0;                  if ( a < 0 )
                 MKGFS(t,*r);                          a += current_gfs_q1;
                   return FTOIF(a);
         }          }
   }
   
   int _pwrsf(int a,int b)
   {
           GFS at,ct;
           Q bt;
           int c;
   
           if ( !b )
                   return _onesf();
           else if ( !a )
                   return 0;
           if ( !current_gfs_ntoi ) {
                   a = pwrm(current_gfs_q,IFTOF(a),b);
                   return FTOIF(a);
           } else {
                   iftogfs(a,&at);
                   STOQ(b,bt);
                   pwrgfs(at,bt,&ct);
                   c = CONT(ct);
                   return FTOIF(c);
           }
   }
   
   int _onesf()
   {
           return !current_gfs_ntoi ? FTOIF(1) : FTOIF(0);
   }
   
   int _itosf(int n)
   {
           int i;
   
           /* XXX */
   #if 0
           n %= current_gfs_p;
   #else
           n %= current_gfs_q;
   #endif
           if ( !n )
                   return 0;
           i = !current_gfs_ntoi ? n : current_gfs_ntoi[n];
           i = FTOIF(i);
           if ( n < 0 )
                   i = _chsgnsf(i);
           return i;
   }
   
   int _isonesf(int a)
   {
           return a == _onesf();
   }
   
   int _randomsf()
   {
           int t;
   
           t = (int) (mt_genrand() % current_gfs_q);
           if ( !current_gfs_ntoi )
                   return t ? FTOIF(t) : 0;
           else
                   return t!=current_gfs_q1 ? FTOIF(t) : 0;
   }
   
   int field_order_sf()
   {
           return current_gfs_q;
   }
   
   int characteristic_sf()
   {
           return current_gfs_p;
   }
   
   int extdeg_sf()
   {
           if ( !current_gfs_ext )
                   return 1;
           else
                   return UDEG(current_gfs_ext);
 }  }

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.17

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>