/******************************************************************************
*									      *
*  PRIME LOOK-UP TABLE							      *
*  01/30/99 (dkc)							      *
*									      *
*  This table consists of primes of the form p**2*k+1 for p=3.	The least     *
*  residue table is modulus p**2.					      *
*									      *
******************************************************************************/
unsigned int error[10];
unsigned int count;
unsigned int d;
unsigned int e;
unsigned int output[2001*4];

unsigned short residue[2]={1,8};

unsigned int recip[10*2]={
   0x55555556, 0x00000003,
   0x33333334, 0x00000005,
   0x24924925, 0x00000007,
   0x1745d175, 0x0000000b,
   0x13b13b14, 0x0000000d,
   0x0f0f0f10, 0x00000011,
   0x0d79435f, 0x00000013,
   0x0b21642d, 0x00000017,
   0x08d3dcb1, 0x0000001d,
   0x08421085, 0x0000001f};

unsigned int recip1[3]={
   0x55555556,	   // 1/3
   0x1c71c71d,	   // 1/9
   0x2aaaaaab};    // 1/6

unsigned int table3[848]={
       0x13, 
       0x25, 
       0x49, 
       0x6d, 
       0x7f, 
       0xa3, 
       0xb5, 
       0xc7, 
      0x10f, 
      0x133, 
      0x17b, 
      0x18d, 
      0x1b1, 
      0x1e7, 
      0x20b, 
      0x21d, 
      0x241, 
      0x265, 
      0x277, 
      0x2e3, 
      0x2f5, 
      0x32b, 
      0x33d, 
      0x373, 
      0x397, 
      0x3a9, 
      0x3df, 
      0x3f1, 
      0x427, 
      0x45d, 
      0x481, 
      0x493, 
      0x4ff, 
      0x511, 
      0x58f, 
      0x5b3, 
      0x5fb, 
      0x60d, 
      0x61f, 
      0x655, 
      0x679, 
      0x69d, 
      0x6d3, 
      0x6f7, 
      0x709, 
      0x751, 
      0x7cf, 
      0x7e1, 
      0x805, 
      0x829, 
      0x85f, 
      0x871, 
      0x883, 
      0x8cb, 
      0x8dd, 
      0x8ef, 
      0x925, 
      0x949, 
      0x9a3, 
      0x9c7, 
      0x9d9, 
      0x9eb, 
      0x9fd, 
      0xa21, 
      0xa57, 
      0xa7b, 
      0xa9f, 
      0xae7, 
      0xb65, 
      0xb89, 
      0xb9b, 
      0xbf5, 
      0xc07, 
      0xc61, 
      0xc73, 
      0xcbb, 
      0xcf1, 
      0xd03, 
      0xd81, 
      0xdb7, 
      0xdc9, 
      0xddb, 
      0xdff, 
      0xe35, 
      0xe59, 
      0xe6b, 
      0xe7d, 
      0xe8f, 
      0xf0d, 
      0xf31, 
      0xf43, 
      0xf67, 
      0xfd3, 
     0x103f, 
     0x1051, 
     0x1087, 
     0x10f3, 
     0x1105, 
     0x115f, 
     0x1183, 
     0x11a7, 
     0x11ef, 
     0x1237, 
     0x12b5, 
     0x12fd, 
     0x1345, 
     0x1357, 
     0x1369, 
     0x137b, 
     0x139f, 
     0x13c3, 
     0x13d5, 
     0x13f9, 
     0x142f, 
     0x14e3, 
     0x152b, 
     0x153d, 
     0x1597, 
     0x15bb, 
     0x15cd, 
     0x1615, 
     0x1639, 
     0x166f, 
     0x1693, 
     0x16db, 
     0x16ed, 
     0x1723, 
     0x17b3, 
     0x17e9, 
     0x1843, 
     0x1855, 
     0x1867, 
     0x189d, 
     0x18c1, 
     0x18e5, 
     0x191b, 
     0x1951, 
     0x1999, 
     0x19ab, 
     0x19cf, 
     0x1a05, 
     0x1a17, 
     0x1a4d, 
     0x1aa7, 
     0x1ab9, 
     0x1b25, 
     0x1b37, 
     0x1b7f, 
     0x1b91, 
     0x1bd9, 
     0x1c33, 
     0x1c45, 
     0x1c8d, 
     0x1cf9, 
     0x1d41, 
     0x1d53, 
     0x1d89, 
     0x1df5, 
     0x1e07, 
     0x1e2b, 
     0x1e3d, 
     0x1e4f, 
     0x1ebb, 
     0x1f39, 
     0x1f4b, 
     0x1fa5, 
     0x1fff, 
     0x2011, 
     0x2047, 
     0x207d, 
     0x20a1, 
     0x20c5, 
     0x20fb, 
     0x210d, 
     0x21af, 
     0x21c1, 
     0x21e5, 
     0x2209, 
     0x221b, 
     0x2263, 
     0x2275, 
     0x2287, 
     0x22bd, 
     0x22e1, 
     0x2329, 
     0x2383, 
     0x2395, 
     0x23a7, 
     0x23dd, 
     0x23ef, 
     0x247f, 
     0x24b5, 
     0x24d9, 
     0x258d, 
     0x259f, 
     0x25b1, 
     0x25f9, 
     0x260b, 
     0x2653, 
     0x2665, 
     0x269b, 
     0x26ad, 
     0x26f5, 
     0x2719, 
     0x2773, 
     0x2803, 
     0x285d, 
     0x2881, 
     0x28db, 
     0x28ed, 
     0x2911, 
     0x2923, 
     0x2947, 
     0x298f, 
     0x29a1, 
     0x29d7, 
     0x29e9, 
     0x2a55, 
     0x2a8b, 
     0x2a9d, 
     0x2b3f, 
     0x2b99, 
     0x2bbd, 
     0x2bf3, 
     0x2c17, 
     0x2ccb, 
     0x2cef, 
     0x2d49, 
     0x2db5, 
     0x2dc7, 
     0x2e33, 
     0x2e57, 
     0x2eb1, 
     0x2ec3, 
     0x2ee7, 
     0x2f0b, 
     0x2f41, 
     0x2fd1, 
     0x2ff5, 
     0x3085, 
     0x30a9, 
     0x30df, 
     0x3103, 
     0x3127, 
     0x3139, 
     0x314b, 
     0x315d, 
     0x31db, 
     0x31ed, 
     0x31ff, 
     0x3235, 
     0x3259, 
     0x326b, 
     0x32b3, 
     0x32e9, 
     0x3367, 
     0x3379, 
     0x33c1, 
     0x33d3, 
     0x341b, 
     0x3463, 
     0x34e1, 
     0x3517, 
     0x353b, 
     0x3571, 
     0x35dd, 
     0x35ef, 
     0x3637, 
     0x366d, 
     0x3745, 
     0x378d, 
     0x37d5, 
     0x380b, 
     0x3841, 
     0x3853, 
     0x3865, 
     0x38e3, 
     0x393d, 
     0x39bb, 
     0x39cd, 
     0x3a03, 
     0x3a15, 
     0x3a27, 
     0x3a4b, 
     0x3aa5, 
     0x3ab7, 
     0x3b11, 
     0x3b23, 
     0x3b59, 
     0x3bd7, 
     0x3c0d, 
     0x3c1f, 
     0x3c43, 
     0x3cf7, 
     0x3d1b, 
     0x3d2d, 
     0x3d3f, 
     0x3d75, 
     0x3dab, 
     0x3dcf, 
     0x3df3, 
     0x3e05, 
     0x3e29, 
     0x3eb9, 
     0x3eef, 
     0x3f37, 
     0x3f91, 
     0x3feb, 
     0x3ffd, 
     0x4021, 
     0x4045, 
     0x40b1, 
     0x40f9, 
     0x410b, 
     0x4165, 
     0x4177, 
     0x41bf, 
     0x4207, 
     0x4219, 
     0x4261, 
     0x4273, 
     0x4285, 
     0x4297, 
     0x42f1, 
     0x4327, 
     0x4339, 
     0x4393, 
     0x43a5, 
     0x43ed, 
     0x4423, 
     0x4459, 
     0x448f, 
     0x44a1, 
     0x44d7, 
     0x44fb, 
     0x4531, 
     0x4555, 
     0x45af, 
     0x45f7, 
     0x4609, 
     0x46cf, 
     0x4705, 
     0x4717, 
     0x4729, 
     0x474d, 
     0x4771, 
     0x4783, 
     0x47cb, 
     0x47dd, 
     0x4801, 
     0x4813, 
     0x485b, 
     0x486d, 
     0x4945, 
     0x4969, 
     0x49e7, 
     0x4a1d, 
     0x4a41, 
     0x4a89, 
     0x4b07, 
     0x4b85, 
     0x4bbb, 
     0x4bdf, 
     0x4bf1, 
     0x4c15, 
     0x4c4b, 
     0x4c93, 
     0x4d59, 
     0x4d6b, 
     0x4db3, 
     0x4dd7, 
     0x4dfb, 
     0x4e67, 
     0x4e79, 
     0x4e8b, 
     0x4eaf, 
     0x4ec1, 
     0x4f09, 
     0x4f2d, 
     0x4f3f, 
     0x4f63, 
     0x4f75, 
     0x4f87, 
     0x4fcf, 
     0x5029, 
     0x5071, 
     0x5083, 
     0x50ef, 
     0x5125, 
     0x5149, 
     0x51a3, 
     0x5245, 
     0x52b1, 
     0x52c3, 
     0x531d, 
     0x5341, 
     0x53f5, 
     0x5419, 
     0x5461, 
     0x54a9, 
     0x54df, 
     0x5527, 
     0x5539, 
     0x556f, 
     0x55b7, 
     0x55c9, 
     0x55ed, 
     0x5623, 
     0x566b, 
     0x568f, 
     0x571f, 
     0x57af, 
     0x57d3, 
     0x57e5, 
     0x582d, 
     0x58ab, 
     0x58bd, 
     0x5917, 
     0x594d, 
     0x5a01, 
     0x5a13, 
     0x5a5b, 
     0x5a7f, 
     0x5aa3, 
     0x5afd, 
     0x5b0f, 
     0x5bb1, 
     0x5bd5, 
     0x5c0b, 
     0x5c1d, 
     0x5c2f, 
     0x5c77, 
     0x5c89, 
     0x5cbf, 
     0x5cd1, 
     0x5d19, 
     0x5d3d, 
     0x5d4f, 
     0x5da9, 
     0x5df1, 
     0x5e27, 
     0x5e39, 
     0x5ea5, 
     0x5eb7, 
     0x5f11, 
     0x5f35, 
     0x5f47, 
     0x5fa1, 
     0x5fb3, 
     0x5fc5, 
     0x5ffb, 
     0x6079, 
     0x609d, 
     0x6109, 
     0x611b, 
     0x612d, 
     0x6187, 
     0x61e1, 
     0x6217, 
     0x623b, 
     0x625f, 
     0x6283, 
     0x6295, 
     0x62dd, 
     0x636d, 
     0x637f, 
     0x63d9, 
     0x63eb, 
     0x6421, 
     0x648d, 
     0x649f, 
     0x64f9, 
     0x650b, 
     0x652f, 
     0x6553, 
     0x65ad, 
     0x65e3, 
     0x6607, 
     0x6661, 
     0x6673, 
     0x6697, 
     0x66cd, 
     0x6703, 
     0x6727, 
     0x676f, 
     0x6781, 
     0x6811, 
     0x6859, 
     0x686b, 
     0x68c5, 
     0x68d7, 
     0x690d, 
     0x6943, 
     0x69c1, 
     0x69d3, 
     0x69e5, 
     0x69f7, 
     0x6a75, 
     0x6a87, 
     0x6ae1, 
     0x6b05, 
     0x6b5f, 
     0x6b95, 
     0x6bef, 
     0x6c5b, 
     0x6c91, 
     0x6cc7, 
     0x6ceb, 
     0x6cfd, 
     0x6d0f, 
     0x6d7b, 
     0x6db1, 
     0x6dc3, 
     0x6e77, 
     0x6e89, 
     0x6ebf, 
     0x6ee3, 
     0x6f3d, 
     0x6f61, 
     0x6f85, 
     0x6fbb, 
     0x6fcd, 
     0x6ff1, 
     0x7027, 
     0x7039, 
     0x70a5, 
     0x70ed, 
     0x70ff, 
     0x7159, 
     0x71fb, 
     0x7243, 
     0x7255, 
     0x7267, 
     0x73ab, 
     0x73bd, 
     0x73f3, 
     0x74a7, 
     0x74b9, 
     0x74dd, 
     0x7525, 
     0x7591, 
     0x75b5, 
     0x75d9, 
     0x75eb, 
     0x760f, 
     0x7621, 
     0x7633, 
     0x7669, 
     0x769f, 
     0x76c3, 
     0x771d, 
     0x7741, 
     0x77ad, 
     0x7807, 
     0x782b, 
     0x783d, 
     0x7861, 
     0x7885, 
     0x7897, 
     0x7939, 
     0x794b, 
     0x795d, 
     0x7993, 
     0x79b7, 
     0x79c9, 
     0x79ff, 
     0x7a11, 
     0x7a23, 
     0x7a59, 
     0x7a7d, 
     0x7aa1, 
     0x7b55, 
     0x7b8b, 
     0x7baf, 
     0x7bd3, 
     0x7c1b, 
     0x7d3b, 
     0x7d4d, 
     0x7dcb, 
     0x7e01, 
     0x7e91, 
     0x7eeb, 
     0x7f33, 
     0x7f8d, 
     0x7fc3, 
     0x800b, 
     0x801d, 
     0x8041, 
     0x8065, 
     0x8077, 
     0x80ad, 
     0x80f5, 
     0x8119, 
     0x81bb, 
     0x81df, 
     0x8215, 
     0x826f, 
     0x8281, 
     0x8293, 
     0x8335, 
     0x838f, 
     0x83d7, 
     0x83e9, 
     0x848b, 
     0x84af, 
     0x84f7, 
     0x8509, 
     0x8551, 
     0x8563, 
     0x8587, 
     0x85e1, 
     0x8617, 
     0x864d, 
     0x86a7, 
     0x86ef, 
     0x875b, 
     0x877f, 
     0x87c7, 
     0x8821, 
     0x887b, 
     0x890b, 
     0x899b, 
     0x89d1, 
     0x89f5, 
     0x8a19, 
     0x8a4f, 
     0x8a85, 
     0x8acd, 
     0x8af1, 
     0x8b5d, 
     0x8b93, 
     0x8bdb, 
     0x8bff, 
     0x8c47, 
     0x8c8f, 
     0x8cc5, 
     0x8ce9, 
     0x8d0d, 
     0x8d79, 
     0x8dd3, 
     0x8df7, 
     0x8e51, 
     0x8e63, 
     0x8e75, 
     0x8eab, 
     0x8ebd, 
     0x8ecf, 
     0x8f71, 
     0x8f83, 
     0x8fb9, 
     0x8fef, 
     0x9025, 
     0x9037, 
     0x906d, 
     0x90fd, 
     0x9133, 
     0x9145, 
     0x917b, 
     0x91f9, 
     0x922f, 
     0x9241, 
     0x92ad, 
     0x92bf, 
     0x9319, 
     0x933d, 
     0x9373, 
     0x9397, 
     0x944b, 
     0x94a5, 
     0x9535, 
     0x958f, 
     0x95e9, 
     0x961f, 
     0x9631, 
     0x969d, 
     0x96c1, 
     0x96d3, 
     0x96e5, 
     0x9751, 
     0x9787, 
     0x9805, 
     0x9829, 
     0x983b, 
     0x9883, 
     0x98a7, 
     0x98b9, 
     0x98dd, 
     0x9949, 
     0x9991, 
     0x99c7, 
     0x9a0f, 
     0x9a57, 
     0x9ac3, 
     0x9b1d, 
     0x9b2f, 
     0x9b77, 
     0x9c2b, 
     0x9c97, 
     0x9cbb, 
     0x9cf1, 
     0x9d15, 
     0x9d27, 
     0x9da5, 
     0x9ded, 
     0x9e23, 
     0x9e47, 
     0x9e8f, 
     0x9ea1, 
     0x9eb3, 
     0x9efb, 
     0x9f43, 
     0x9faf, 
     0x9fc1, 
     0x9fe5, 
     0xa03f, 
     0xa075, 
     0xa099, 
     0xa0ab, 
     0xa0bd, 
     0xa0f3, 
     0xa105, 
     0xa129, 
     0xa213, 
     0xa291, 
     0xa321, 
     0xa37b, 
     0xa39f, 
     0xa3d5, 
     0xa3e7, 
     0xa41d, 
     0xa49b, 
     0xa4ad, 
     0xa4d1, 
     0xa52b, 
     0xa561, 
     0xa585, 
     0xa597, 
     0xa5a9, 
     0xa5df, 
     0xa603, 
     0xa64b, 
     0xa65d, 
     0xa693, 
     0xa6c9, 
     0xa6ff, 
     0xa723, 
     0xa759, 
     0xa76b, 
     0xa7d7, 
     0xa7fb, 
     0xa855, 
     0xa8c1, 
     0xa8e5, 
     0xa91b, 
     0xa987, 
     0xaa17, 
     0xaa3b, 
     0xaa4d, 
     0xaa71, 
     0xaa83, 
     0xaa95, 
     0xaaef, 
     0xab01, 
     0xab5b, 
     0xabfd, 
     0xac45, 
     0xac57, 
     0xace7, 
     0xacf9, 
     0xad53, 
     0xad65, 
     0xadd1, 
     0xadf5, 
     0xae2b, 
     0xae4f, 
     0xae61, 
     0xaf27, 
     0xaf5d, 
     0xafb7, 
     0xb047, 
     0xb07d, 
     0xb0e9, 
     0xb0fb, 
     0xb11f, 
     0xb131, 
     0xb179, 
     0xb1d3, 
     0xb1e5, 
     0xb22d, 
     0xb23f, 
     0xb263, 
     0xb2bd, 
     0xb3cb, 
     0xb413, 
     0xb449, 
     0xb45b, 
     0xb4b5, 
     0xb4c7, 
     0xb50f, 
     0xb569, 
     0xb58d, 
     0xb5d5, 
     0xb5e7, 
     0xb62f, 
     0xb69b, 
     0xb6e3, 
     0xb7a9, 
     0xb827, 
     0xb839, 
     0xb893, 
     0xb8a5, 
     0xb8b7, 
     0xb947, 
     0xb9a1, 
     0xba0d, 
     0xba55, 
     0xba79, 
     0xbaaf, 
     0xbac1, 
     0xbb09, 
     0xbb2d, 
     0xbbcf, 
     0xbc3b, 
     0xbc83, 
     0xbcb9, 
     0xbdeb, 
     0xbe21, 
     0xbe8d, 
     0xbe9f, 
     0xbeb1, 
     0xbee7, 
     0xbef9, 
     0xbf0b, 
     0xbf89, 
     0xbfad, 
     0xbfe3, 
     0xc019, 
     0xc0bb, 
     0xc0f1, 
     0xc103, 
     0xc115, 
     0xc181, 
     0xc1db, 
     0xc1ff, 
     0xc211, 
     0xc27d, 
     0xc28f, 
     0xc2b3};