/*****************************************************************************/
/*									     */
/*  REGENERATE CYCLES							     */
/*  09/25/11 (dkc)							     */
/*									     */
/*  This C program regenerates cycles for the 3n+c sequence given entry      */
/*  points.  The number of even and odd elements in the extended sequences   */
/*  are counted.							     */
/*									     */
/*    "jump=0" indicates a no-jump attachment point                          */
/*    "jump=1" indicates a one-jump attachment point                         */
/*    "jump=2" indicates a multiple-jump attachment point                    */
/*    "jump=3" indicates a jumped-over attachment point                      */
/*									     */
/*  "delta" denotes the number of odd elements in the jump minus j where     */
/*  t=u(mod 2^j) (for one-jump or multiple-jump attachment points).  The     */
/*  domains of the cycles are also computed.				     */
/*									     */
/*****************************************************************************/
#include <stdio.h>
#include <math.h>
int main () {
int sin[1187+1167+1402+1394]={
154,208,52,160,40,10,2008,502,658,448,112,28,766,1360,340,
214,496,124,3790,16030,24742,10870,6490,2584,646,4276,952,238,1522,964,748,586,
370,1150,1684,466,394,298,262,1420,4924,19018,7282,10756,6706,1762,1288,322,
2332,32140,48718,212932,45460,8674,4204,1558,1252,844,610,802,2932,700,1396,412,
2854,1636,520,130,2386,934,826,460,6148,147322,55396,6190,15994,
-45334,-22708,-43444,-19546,-31906,-189856,-47464,-11866,-104914,-58636,-37738,-17242,-74782,-27892,-199366,-41704,
-10426,-88876,-13498,-45514,-37684,-22618,-24436,-88228,-121978,-386686,-144856,-36214,-16306,-8794,-26434,-35956,
-48052,-40114,-22186,-128242,-71758,-26758,-33364,-54262,-49222,326,37154,14084,2792,698,524,
2492,1592,398,602,434,314,416,104,26,272,68,164,182,872,218,1466,2324,
1226,7154,2834,1214,3626,2078,2648,662,1484,2168,542,7514,2378,1982,1808,452,
236,818,458,3266,1376,344,86,1268,
394,2014,832,208,52,1006,2572,634,736,184,46,2248,562,1048,262,250,
520,130,508,2086,934,502,340,724,1042,1600,400,100,
590,374,1220,48902,24386,8198,7754,7268,2426,6620,1394,1166,6098,3812,1454,698,
5162,102848,25712,6428,1358,662,1142,1706,7244,1286,15368,3842,2060,
298,352,88,22,1108,424,106,688,172,1354,640,160,40,10,126190,233338,
167782,142294,181336,45334,37666,14278,
29216,7304,1826,17228,9560,2390,1730,1526,1244,6158,61958,26582,15338,5906,2558,3638,
2432,608,152,38,2990,11720,2930,1094,1262,4430,6860,1532,8600,2150,2180,
484,4186,2158,964,658,4708,1438,694,466,2620,646,3106,2134,808,202,3466,
5644,2782,1198,604,268,3790,1576,394,1756,
614,386,1754,1376,344,86,188,380,326,278,260,1430,692,584,146,
758,440,110,5750,2312,578,2636,650,722,1586,2078,2186,1370,1160,290,9530,
1834,844,628,274,682,412,916,328,82,2806,1192,298,268,466,976,244,
202,232,58,178,5326,5236,1138,1726,3454,
158,482,338,284,512,128,32,8,2,662,4022,6368,1592,398,620,1670,
2156,2642,1148,716,944,236,7640,1910,4550,4586,2402,1058,554,878,1958,3092,
710,1346,5738,1574,6530,2606,3884,8798,5342,3398,3614,2426,
8068,11794,47242,26968,6742,2686,8554,5206,2110,1462,706,2422,1066,994,1588,
4772,1256,314,15212,3116,716,3206,1928,482,668,284,212,1424,356,956,338,
608,152,38,1046,572,266,9524,32708,9596,1958,
1270,1828,502,1180,730,484,250,1558,2728,682,808,202,1024,256,64,16,
4,160,40,10,2752,688,172,718,802,460,1348,412,514,352,88,22,

-4258,-5038,-6148,-8596,-9766,-3502,-10162,-5194,-14536,-3634,776,194,2150,1610,764,4418,
2114,2720,680,170,224,56,14,740,1934,2600,650,404,236,926,2474,1088,
272,68,290,362,296,74,188,1226,620,5114,2078,3932,2420,614,746,440,
110,854,
508,256,64,16,4,382,304,76,292,484,538,1210,20680,5170,3310,1402,
13138,7792,1948,526,358,7180,1672,418,108664,27166,10348,4270,1762,3346,2284,8386,
4000,1000,250,9520,2380,616,154,328,82,448,112,28,166,3184,796,
310,1084,364,1150,592,148,826,3688,922,3586,1642,4390,1516,
96458,54662,20660,2996,3230,3326,3146,2174,4676,3488,872,218,3362,4460,998,536,
134,212,464,116,896,224,56,14,30362,13274,8414,4136,1034,986,644,1040,
260,878,530,4118,1706,1364,788,626,5144,1286,
298,274,20422,9082,3568,892,1696,424,106,202,238,7300,2128,532,262,3496,
874,490,346,292,406,634,400,100,1228,2038,1552,388,670,1336,334,1468,
1390,7330,12244,2458,1084,3262,6574,14620,10570,4126,4252,
4088,1022,1514,1670,3440,860,650,866,488,122,320,80,20,596,2084,
554,29198,16832,4208,1052,704,176,44,794,572,590,740,302,578,380,2630,
3512,878,902,2468,626,398,632,158,536,134,1496,374,
316,412,4408,1102,14326,5536,1384,346,604,13726,3274,1852,574,448,112,28,
2986,2194,16732,3256,814,2584,646,406,
9512,2378,67070,25316,7532,2186,1766,1136,284,218,4454,2702,1178,5372,1172,
178,232,58,1816,454,1168,292,220,2074,1474,718,778,508,556,4180,4732,
1744,436,2608,652,1060,364,1174,4408,1102,940,7324,2020,544,136,34,26422,
39544,9886,5974,20446,11914,3640,910,
6836,1448,362,302,1466,716,638,1328,332,548,368,92,1166,4406,2894,11696,
2924,1238,1112,278,572,7286,4514,3236,746,446,
2092,586,5134,3376,844,1606,1282,1138,1768,442,2758,2200,550,2620,658,4216,
1054,562,1270,5944,1486,724,1918,886,
644,3470,2072,518,362,3188,1316,1352,338,1082,1028,1262,4646,1910,884,668,
590,1850,1460,830,22628,29432,7358,1940,18254,23762,20846,18812,2372,2864,716,302,
878,3368,842,1424,356,
1024,256,64,16,4,9484,3088,772,874,496,124,2950,2080,520,130,8380,
6670,9028,1564,2062,2626,3754,1576,394,316,178,682,424,106,208,52,
7616,1904,476,3098,3050,1154,602,
250,1060,2050,2536,634,1030,556,274,1726,6910,8368,2092,562,5128,1282,1888,
472,118,214,646,412,436,580,958,1444,3004,2914,6316,1354,1186,2140,598,
394,286,736,184,46,310,6052,75112,18778,8410,4036,2686,
1850,2372,1094,2858,8936,2234,2696,674,806,890,1562,2822,8690,7826,8960,2240,
560,140,1886,878,500,1022,554,5126,3428,1214,626,1256,314,1076,
454,1966,1534,2992,748,1018,586,868,334,616,154,814,886,1342,3136,
784,196,208,52,3424,856,214,994,544,136,34,184,46,10282,5878,8986,5584,
1396,496,124,
356,7580,4016,1004,1226,632,158,39548,26426,10082,2066,1496,374,662,1334,
1058,1544,386,410,326,614,776,194,
862,496,124,196,538,5122,3292,790,1612,880,220,214,2044,556,1288,322,
1564,466,694,
-57502,-47692,-57412,-62434,-33598,-50122,-18622,-60382,-266068,-49714,-13678,-49852,-20206,-57004,-15598,-51154,
-21862,-53314,656,164,18128,4532,3086,1172,764,9596,2654,2798,992,248,62,3122,
4196,3224,806,476,452,1016,254,2762,1988,1664,416,104,26,
-38642,-106418,-199730,-300596,-62906,-38882,-23810,-19262,-12146,3076,5344,1336,334,2932,724,
310,610,778,466,436,256,64,16,4,1264,316,2338,1618,760,190,988,268,
1690,808,202,250,292,346,304,76,562,1210,628,2920,730,448,112,28,
1456,364,538,376,94,1570,1294,7306,2914,400,100,1366,1204,1084,1138,10222,
12742,6916,3310,4378,1816,454,3724,2104,526,9466,3082,1330,4876,

29174,25448,6362,2096,524,4388,998,8438,7952,1988,548,278,2150,3284,1328,332,
1634,788,
1552,388,2686,1534,730,850,1684,2980,2092,568,142,
752,188,212,1292,968,242,578,470,806,536,134,2216,554,2792,698,
3656,914,956,356,542,380,248,62,200,50,
16648,4162,1738,1342,1198,1366,2554,1720,430,2008,502,4012,11512,2878,2062,13978,
8836,1834,826,1558,3412,790,2440,610,406,1954,910,
3086,5354,2186,998,2546,1028,3728,932,944,236,512,128,32,8,2,13130,
5102,10568,2642,62774,35756,10502,9188,1604,
346,27304,6826,15316,25522,13138,14074,12724,8818,4234,4144,1036,4558,1888,472,118,
196,502,454,1438,718,448,112,28,184,46,6406,21364,9862,11266,6784,1696,
424,106,9484,15736,3934,1654,778,
3464,866,9482,4328,1082,1058,590,5882,3758,2966,1292,422,338,1034,2462,90944,
22736,5684,2048,512,128,32,8,2,1886,1400,350,914,3596,854,500,11876,
5864,1466,1274,1166,12344,3086,3110,1346,3164,24062,7082,19202,19502,6422,2588,1976,
494,860,1502,3326,1250,4418,7052,
7834,3118,12028,9076,1882,886,892,1702,1408,352,88,22,310,3160,790,3730,
2956,1282,676,796,1192,298,292,2974,12664,3166,29164,6670,6484,1396,442,346,
478,6196,1342,4036,1444,958,2188,1066,580,
1244,2216,554,536,134,974,932,356,248,62,488,122,596,482,362,1568,
392,98,218,1148,776,194,254,1904,476,19928,4982,7778,3098,
1964,11936,2984,746,1046,4376,1094,1784,446,704,176,44,2432,608,152,38,16412,4934,5024,
1256,314,29162,
820,7048,1762,2350,916,712,178,1702,628,3700,970,1000,250,784,196,946,
2674,4624,1156,1078,586,2926,1738,1432,358,316,1270,658,3646,162658,138106,58786,
50464,12616,3154,169858,
854,560,140,692,1160,290,620,488,122,866,944,236,22052,7010,4400,1100,
3098,3482,3806,1610,
38392,9598,4576,1144,286,4102,10204,3328,832,208,52,328,82,214,2644,1222,
7288,1822,2218,1600,400,100,202,3400,850,502,1294,1186,628,490,1438,4696,
1174,25576,6394,2842,1120,280,70,2734,1996,2752,688,172,2896,724,796,
682,952,238,592,148,958,10570,11986,4678,214852,40468,13984,3496,874,
500,278,6476,2282,1040,260,6884,2120,530,3884,1196,782,8258,2168,542,9962,
3920,980,368,92,914,15494,9176,2294,3830,5288,1322,680,170,248,62,6818,
2240,560,140,
532,1102,598,922,2668,1792,448,112,28,190,256,64,16,4,
416,104,26,1802,1478,740,3152,788,686,518,380,1316,2342,1064,266,614,
1112,278,290,3800,950,542,902,524,284,842,938,992,248,62,1550,4190,
7688,1922,2504,626,3638,
646,808,202,262,6076,3448,862,1612,42112,10528,2632,658,2746,1216,304,76,
394,334,1936,484,586,406,694,856,214,1504,376,94,964,1456,364,
568,142,2914,2446,4564,1042,1162,622,502,748,676,1132,784,196,826,496,124,
754,538,388,27532,17902,36442,13852,
362,7442,2978,1304,326,1934,1556,1388,6380,2342,16028,4976,1244,818,494,746,
7838,26234,7706,6416,1604,488,122,578,404,764,2042,902,3464,866,512,128,
32,8,2,188,
3040,760,190,382,436,592,148,616,154,556,292,5416,1354,1618,16756,5182,
1786,1474,2236,670,976,244,538,772,2014,832,208,52,484,1096,274,1030,
574,490,11410,9556,14164,5992,1498,1312,328,82,3958,1672,418,5092,
266,33296,8324,8654,3434,3794,2606,1166,626,824,206,15974,3806,1616,404,2852,
1274,3146,3902,1652,2678,1814,6224,1556,2948,3092,2786,1718,
244,3388,1426,724,514,382,688,172,5386,1846,3874,1642,784,196,226,274,
292,2062,1414,2092,16024,4006,4828,1756,1360,340,
4034,37568,9392,2348,1136,284,4358,4298,1802,866,2684,2036,572,1514,758,902,

628,2710,1096,274,664,166,4924,1114,1846,77986,44344,11086,4348,1006,568,142,
244,1612,1738,4552,1138,2284,682,4978,6436,1906,3520,880,220,232,58,844,
1312,328,82,1576,394,5086,2098,11404,13966,5428,3196,790,556,412,268,748,
520,130,550,
1268,836,2456,614,422,350,434,1916,1160,290,2618,1952,488,122,
548,1142,620,308,566,404,2486,1124,3248,812,344,86,224,56,14,602,818,7706,
4814,2726,1214,3860,2240,560,140,218,
1114,610,508,7270,4570,1906,1318,1222,1168,292,1330,1258,664,166,574,
13588,2740,706,1816,454,736,184,46,952,238,310,3220,796,4192,1048,262,628,
328,82,3382,7594,3040,760,190,2896,724,
518,5000,1250,662,2408,602,1412,458,1706,818,500,806,1598,1382,2084,584,
146,248,62,5486,2870,7448,1862,2060,27800,6950,6782,4298,
1552,388,1084,892,2488,622,514,1354,1246,1228,424,106,544,136,34,
506,1352,338,3296,824,206,272,68,1238,1262,668,320,80,20,560,140,
1298,1856,464,116,974,
2656,664,166,2890,838,3466,2170,952,238,622,1270,2248,562,406,3274,1762,
856,214,1108,646,2404,2788,718,892,13672,3418,1954,928,232,58,358,982,
1756,1816,454,1198,1162,3376,844,1486,1324,1522,766,2242,1036,1810,874,8776,
2194,1018,628,430,730,2008,502,1972,2296,574,1306,2980,754,478,790,1594,
862,1468,970,1006,1054,1114,1132,1684,1330,694,1492,
1532,2564,704,176,44,542,2378,1088,272,68,1424,356,1376,344,86,1268,
434,1538,776,194,398,2312,578,506,386,452,7442,240938,90548,17174,18062,16172,
110294,70838,45818,17378,51002,19322,
580,688,172,1978,4102,1498,57400,14350,5578,6838,3598,1546,1876,1726,844,544,
136,34,19978,13540,4300,2536,634,4084,3334,1282,15586,15100,3028,2212,1114,
536,134,248,62,764,878,1940,1040,260,4262,1796,3050,2210,2804,
1160,290,1184,296,74,554,806,500,674,1508,9854,4874,3236,9260,1934,890,944,236,
242,11822,2006,950,
334,11182,13870,14572,4594,20380,95896,23974,10684,3412,838,6286,14548,2926,5314,8770,
6826,2758,4396,1732,1084,5152,1288,322,1480,370,1624,406,724,1138,1246,1468,
1036,1234,694,886,994,
1166,1154,632,158,1652,2018,956,1220,428,1766,3854,2666,2576,644,320,80,
20,3224,806,4172,16322,6320,1580,1256,314,6770,2738,1226,4196,986,626,434,
362,
7018,2338,4582,1918,7822,4024,1006,2566,1162,7012,3130,2260,988,4096,1024,256,
64,16,4,2638,

632,158,260,332,398,350,764,344,86,1088,272,68,1664,416,104,26,
530,800,200,50,656,164,548,296,74,1016,254,560,140,
-2378,202,508,646,1996,1798,2056,514,394,1024,256,64,16,4,592,148,
562,412,3202,1402,1192,298,436,5794,2374,3832,958,1042,
1202,692,332,11624,2906,1292,854,986,572,
508,298,5062,6346,7462,1540,940,568,142,256,64,16,4,1390,724,4288,
1072,268,2614,1090,1120,280,70,4414,1858,1552,388,616,154,1306,2830,1264,
316,262,
5816,1454,1352,338,1436,1766,866,3452,842,1568,392,98,374,344,86,236,
248,62,1442,33266,29036,5648,1412,27524,49934,74558,21326,13232,3308,824,206,572,
9938,7538,7328,1832,458,788,752,188,
1342,3358,41542,23878,13942,5056,1264,316,7246,7084,5194,2152,538,406,982,2764,
1288,322,448,112,28,66328,16582,9838,29008,7252,1564,1630,5788,3412,844,748,
9412,2140,2098,4168,1042,1180,1468,
206,740,344,86,2870,5300,1862,2546,1160,290,314,1520,380,620,2060,
1844,1700,524,1196,3842,1646,2132,3158,8702,5408,1352,338,332,4490,1622,5786,
2594,1178,1136,284,650,542,818,512,128,32,8,2,
256,64,16,4,940,382,886,538,2356,3694,1066,1114,1798,880,220,580,
1222,664,166,268,688,172,238,526,508,1474,3904,976,244,
644,698,18464,4616,1154,1166,1508,2570,8918,2870,1832,458,3596,22040,5510,3074,
2246,2426,8636,1826,1544,386,734,482,788,6944,1736,434,2330,2948,1346,1274,
1034,6704,1676,3086,1364,2114,1706,
256,64,16,4,208,52,370,346,460,2740,748,1300,15988,11830,10966,4798,
2620,1930,6268,1918,1072,268,7240,1810,886,1732,532,6106,2080,520,130,1138,
634,2110,1486,1354,3874,1660,946,562,418,364,
722,3632,908,776,194,992,248,62,2864,716,2558,11612,5888,1472,368,92,
1028,590,5456,1364,464,116,230,650,452,428,752,188,5666,1958,1622,1964,
968,242,1478,1352,338,2540,1910,2552,638,13628,10316,3422,6638,6590,
226,1252,874,2494,1144,286,316,268,592,148,1054,604,322,736,184,46,
388,682,1384,346,2134,2386,1864,466,784,196,1024,256,64,16,4,1198,
658,892,376,94,244,13204,6562,14662,5572,2872,718,478,1186,2998,4168,1042,
1108,3814,1438,748,4078,1738,2458,4102,1348,2512,628,4654,1954,3004,772,
2294,1070,668,992,248,62,278,314,3212,812,362,728,182,254,3050,2240,
560,140,236,1136,284,596,692,
808,202,286,1240,310,700,1294,3346,1192,298,322,898,1066,610,15982,287656,
71914,27178,10402,7936,1984,496,124,1708,1006,7234,3814,5506,2524,9484,2164,616,
154,268,706,1060,598,862,1726,12094,3028,778,502,
212,8204,6908,3308,5048,1262,1238,2048,512,128,32,8,2,
-52466,-31838,-57650,-46958,-47906,-78062,-54116,-35900,-32030,-86810,-32342,-38834,-57788,-43070,-52790,-21662,
-241790,-512492,-180392,-45098,-16700,-71396,-68696,-17174,-235526,-131954,-42044,-92588,-76280,-19070,-123260,-25430,
-124196,-42236,-92156,-46418,-41180,-74150,-60908,-73826,-71420,-48380,-136520,-34130,-35582,-28718,-476096,-119024,
-29756,-171320,-42830,-35132,-17054,-148046,-123908,-72194,-19934,-99878,-55652,1126,634,886,544,
136,34,4582,1930,1090,3100,2344,586,856,214,292,2008,502,400,100,1048,
262,310,328,82,1018,1102,7960,1990,958,640,160,40,10,
11702,5708,1094,680,170,1154,4718,1982,956,392,98,848,212,1100,608,152,
38,500,8300,2522,12494,4898,2678,15248,3812,1604,950,1172,3332,4298,13466,28370,
16490,14924,2066,1694,113096,28274,16436,14018,9050,42626,48038,16772,
286,694,90712,22678,34612,8074,2644,772,358,3232,808,202,430,4078,13546,13714,
5356,5122,2134,15976,3994,2458,1810,892,784,196,250,5608,1402,2260,4690,1972,
1042,604,1324,2662,9982,6148,1366,29098,6208,1552,388,
800,200,50,506,404,290,2276,3500,1520,380,1178,656,164,398,2900,
758,962,1988,1196,872,218,296,74,242,1034,602,440,110,1880,470,
1246,682,2608,652,916,4540,1066,3094,724,1426,1570,1420,1078,
13586,12488,3122,2960,740,10058,6506,6620,23504,5876,2192,548,1256,314,716,350,
476,3380,1490,2282,1268,896,224,56,14,788,14756,7250,7142,2894,1718,860,
2408,602,878,4838,2030,4226,10868,3596,890,1040,260,3092,6362,4118,1760,440,
110,4550,1922,6494,2204,18806,7268,3284,18158,11366,4478,3218,3740,1394,3770,2660,
1826,4064,1016,254,
3532,1534,5764,1108,424,106,256,64,16,4,226,442,382,3802,1642,832,
208,52,658,2026,976,244,262,688,172,298,328,82,1444,2344,586,436,
1684,532,316,622,1552,388,8194,6718,26956,8122,3262,24286,32494,28444,15196,7438,
17884,8572,76234,28804,3538,10948,1918,5086,
974,2372,662,8354,3350,3758,2210,1046,2534,3170,1406,1334,29090,11126,41510,36056,
9014,68456,17114,18560,4640,1160,290,326,47720,11930,8948,5546,1940,1886,1604,518,
6896,1724,1028,410,1658,2216,554,536,134,1076,5828,1310,1280,320,80,20,
5924,1328,332,1172,626,452,302,752,188,596,464,116,812,5348,1220,446,
794,
2206,1720,430,502,406,370,3574,1558,802,11350,4474,3988,1666,2440,610,3850,
2710,1234,2716,790,514,1468,1042,3088,772,1360,340,640,160,40,10,550,
424,106,604,466,1708,538,1504,376,94,
3566,1556,2762,5078,3158,1172,2108,614,1052,416,104,26,
556,1276,2572,2776,694,7432,1858,916,988,826,616,154,1762,880,220,610,
448,112,28,
1868,1076,422,788,368,92,1034,608,152,38,572,29084,13316,2258,2636,
1292,914,1184,296,74,248,62,1670,1490,2156,1088,272,68,224,56,14,1058,
3272,818,11588,6890,2804,746,500,314,338,926,7214,5570,1952,488,122,266,
320,80,20,530,1022,5072,1268,458,392,98,860,1178,662,1412,584,146,
476,4946,2384,596,332,644,
18508,14260,12556,2152,538,9400,2350,1102,634,2596,1282,1984,496,124,244,1948,
586,1378,1216,304,76,30298,60430,22882,10288,2572,748,958,580,2326,21064,5266,
3514,13828,5548,36184,9046,10030,3982,1714,1516,1120,280,70,406,1678,850,1030,
676,742,2632,658,922,
3080,770,1346,19190,7418,2102,1010,830,1154,1742,878,698,932,20738,6476,1436,
590,554,866,1784,446,992,248,62,428,302,1778,4052,1694,3200,800,
200,50,15230,12422,4880,1220,1568,392,98,1136,284,2804,4322,4700,11552,2888,722,
4780,1900,1090,4384,1096,274,466,520,130,1240,310,730,496,124,1108,430,
2350,898,3544,886,1054,2224,556,712,178,2410,1126,1114,640,160,40,10,
226,44146,9826,14338,10504,2626,3868,10126,33454,6274,5518,20332,29170,8056,2014,22654,
20170,7786,3142,63934,55000,13750,8290,6460,3058,6814,5326,13042,
1802,19808,4952,1238,4454,13634,5336,1334,2186,29078,44252,13004,18008,4502,9260,6146,
2528,632,158,1286,4886,6200,1550,1430,2486,3158,12554,84644,16094,13652,2990,2240,
560,140,12662,11744,2936,734,5528,1382,2828,8666,4238,2942,5912,1478,5750,9578,
4850,2042,8180,5660,2150,13040,3260,4202,2582,2270,2342,4778,5372,3770,4718,3212,
5204,5012,
3886,6754,10366,2704,676,1348,1894,934,574,1996,598,448,112,28,418,
1984,496,124,4036,4372,2572,706,3442,1624,406,376,94,
590,446,392,98,1256,314,3560,890,13226,5678,2354,1886,932,824,206,302,
338,752,188,260,6722,3482,7574,4010,11498,22460,4436,41048,10262,5144,1286,818,
1022,608,152,38,404,1238,2066,1724,548,716,494,410,3200,800,200,50,
2930,2210,22028,26078,10004,5288,1322,1862,2186,2912,728,182,1562,6260,8906,8582,
2330,3806,1652,4532,4694,6422,3524,4964,1958,944,236,

598,9820,3622,4126,2884,766,994,1894,2668,6754,2758,1954,958,1102,1516,15952,
3988,10120,2530,1174,3316,
5258,2198,1802,902,4448,1112,278,722,1226,686,4286,6674,2738,1166,3314,1328,
332,2036,608,152,38,
1162,4294,5266,4480,1120,280,70,1504,376,94,262,261622,73978,63496,15874,9496,
2374,2962,2536,634,1612,268,4042,6958,2836,25426,59446,17116,3436,880,220,1078,
700,358,2266,13654,11872,2968,742,
746,1682,3680,920,230,314,764,506,854,548,5174,2168,542,16190,4952,1238,
692,290,3554,22508,4448,1112,278,332,2006,980,1520,380,452,33272,8318,2738,
3392,848,212,
1354,736,184,46,1834,916,400,100,436,310,1456,364,778,520,130,
11084,3644,1598,1472,368,92,1976,494,
508,940,406,382,994,1930,1660,1432,358,364,298,742,2332,730,4360,1090,
1738,1552,388,1108,886,562,2578,7924,874,1066,1174,670,12280,3070,2128,532,
724,778,1012,2632,658,16240,4060,2452,1264,316,1414,760,190,
37838,14420,11000,2750,1262,704,176,44,410,1442,1388,680,170,2090,4520,1130,
3452,878,560,140,866,1064,266,3548,896,224,56,14,236,3884,950,734,
506,10514,3272,818,2846,1298,2426,2588,716,1712,428,464,116,
1558,1762,892,11008,2752,688,172,6172,2314,2446,1954,964,412,694,1684,2386,
1126,3304,826,1738,4114,1774,1576,394,10546,4186,1582,1468,1168,292,286,4816,
1204,574,2746,1114,718,982,
740,998,1142,265256,66314,25100,7640,1910,3896,974,1676,1052,1712,428,
758,4436,1064,266,332,674,596,344,86,704,176,44,620,1430,3248,812,5354,2240,
560,140,764,3788,1646,2492,3464,866,650,476,1304,326,
3544,886,29626,75802,97828,28096,7024,1756,562,898,1048,262,1012,4030,1744,436,
1858,5368,1342,736,184,46,250,101716,48586,42100,64780,
4676,2546,7916,1718,878,656,164,1736,434,9374,4802,5162,3488,872,218,764,
4514,3176,794,3974,1724,1142,662,482,1952,488,122,1574,824,206,584,146,
2084,3218,5972,2264,566,446,
1612,2866,1216,304,76,2890,1318,3352,838,1540,1174,1246,2164,640,160,40,
10,238,1498,796,7996,4486,2566,1756,4756,1126,1702,8860,7510,4810,2038,1732,
2056,514,1066,634,472,118,652,904,226,3334,2080,520,130,3136,784,196,
1570,6214,17470,12124,33430,19390,15592,3898,1696,424,106,274,454,2362,1120,280,
70,3172,856,214,706,1876,586,580,15934,11152,2788,802,9490,28444,39622,13276,
18238,12610,3880,970,598,922,
554,1634,848,212,7850,6482,2666,20972,4748,4916,2396,1262,1298,722,506,
1846,928,232,58,622,712,178,1270,4024,1006,1132,448,112,28,646,478,
1654,856,214,316,1276,592,148,952,238,370,1432,358,442,838,550,1360,
340,730,1000,250,2080,520,130,982,604,1168,292,484,1324,628,766,1648,
412,430,1036,1144,286,394,844,538,892,700,790,532,808,202,
1082,7550,3068,812,4130,2054,992,248,62,260,1340,488,122,2078,1016,
254,332,6914,5132,1136,284,290,866,1046,2186,3932,974,602,5390,2258,1862,
938,1916,596,1376,344,86,6452,48734,18512,4628,15662,6110,2528,632,158,296,74,
238,3508,1600,400,100,256,64,16,4,250,15928,3982,2362,3022,1516,3118,
12040,3010,1366,5722,3274,1336,334,2302,1888,472,118,4156,1762,898,574,916,
544,136,34,
4712,1178,680,170,302,2318,11552,2888,722,620,770,1754,896,224,56,14,
9554,3104,776,194,
2884,1408,352,88,22,424,106,2074,1156,922,1912,478,418,832,208,52,
1280,320,80,20,5378,35390,14402,26606,18380,3686,1622,848,212,734,626,1490,
2396,3692,932,1532,716,374,380,1094,650,7580,2468,2180,3362,4892,2738,4334,
4286,7688,1922,12182,4808,1202,4772,3152,788,1382,758,524,338,1424,356,3314,
5582,3224,806,542,572,500,740,1328,332,302,4502,1928,482,2558,470,416,
104,26,614,608,152,38,254,464,116,632,158,
2152,538,442,406,862,4024,1006,1990,1720,430,1504,376,94,4636,3484,3538,
9118,13492,2770,9448,2362,1126,1234,183160,45790,25828,36226,6388,1438,3772,5482,2296,
574,4258,1618,4096,1024,256,64,16,4,556,808,202,316,6532,9370,3754,
1648,412,2080,520,130,1834,928,232,58,262,748,
296,74,11546,15644,14624,3656,914,584,146,1586,836,398,17102,12104,3026,1376,
344,86,884,8354,3374,4466,1916,1142,29042,11132,3734,6686,4364,7382,20828,6326,
142766,198416,49604,9542,10136,2534,3284,1118,1232,308,4166,3044,812,2474,9602,3842,
1682,872,218,8144,2036,1304,326,2252,2096,524,1262,1226,1466,3716,938,686,
376,94,916,862,1240,310,358,700,1024,256,64,16,4,1150,2284,670,
1048,262,340,706,1744,436,832,208,52,454,412,1960,490,880,220,
782,536,134,2714,6080,1520,380,314,1418,3068,818,1760,440,110,284,296,
74,2066,8546,5414,3164,836,842,3038,1382,1340,494,428,3200,800,200,50,
-131774,-49172,-26330,-46778,-70862,-58244,-94082,-120812,-24602,-219824,-54956,-57986,-35402,-77828,-94568,-23642,
-84002,-68162,-46646,-114764,-31028,-58442,-51074,-199412,-124214,-63914,-52772,-14234,-90518,-30914,-81446,-254588,
-47492,-32378,-39002,-128426,-107204,-21914,-180914,-101156,-27842,-29786,-136490,-114008,-28502,676,370,382,
1534,3154,1426,778,1210,766,1576,394,1048,262,2308,508,72118,60274,22846,54310,
106312,26578,10210,4072,1018,712,178,310,1306,838,2134,2956,4936,1234,706,3280,
820,730,1318,5710,3820,3034,7708,2776,694,1216,304,76,
302,3548,1922,968,242,3614,10082,10244,1868,1136,284,1280,320,80,20,248,
62,11054,16796,8246,3380,878,1670,1550,2468,1406,3764,950,5780,1328,332,704,
176,44,8624,2156,1112,278,3926,3782,2738,3674,1622,2324,680,170,308,
448,112,28,250,9892,3394,3448,862,568,142,298,1414,826,3034,13726,
5392,1348,988,430,406,3796,2764,1654,2908,790,3358,1504,376,94,280,70,
308,1298,24902,9584,2396,1538,8324,3062,1394,7514,32678,12500,4130,4652,1118,3680,
920,230,332,1646,1460,6056,1514,1466,4304,1076,3950,2348,686,5948,3464,866,
1898,1682,6434,6596,
1636,742,1012,436,328,82,454,10078,5872,1468,1588,544,136,34,526,4246,
3004,2074,1024,256,64,16,4,2626,5308,8458,3418,1528,382,1492,1708,1096,
274,508,1384,346,376,94,3166,9916,3442,5542,3046,1552,388,1222,6442,2662,
20452,4336,1084,2446,7366,24874,9574,5956,1858,1984,496,124,
626,482,428,5972,2156,2084,638,980,42818,16304,4076,2894,2246,11534,7106,2912,
728,182,1328,332,6152,1538,824,206,734,1778,914,590,950,1976,494,896,
224,56,14,1184,296,74,2276,674,500,1628,1076,584,146,302,788,
1408,352,88,22,256,64,16,4,3658,2476,712,178,1180,1108,946,9832,
2458,2002,2866,2944,736,184,46,1624,406,400,100,1162,4360,1090,38056,9514,
4726,2020,2902,1336,334,1018,1192,298,838,562,1486,1558,832,208,52,634,
976,244,688,172,280,70,274,114322,97636,42124,8146,8050,19426,26878,25924,18418,
90346,29368,7342,37102,37858,43024,10756,25300,132304,33076,9922,
704,176,44,932,884,6428,1454,794,3026,2324,2162,1838,938,
3632,908,752,188,284,302,362,1364,15176,3794,2756,2426,7886,3206,2126,1046,
1256,314,9344,2336,584,146,
520,130,298,712,178,316,286,784,196,736,184,46,592,148,376,94,
676,928,232,58,322,370,388,658,496,124,1216,304,76,424,106,466,
1222,9910,33400,8350,5320,1330,748,4276,91474,34552,8638,5482,1978,1738,1684,754,
532,1198,484,340};

unsigned char cflag[1187+1167+1402+1394+1]={
0,0,0,0,0,0,1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,
3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,5,5,5,
5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,7,7,7,8,8,8,
8,9,9,9,9,10,10,10,10,11,11,11,11,11,0,0,1,1,2,3,3,
3,4,4,5,5,6,6,7,7,7,7,7,8,8,8,9,9,10,10,10,10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,2,2,3,3,3,4,4,5,5,5,6,6,6,7,7,7,
8,8,8,9,9,9,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,12,12,
255};

int cval[133]={601,605,607,611,613,617,619,623,625,629,631,635,637,641,643,
	      647,649,653,655,659,661,665,667,671,673,677,679,683,685,689,
	      691,695,697,701,703,707,709,713,715,719,721,725,727,731,733,
	      737,739,743,745,749,751,755,757,761,763,767,769,773,775,779,
	      781,785,787,791,793,797,799,803,805,809,811,815,817,821,823,
	      827,829,833,835,839,841,845,847,851,853,857,859,863,865,869,
	      871,875,877,881,883,887,889,893,895,899,901,905,907,911,913,
	      917,919,923,925,929,931,935,937,941,943,947,949,953,955,959,
	      961,965,967,971,973,977,979,983,985,989,991,995,997};

unsigned int size[133]={
77,88,28,29,22,31,25,31,25,44,15,26,32,50,60,42,43,43,24,15,39,26,24,37,31,7,
44,30,35,23,19,45,77,
18,11,25,27,24,39,55,41,51,36,20,61,35,14,37,55,36,46,28,26,16,51,40,41,28,15,
21,75,38,31,36,37,33,20,
29,28,9,34,40,39,43,29,39,42,46,63,23,43,13,92,44,43,30,13,68,56,65,41,12,19,
70,53,48,60,66,27,75,
21,21,39,35,15,8,45,45,38,44,27,38,86,15,62,48,35,20,16,75,59,64,31,32,92,47,
31,36,60,47,75,35,52};

unsigned int conv[27*2]={5,3,6,4,8,5,9,6,11,7,16,10,19,12,24,15,27,17,38,24,
  46,29,57,36,65,41,76,48,84,53,130,82,149,94,168,106,233,147,252,159,317,200,
  336,212,401,253,420,265,485,306,504,318,569,359};

int hflag=0; // flag to histogram k values
int hflag1=0;		 // flag to histogram j values
unsigned int indmin=0;	 // selects (l,m) value
unsigned int indmax=0;	 // Note: Could include different (l,m) values.
unsigned int bypass=0;	 // normally set to 0
unsigned int wflag=1;	 // normally set to 0
unsigned int infin=0;	 // normally set to 0
int k,max,temp,order,s[500],t,u,savek,oldk,c,olds,cmax,cmin,delta,locmin,locmax;
unsigned int g,h,i,m,iters,j,count,first,odds,evens,flag,lodds,levens,jump,jcnt;
unsigned int flag0,offset,index,sumtu,total,stu[1000*2],county,countn,countx;
unsigned int histo[100],mincnt,hismin[10],savjmp,second,newhis[100],oldhis[100];
int lastodd,glomax,usave,tmps,cyccnt,mcount,oddsum,hcount,icount,lcount,oldt,oldu;
unsigned int jumps[500],mflag,attcnt,savind,histoj[100],histom[10],histon[20];
unsigned int histoh[100],histoi[100],histox[100],badcnt,badcntu,primary,jmpcnt;
int glomin,a,badcomp,savet,lastt,evensum,jsum,hsum,compcnt,sum;
unsigned int firstt,savjump,savcnt,glohop,glojmp,tmpcnt,twojmp,lasthop,jmphop,tempi;
unsigned int twojmp0,twojmp1,twojmp2,twojmp3,tmpjump,jmpsum,offset1,histoy[100];
unsigned int histoz[100],histow[100],histov[200],histos[100],offset2,badtucnt;
unsigned int concov[27*3],concove[27*3],histoa[30],histob[30],offset4,offset5;
unsigned int patcnt,cyccntb,cyccntu,histor[100],equcnt;
unsigned int histod[400],offset6;
double lambda,d,dmin,dmax,del,maxdel,mindel,sumrec,tempf,chain,rat,oldchn;
double ratdel,tempg,cap,cam,bp,bm,savchain,maxcmp,var,std,mean;
FILE *Outfp;
Outfp = fopen("out0cf.dat","w");
for (i=0; i<100; i++) {
   histo[i]=0;
   histoj[i]=0;
   newhis[i]=0;
   oldhis[i]=0;
   histoh[i]=0;
   histoi[i]=0;
   histox[i]=0;
   histoy[i]=0;
   histoz[i]=0;
   histow[i]=0;
   histos[i]=0;
   histor[i]=0;
   }
for (i=0; i<200; i++)
   histov[i]=0;
for (i=0; i<10; i++) {
   hismin[i]=0;
   histom[i]=0;
   }
for (i=0; i<20; i++)
   histon[i]=0;
for (i=0; i<27*3; i++) {
   concov[i]=0;
   concove[i]=0;
   }
for (i=0; i<30; i++) {
   histoa[i]=0;
   histob[i]=0;
   }
for (i=0; i<400; i++)
   histod[i]=0;
rat=log(3.0)/log(2.0);
ratdel=rat/(rat-1.0);
badcnt=0;
badcntu=0;
badtucnt=0;
badcomp=0;
compcnt=0;
cyccntu=0;
cyccntb=0;
equcnt=0;
maxcmp=0.0;
primary=0;
offset=20;
offset1=40;
offset2=80;
offset4=15;
offset5=20;
offset6=100;
index=0;
maxdel=-1000000.0;
mindel=1000000.0;
county=0;
countn=0;
countx=0;
cyccnt=0;
mcount=0;
glohop=0;
glojmp=0;
jmphop=0;
twojmp=0;
twojmp0=0;
twojmp1=0;
twojmp2=0;
twojmp3=0;
for (h=0; h<133; h++) {
   c=cval[h];
// if (c>900)
//    break;
   iters=size[h];
   if (wflag==0)
      printf("c=%d \n",c);
   for (i=0; i<iters; i++)
      s[i]=sin[i+index];
//
// compute order (of loop)
//
   sumtu=0;
   total=0;
   olds=0;
   glomax=0;
   glomin=1000000000;
   a=0;
   mflag=0;
   attcnt=0;
   patcnt=0;
   savind=0;
   sumrec=0.0;
   oddsum=0;
   jmpsum=0;
   oldt=0;
   lastt=0;
   firstt=1;
   oldchn=1000000000.0;
   oldu=0;
   evensum=0;
   jsum=0;
   hcount=0;
   for (i=0; i<iters; i++) {
      k=s[i];
      savek=k;
      max=k;
      if (max<0)
	 max=-max;
      levens=0;
      while (k==(k/2)*2) {
	 k=k/2;
	 levens=levens+1;
	 }
      lodds=1;
      for (j=1; j<100000; j++) {
	 k=3*k+c;
	 if ((k&7)==0) {
	    oldk=savek;
	    savek=k;
	    }
	 temp=k;
	 if (temp<0)
	    temp=-temp;
	 if (temp>max)
	    max=temp;
	 while (k==(k/2)*2) {
	    if (k==s[i]) {
	       levens=levens-1;
	       goto bskip;
	       }
	    k=k/2;
	    levens=levens+1;
	    }
	 levens=levens-1;
	 lodds=lodds+1;
	 }
      printf("error: i=%d, s[i]=%d \n",i,s[i]);
      goto zskip;
bskip:
      order=3;
      while (order<max)
	 order=order*2;
      while ((oldk&1)==0)
	 oldk=oldk/2;
      u=oldk;
//
// find odd natural number divisible by 3
//
      k=s[i];
      max=k;
      if (max<0)
	 max=-max;
      while (k!=(k/3)*3) {
	 if (k==(k/2)*2) {
	    if ((k-c)==((k-c)/3)*3) {
	       k=(k-c)/3;
	       temp=k;
	       if (temp<0)
		  temp=-temp;
	       if (temp>max)
		  max=temp;
	       }
	    else {
	       k=k*2;
	       temp=k;
	       if (temp<0)
		  temp=-temp;
	       if (temp>max)
		  max=temp;
	       }
	    }
	 else {
	    k=k*2;
	    temp=k;
	    if (temp<0)
	       temp=-temp;
	    if (temp>max)
	       max=temp;
	    }
	 }
//
// include even natural numbers to the left of the odd natural number divisible
// by 3
//
      t=k;
      jump=1;
      flag0=3;
      if ((3*t+c)==s[i]) {
	 jump=0;
	 flag0=0;
	 }
      temp=t-u;
      m=0;
      jcnt=0;
      while ((temp&1)==0) {
	 m=m+1;
	 temp=temp/2;
	 }
      while (order<max)
	 order=order*2;
      temp=k;
      if (temp<0)
	 temp=-temp;
      while (temp<(order/2)) {
	 temp=temp*2;
	 k=k*2;
	 }
//
// compute sequence
//
      hsum=0;
      count=1;
      first=1;
      while (k==(k/2)*2) {
	 k=k/2;
	 count=count+1;
	 }
      evens=count-1;
      odds=1;
      for (j=1; j<10000; j++) {
	 k=3*k+c;
	 count=count+1;
	 if (first==0) {
	    if (((k&3)==0)&&((k&7)!=0))
	       hsum=hsum+1;
	    }
	 flag=0;
	 while (k==(k/2)*2) {
	    if (k==s[i]) {
	       if (first==1)
		  first=0;
	       else
		  goto askip;
	       }
	    k=k/2;
	    count=count+1;
	    flag=flag+1;
	    }
	 if (first==1) {
	    evens=evens+(flag-1);
	    odds=odds+1;
	    if (flag==2) {
	       jcnt=jcnt+1;
	       if ((3*k+c)==s[i])
		  flag0=1;
	       }
	    }
	 }
      printf("error \n");
      goto zskip;
askip:
      if ((jcnt==1)&&(flag0==1))
	 jump=1;
      if ((jcnt>1)&&(flag0==1))
	 jump=2;
      if ((jcnt>0)&&(flag0==0))
	 jump=3;
      if (flag0==3)
	 jump=3;
      jumps[i]=jump;
      attcnt=attcnt+1;
//
// check order of jump types for primary, secondary, tertiary, etc.
//
      if ((4*s[i])!=olds) {
	 tmpjump=jump;
	 if (jump==3) {
	    printf("error: primary jumped-over attachment point \n");
	    goto zskip;
	    }
	 }
      else {
	 if (tmpjump==0) {
	    if (jump!=3) {
	       printf("error: incorrect order \n");
	       fprintf(Outfp,"error: incorrect order \n");
	       goto zskip;
	       }
	    }
	 if (tmpjump==3) {
	    if ((jump!=1)&&(jump!=2)) {
	       printf("error: incorrect order \n");
	       fprintf(Outfp,"error: incorrect order \n");
	       goto zskip;
	       }
	    }
	 if ((tmpjump==1)||(tmpjump==2)) {
	    if (jump!=0) {
	       printf("error: incorrect order \n");
	       fprintf(Outfp,"error: incorrect order \n");
	       goto zskip;
	       }
	    }
	 tmpjump=jump;
	 }
//
// check hops in multiple-jumps
//
      jmpcnt=0;
      if (jump==2) {
	 first=0;
	 second=0;
	 flag0=0;
	 k=t;
	 if (((3*k+c)&3)==0) {	      // check for hop
	    first=1;		      // hop count
	    lasthop=1;		      // set last hop flag
	    }
	 else {
	    second=1;		      // jump count
	    flag0=1;		      // set first jump flag
	    lasthop=0;
	    }
	 while ((3*k+c)!=s[i]) {
	    k=k+c;
	    tmpcnt=0;
	    while ((k&1)==0) {
	       k=k/2;
	       tmpcnt=tmpcnt+1;
	       }
	    for (j=0; j<tmpcnt; j++)
	       k=k*3;
	    k=(k-c)/2;
	    if ((((3*k+c)&3)==0)&&((3*k+c)!=s[i])) {  // check for hop
	       first=first+1;	      // increment hop count
	       lasthop=1;	      // set last hop flag
	       }
	    if ((((3*k+c)&3)!=0)&&((3*k+c)!=s[i])) {  // check for jump
	       second=second+1;       // increment jump count
	       lasthop=0;
	       }
	    jmpcnt=jmpcnt+1;
	    }
	 if ((flag0==0)&&(second>0)&&(lasthop==1)) {  // first and last are hops
	    if (wflag==5) {
	       printf("warning: non-adjacent hops, c=%d, s=%d \n",c,s[i]);
	       fprintf(Outfp,"warning: non-adjacent hops, c=%d, s=%d \n",c,s[i]);
	       }
	    jmphop=jmphop+1;
	    }
	 if ((flag0==1)&&(first>0)&&(lasthop==0)) {  // first and last are jumps
	    if (wflag==5) {
	       printf("warning: non-adjacent jumps, c=%d, s=%d \n",c,s[i]);
	       fprintf(Outfp,"warning: non-adjacent jumps, c=%d, s=%d \n",c,s[i]);
	       }
	    jmphop=jmphop+1;
	    }
	 glohop=glohop+first;	     // total number of hops
	 glojmp=glojmp+second;	     // total number of jumps
	 if (jmpcnt==2) {
	    twojmp=twojmp+1;	     // total number of two-"jumps"
	    if (first==2)
	       twojmp0=twojmp0+1;
	    if ((first==1)&&(second==1)) {
	       if (lasthop==1)
		  twojmp1=twojmp1+1;
	       else
		  twojmp2=twojmp2+1;
	       }
	    if (second==2)
	       twojmp3=twojmp3+1;
	    }
	 mcount=mcount+1;
	 }
//
// check chain (t values)
//
      if ((4*s[i])!=olds) {
	 temp=t+c;
	 if (temp<0)
	    temp=-temp;
	 chain=(double)temp;
	 temp=s[i];
	 if (temp<0)
	    temp=-temp;
	 while ((temp&1)==0)	 // next u value
	    temp=temp/2;
	 chain=rat*log(chain);
	 chain=exp(chain);
	 if (jump==1)
	    chain=chain*2.0;
	 if (jump==2)
	    chain=chain*(double)(1<<jmpcnt);
	 if (chain<(double)temp) {
	    if (wflag!=2) {
	       printf("error:  bad t-u chain, c=%d, t=%d, u=%d, jump=%d, count=%d \n",c,t,temp,jump,jmpcnt);
	       fprintf(Outfp,"error:  bad t-u chain, c=%d, t=%d, u=%d, jump=%d, count=%d \n",c,t,temp,jump,jmpcnt);
	       }
	    badtucnt=badtucnt+1;
	    }
	 if (chain<(double)oldt) {
	    if (wflag!=2) {
	       printf("error: bad chain, c=%d \n",c);
	       printf("chain=%e, oldt=%d, t=%d, jump=%d, count=%d, s=%d \n",chain,oldt,t,jump,jmpcnt,s[i]);
	       fprintf(Outfp,"error: bad chain, c=%d \n",c);
	       fprintf(Outfp,"chain=%e, oldt=%d, t=%d, jump=%d, count=%d, s=%d \n",chain,oldt,t,jump,jmpcnt,s[i]);
	       }
	    badcnt=badcnt+1;
	    }
	 oldt=t;
	 if (oldt<0)
	    oldt=-oldt;
	 if (firstt==1) {
	    savchain=chain;
	    savet=t;
	    savjump=jump;
	    savcnt=jmpcnt;
	    firstt=0;
	    }
	 }
//
// check for powers of 2
//
      if (((4*s[i])!=olds)&&(jump==2)&&(jmpcnt==2)) {
	 temp=t;
	 temp=temp+c;
	 if (temp<0)
	    temp=-temp;
	 while ((temp&1)==0)
	    temp=temp/2;
	 if ((wflag==3)&&(temp==1)) {
	    printf("power of two:  c=%d, u=%d, t=%d, s=%d \n",c,u,t,s[i]);
	    fprintf(Outfp,"power of two:  c=%d, u=%d, t=%d, s=%d \n",c,u,t,s[i]);
	    }
	 if (chain<(double)lastt) {
	    printf("error: bad chain, chain=%e, lastt=%d \n",chain,lastt);
	    fprintf(Outfp,"error: bad chain, chain=%e, lastt=%d \n",chain,lastt);
	    goto zskip;
	    }
	 }
      lastt=t;
      if (lastt<0)
	 lastt=-lastt;
//
// count hops up until attachment point
//
      if ((4*s[i])!=olds) {
	 icount=0;
	 k=u;
	 k=3*k+c;
	 while (k!=(4*s[i])) {
	    if ((k&3)==0) {
	       icount=icount+1;
	       k=k/4;
	       }
	    else
	       k=k/2;
	    k=3*k+c;
	    }
//
	 lcount=1;
	 k=s[i];
	 while ((k&1)==0) {
	    lcount=lcount+1;
	    k=k/2;
	    }
	 delta=odds+icount-lcount;
	 if (jump==1) {
	    delta=delta-1;
	    jmpsum=jmpsum+1;
	    }
	 if (jump==2) {
	    delta=delta-jmpcnt;
	    jmpsum=jmpsum+jmpcnt;
	    }
	 if ((delta<-10)&&(wflag==0)) {
	    printf("warning: delta less than -10 \n");
	    printf("lcount=%d, icount=%d, delta=%d \n",lcount,icount,odds+icount-lcount);
	    fprintf(Outfp,"warning: delta less than -2 \n");
	    fprintf(Outfp,"lcount=%d, icount=%d, delta=%d \n",lcount,icount,odds+icount-lcount);
	    }
	 delta=delta+offset;
	 if (delta<0) {
	    printf("error: offset not big enough \n");
	    goto zskip;
	    }
	 if (delta>99) {
	    printf("error: histogram array not big enough \n");
	    goto zskip;
	    }
	 histoi[delta]=histoi[delta]+1;
//
	 delta=(int)m-lcount+icount;
	 if (jump==1)
	    delta=delta-1;
	 if (jump==2)
	    delta=delta-jmpcnt;
	 delta=delta+offset;
	 if (delta<0) {
	    printf("error: offset not big enough \n");
	    printf("m=%d, lcount=%d, icount=%d \n",m,lcount,icount);
	    goto zskip;
	    }
	 if (delta>99) {
	    printf("error: histogram array not big enough \n");
	    goto zskip;
	    }
	 histox[delta]=histox[delta]+1;
//
	 if (((c==hflag1)&&(cflag[index+i]>=indmin)&&(cflag[index+i]<=indmax))||(hflag1==0)) {
	    delta=(int)m-lcount;
	    delta=delta+offset;
	    if (delta<0) {
	       printf("error: offset not big enough \n");
	       printf("m=%d, lcount=%d, icount=%d \n",m,lcount,icount);
	       goto zskip;
	       }
	    if (delta>99) {
	       printf("error: histogram array not big enough \n");
	       goto zskip;
	       }
	    histoy[delta]=histoy[delta]+1;
	    }
//
	 delta=icount;
	 if (jump==1)
	    delta=delta-1;
	 if (jump==2)
	    delta=delta-jmpcnt;
	 delta=delta+offset;
	 if (delta<0) {
	    printf("error: offset not big enough \n");
	    printf("m=%d, lcount=%d, icount=%d \n",m,lcount,icount);
	    goto zskip;
	    }
	 if (delta>99) {
	    printf("error: histogram array not big enough \n");
	    goto zskip;
	    }
	 histoz[delta]=histoz[delta]+1;
//
	 delta=odds-lcount;
	 delta=delta+offset;
	 if (delta<0) {
	    printf("error: offset not big enough \n");
	    printf("m=%d, lcount=%d, icount=%d \n",m,lcount,icount);
	    goto zskip;
	    }
	 if (delta>99) {
	    printf("error: histogram array not big enough \n");
	    goto zskip;
	    }
	 histor[delta]=histor[delta]+1;
	 }
//
      k=(int)odds-(int)m;
      if (wflag==0) {
	 printf("c=%d, s=%d, o=%d, t=%d, u=%d, e=%d, o=%d, e=%d, o=%d, jump=%d, j=%d, d=%d \n",c,s[i],order,t,u,evens,odds,levens,lodds,jump,m,k);
	 fprintf(Outfp,"c=%d, s=%d, o=%d, t=%d, u=%d, e=%d, o=%d, e=%d, o=%d, jump=%d, j=%d, d=%d \n",c,s[i],order,t,u,evens,odds,levens,lodds,jump,m,k);
	 if (evens<odds) {
	    printf("warning: even count less than odd count \n");
	    fprintf(Outfp,"warning: even count less than odd count \n");
	    }
	 }
//
// continued-fraction convergents
//
      for (tempi=0; tempi<27; tempi++) {
	 if ((conv[2*tempi]==(levens+lodds))&&(conv[2*tempi+1]==lodds)) {
	    if ((concov[3*tempi]==0)||(concov[3*tempi]==(unsigned int)c))
	       concov[3*tempi]=c;
	    else {
	       if ((concov[3*tempi+1]==0)||(concov[3*tempi+1]==(unsigned int)c))
		  concov[3*tempi+1]=c;
	       else
		  concov[3*tempi+2]=c;
	       }
	    }
	 if (conv[2*tempi+1]>lodds)
	    break;
	 }
//
      for (tempi=0; tempi<27; tempi++) {
	 if ((conv[2*tempi+1]==levens)&&(conv[2*tempi+1]==lodds)) {
	    if ((concove[3*tempi]==0)||(concove[3*tempi]==(unsigned int)c))
	       concove[3*tempi]=c;
	    else {
	       if ((concove[3*tempi+1]==0)||(concove[3*tempi+1]==(unsigned int)c))
		  concove[3*tempi+1]=c;
	       else
		  concove[3*tempi+2]=c;
	       }
	    if ((4*s[i])!=olds) {
	       delta=(int)m-lcount;
	       delta=delta+offset4;
	       if (delta<0) {
		  printf("array not big enough, delta=%d \n",delta);
		  goto zskip;
		  }
	       if (delta>29) {
		  printf("array not big enough, delta=%d \n",delta);
		  goto zskip;
		  }
	       histoa[delta]=histoa[delta]+1;
	       }
	    }
	 if (conv[2*tempi+1]>lodds)
	    break;
	 }
//
// total odds and evens
//
      if ((4*s[i])!=olds) {
	 oddsum=oddsum+odds;
	 evensum=evensum+lcount;
	 jsum=jsum+m;
	 hcount=hcount+icount;
	 patcnt=patcnt+1;
	 }
//
// compute sum of reciprocals
//
      if ((4*s[i])!=olds) {
	 temp=t;
	 if (temp<0)
	    temp=-temp;
	 sumrec=sumrec+(1.0/(double)temp);
	 temp=u;
	 if (temp<0)
	    temp=-temp;
	 sumrec=sumrec+(1.0/(double)temp);
	 primary=primary+1;
	 }
//
// check chain (u values)
//
      if ((4*s[i])!=olds) {
	 temp=u;
	 if (temp<0)
	    temp=-temp;
	 if (oldchn<(double)temp) {
	    if (wflag!=2) {
	       printf("error: bad chain, c=%d \n",c);
	       printf("chain=%e, u=%d, old u=%d, jump=%d, s=%d  \n",oldchn,u,oldu,jump,s[i]);
	       fprintf(Outfp,"error: bad chain, c=%d \n",c);
	       fprintf(Outfp,"chain=%e, u=%d, old u=%d, jump=%d, s=%d \n",oldchn,u,oldu,jump,s[i]);
	       }
	    badcntu=badcntu+1;
	    }
	 temp=u+c;
	 if (temp<0)
	    temp=-temp;
	 oldchn=(double)temp;
	 oldchn=rat*log(oldchn);
	 oldchn=exp(oldchn);
	 oldu=u;
	 }
//
// check j values for no-jumps
//
      if (jump==0) {
	 if ((m>10)&&(wflag==0)) {
	    printf("warning: multiple-jump with j>10 \n");
	    fprintf(Outfp,"warning: multiple-jump with j>10 \n");
	    }
	 if (((c==hflag)&&(cflag[index+i]>=indmin)&&(cflag[index+i]<=indmax))||(hflag==0)) {
	    if ((4*s[i])!=olds) {
	       if (m>19) {
		  printf("histogram array not big enough \n");
		  goto zskip;
		  }
	       histon[m]=histon[m]+1;
	       }
	    }
	 }
//
// check j values for multiple-jumps
//
      if (jump==2) {
	 if ((m>3)&&(wflag==0)) {
	    printf("warning: multiple-jump with j>3 \n");
	    fprintf(Outfp,"warning: multiple-jump with j>3 \n");
	    }
	 if ((4*s[i])!=olds) {
	    if (m>9) {
	       printf("histogram array not big enough \n");
	       goto zskip;
	       }
	    histom[m]=histom[m]+1;
	    }
	 }
//
// histogram k values
//
      if (((c==hflag)&&(cflag[index+i]>=indmin)&&(cflag[index+i]<=indmax))||(hflag==0)) {
	 if ((jump==1)&&((4*s[i])!=olds)) {
	    delta=k+offset;
	    if (delta<0) {
	       printf("error: offset not big enough \n");
	       goto zskip;
	       }
	    if (delta>99) {
	       printf("error: histogram array not big enough \n");
	       goto zskip;
	       }
	    histoj[delta]=histoj[delta]+1;
	    }
	 }
//
// histogram evens minus odds
//
      if (jump==1) {
	 delta=(int)evens-(int)odds;
	 delta=delta+offset;
	 if (delta<0) {
	    printf("error: offset not big enough \n");
	    goto zskip;
	    }
	 if (delta>99) {
	    printf("error: histogram array not big enough \n");
	    goto zskip;
	    }
	 histo[delta]=histo[delta]+1;
	 }
//
// find minimum t or u
//
      if ((4*s[i])!=olds) {
	 temp=t;
	 if (temp<0)
	    temp=-temp;
	 if (temp<glomin)
	    glomin=temp;
	 temp=u;
	 if (temp<0)
	    temp=-temp;
	 if (temp<glomin)
	    glomin=temp;
	 a=a+1;
	 }
//
// find local maximum and minimum
//
      k=u;
      locmin=k;
      if (locmin<0)
	 locmin=-locmin;
      locmax=locmin;
      lastodd=locmax;
      k=3*k+c;
      while ((k&7)!=0) {
	 while ((k&1)==0) {
	    k=k/2;
	    }
	 delta=k;
	 if (delta<0)
	    delta=-delta;
	 if (delta<locmin)
	    locmin=delta;
	 if (delta>locmax)
	    locmax=delta;
	 lastodd=delta;
	 k=3*k+c;
	 }
      if ((4*s[i])!=olds) {	   // check if primary
	 if ((lastodd!=locmax)&&(jump==2)) {
	    printf("error: no-jump with local maximum at attachment point \n");
	    printf("locmin=%d, locmax=%d, lastodd=%d \n",locmin,locmax,lastodd);
	    fprintf(Outfp,"error: no-jump with local maximum at attachment point \n");
	    goto zskip;
	    }
	 if (lastodd!=locmax) {
	    if (jump==0)
	       county=county+1;
	    if (jump==1) {
	       countn=countn+1;
	       if (((c==hflag)&&(cflag[index+i]>=indmin)&&(cflag[index+i]<=indmax))||(hflag==0)) {
		  delta=(int)odds-(int)m;
		  delta=delta+offset;
		  if (delta<0) {
		     printf("array not big enough \n");
		     goto zskip;
		     }
		  if (delta>99) {
		     printf("array not big enough \n");
		     goto zskip;
		     }
		  newhis[delta]=newhis[delta]+1;
		  }
	       }
	    if (jump==3)
	       countx=countx+1;
	    }
	 }
      if ((4*s[i])!=olds) {
	 if (locmax>glomax) {
	    glomax=locmax;
	    usave=u;
	    savjmp=jump;
	    }
	 }
//
// check local minimum
//
      if ((jump==1)&&((4*s[i])!=olds)) {
	 mincnt=0;
	 k=u;
	 delta=k;
	 if (delta<0)
	    delta=-delta;
	 if (delta==locmin) {
	    hismin[0]=hismin[0]+1;
	    goto yskip;
	    }
	 while (delta!=locmin) {
	    k=3*k+c;
	    if ((k&3)!=0) {
	       hismin[9]=hismin[9]+1;
	       if (bypass==0)
		  goto pskip;
	       else
		  goto yskip;
	       }
	    k=k/4;
	    delta=k;
	    if (delta<0)
	       delta=-delta;
	    mincnt=mincnt+1;
	    }
	 if (mincnt>8) {
	    printf("error: array not big enough \n");
	    goto zskip;
	    }
	 hismin[mincnt]=hismin[mincnt]+1;
pskip:	 if (((c==hflag)&&(cflag[index+i]>=indmin)&&(cflag[index+i]<=indmax))||(hflag==0)) {
	    delta=(int)odds-(int)m;
	    delta=delta+offset;
	    if (delta<0) {
	       printf("array not big enough \n");
	       goto zskip;
	       }
	    if (delta>99) {
	       printf("array not big enough \n");
	       goto zskip;
	       }
	    oldhis[delta]=oldhis[delta]+1;
	    }
	 }
//
// check multiple-jumps
//
yskip:
      if ((jump==2)&&((4*s[i])!=olds)) {
	 k=u;
	 k=3*k+c;
	 while ((k&7)!=0) {
	    if ((k&3)==0) {
	       printf("error: not one jump from u \n");
	       fprintf(Outfp,"error: not one jump from u \n");
	       goto zskip;
	       }
	    k=k/2;
	    k=3*k+c;
	    }
	 }
//
// check if primary multiple-jumps are preceded by no-jumps
// Note:  Only last primary multiple-jump checked.
//
      if ((jump==2)&&((4*s[i])!=olds)) {
	 k=u*2;
	 if ((((k-c)/3)*3)!=(k-c))
	    k=k*2;
	 tmps=k;
	 mflag=1;
	 }
//
// compute domain
//
      if ((4*s[i])!=olds) {
	 k=t;
	 if (k<0)
	    k=-k;
	 sumtu=sumtu+k;
	 stu[2*total]=k;
	 k=u;
	 if (k<0)
	    k=-k;
	 sumtu=sumtu+k;
	 stu[2*total+1]=k;
	 total=total+1;
	 if (total>1000) {
	    printf("output array too small \n");
	    goto zskip;
	    }
	 }
//
// check for new cycle
//
      if ((cflag[index+i]!=cflag[index+i+1])||(i==(iters-1))) {
	 lambda=(double)sumtu/(double)(total*2);
	 dmin=1000000.0;
	 dmax=-1000000.0;
	 for (g=0; g<total*2; g++) {
	    d=-log((double)stu[g]/lambda)/lambda;
	    if (d<dmin)
	       dmin=d;
	    if (d>dmax)
	       dmax=d;
	    }
	 del=dmax-dmin;
	 if (del>maxdel) {
	    maxdel=del;
	    cmax=c;
	    }
	 if (del<mindel) {
	    mindel=del;
	    cmin=c;
	    }
	 if (wflag==0) {
	    printf("lambda=%e, min=%e, max=%e, del=%e \n",lambda,dmin,dmax,del);
	    fprintf(Outfp,"lambda=%e, min=%e, max=%e, del=%e \n",lambda,dmin,dmax,del);
	    }
	 sumtu=0;
	 total=0;
	 olds=0;
	 cyccnt=cyccnt+1;
//
	 sumrec=sumrec*(double)c;
	 tempf=(double)(levens+lodds)*log(2)-(double)(lodds)*log(3);
	 if (wflag==1) {
	    printf("c=%d, e=%d, o=%d, sum=%e, tempf=%e, osum=%d, esum=%d, jsum=%d, hsum=%d \n",c,levens,lodds,sumrec,tempf,oddsum,evensum,jsum,hcount);
	    fprintf(Outfp,"c=%d, e=%d, o=%d, sum=%e, tempf=%e, osum=%d, esum=%d, jsum=%d, hsum=%d \n",c,levens,lodds,sumrec,tempf,oddsum,evensum,jsum,hcount);
	    }
	 if (tempf<0.0)
	    tempf=-tempf;
	 if (tempf>(3.0*sumrec)) {
	    printf("error: delta greater than sum of reciprocals \n");
	    fprintf(Outfp,"error: delta greater than sum of reciprocals \n");
	    goto zskip;
	    }
	 sumrec=0.0;
//
	 if (savchain<oldt) {
	    if (wflag!=2) {
	       printf("error: bad chain (wrap-around), c=%d \n",c);
	       printf("chain=%e, oldt=%d, savet=%d, jump=%d, count=%d, s=%d \n",savchain,oldt,savet,savjump,savcnt,s[i]);
	       fprintf(Outfp,"error: bad chain (wrap-around), c=%d \n",c);
	       fprintf(Outfp,"chain=%e, oldt=%d, savet=%d, jump=%d, count=%d, s=%d \n",savchain,oldt,savet,savjump,savcnt,s[i]);
	       }
	    badcnt=badcnt+1;
	    }
	 oldt=0;
	 lastt=0;
	 firstt=1;
	 oldchn=1000000000.0;
	 oldu=0;
//
	 delta=oddsum-jmpsum+hcount-evensum+offset1;
	 if (delta<0) {
	    printf("error: offset not big enough, delta=%d \n",delta);
	    goto zskip;
	    }
	 if (delta>99) {
	    printf("error: histogram array not big enough \n");
	    goto zskip;
	    }
	 histoh[delta]=histoh[delta]+1;
	 if (wflag==0) {
	    if ((oddsum+hcount+2)<evensum) {
	       printf("warning: oddsum=%d, hcount=%d, evensum=%d \n",oddsum,hcount,evensum);
	       fprintf(Outfp,"warning: oddsum=%d, hcount=%d, evensum=%d \n",oddsum,hcount,evensum);
	       }
	    }
//
	 delta=hcount-jmpsum+offset1;
	 if (delta<0) {
	    printf("error: offset not big enough, delta=%d \n",delta);
	    goto zskip;
	    }
	 if (delta>99) {
	    printf("error: histogram array not big enough \n");
	    goto zskip;
	    }
	 histow[delta]=histow[delta]+1;
//
	 delta=jsum-evensum+offset2;
	 if (delta<0) {
	    printf("error: offset not big enough, delta=%d \n",delta);
	    goto zskip;
	    }
	 if (delta>199) {
	    printf("error: histogram array not big enough \n");
	    goto zskip;
	    }
	 histov[delta]=histov[delta]+1;
//
	 for (tempi=0; tempi<27; tempi++) {
	    if ((conv[2*tempi+1]==levens)&&(conv[2*tempi+1]==lodds)) {
	       delta=jsum-evensum+offset5;
	       if (delta<0) {
		  printf("array not big enough, delta b=%d \n",delta);
		  goto zskip;
		  }
	       if (delta>29) {
		  printf("array not big enough, delta b=%d \n",delta);
		  goto zskip;
		  }
	       histob[delta]=histob[delta]+1;
	       cyccntb=cyccntb+1;
	       if ((3.0*log(c))<patcnt) {
		  printf("not enough attachment points, c=%d, count=%d \n",c,patcnt);
		  goto zskip;
		  }
	       }
	    if (conv[2*tempi+1]>lodds)
	       break;
	    }
//
	 delta=oddsum-evensum+offset1;
	 if (delta<0) {
	    printf("error: offset not big enough, jsum=%d, delta=%d \n",jsum,delta);
	    goto zskip;
	    }
	 if (delta>99) {
	    printf("error: histogram array not big enough \n");
	    goto zskip;
	    }
	 histos[delta]=histos[delta]+1;
//
// check limit
//
	 if (oddsum>jsum) {
	    tempi=oddsum-jsum;
	    tempf=1.0;
	    for (j=0; j<tempi; j++)
	       tempf=tempf*2.0;
	    tempf=(rat-1.0)*log(tempf);
	    tempf=exp(tempf);
	    tempg=1.0;
	    for (j=0; j<(unsigned int)evensum; j++)
	       tempg=tempg*2.0;
	    tempf=tempf/tempg;
	    if (tempf>1.0) {
	       printf("warning: tempf=%e, tempg=%e, oddsum=%d, jsum=%d, evensum=%d \n",tempf,tempg,oddsum,jsum,evensum);
	       compcnt=compcnt+1;
	       if (tempf>maxcmp)
		  maxcmp=tempf;
	       }
	    }
//
	 if (hsum!=hcount) {
	    printf("mis-matched sums \n");
	    goto zskip;
	    }
	 oddsum=0;
	 evensum=0;
	 jsum=0;
	 jmpsum=0;
	 hcount=0;
//
//  check primary multiple jumps
//
	 if (mflag!=0) {
	    for (j=0; j<attcnt; j++) {
	       if (s[j+savind]==tmps) {
		  if ((jumps[j+savind]!=0)&&(jumps[j+savind]!=3)) {
		     printf("error: one-jump not found \n");
		     goto zskip;
		     }
		  goto vskip;
		  }
	       }
	    printf("error: no match \n");
	    goto zskip;
	    }
vskip:	 if ((3.0*log(c))<patcnt) {
	    if (wflag==0) {
	       printf("not enough attachment points, c=%d, count=%d \n",c,patcnt);
	       fprintf(Outfp,"not enough attachment points, c=%d, count=%d \n",c,patcnt);
	       }
	    if (levens==lodds)
	       equcnt=equcnt+1;
	    }
	 delta=(int)(3.0*log(c))-patcnt+offset6;
	 if (delta<0) {
	    printf("array not big enough (histod): delta=%d \n",delta);
	    goto zskip;
	    }
	 if (delta>399) {
	    printf("array not big enough (histod): delta=%d \n",delta);
	    goto zskip;
	    }
	 histod[delta]=histod[delta]+1;
//
	 attcnt=0;
	 patcnt=0;
	 mflag=0;
	 savind=i+1;
//
// compute inequality
//
	 if (infin==0) {
	    bp=1.0+(double)c/(double)glomin;
	    bm=1.0-(double)c/(double)glomin;
	    if (bm<0.0)
	       bm=-bm;
	    }
	 else {
	    bp=1.0;
	    bm=1.0;
	    }
	 tempf=exp((double)a*log(rat))-1.0;
	 tempg=(double)a/tempf;
	 tempg=ratdel-tempg;
	 cap=exp(tempg*log(bp));
	 cam=exp(tempg*log(bm));
	 cap=3.0*(double)c*(double)a*cap;
	 cam=3.0*(double)c*(double)a*cam;
	 tempg=(rat-1.0)/tempf;
	 tempg=-tempg*(double)lodds;
	 tempg=exp(tempg*log(2.0));
	 cap=cap*tempg;
	 cam=cam*tempg;
	 tempf=(double)(levens+lodds)*log(2)-(double)lodds*log(3);
	 if (tempf<0.0)
	    tempf=-tempf;
	 if ((tempf>cap)||(tempf>cam)) {
	    printf("error: c=%d, e=%d, o=%d, a=%d, cap=%e, cam=%e, tempf=%e \n",c,levens,lodds,a,cap,cam,tempf);
	    fprintf(Outfp,"error: c=%d, e=%d, o=%d, a=%d, cap=%e, cam=%e, tempf=%e \n",c,levens,lodds,a,cap,cam,tempf);
	    badcomp=badcomp+1;
	    }
	 glomin=1000000000;
	 a=0;
//
// check global maximum
//
	 k=usave;
	 locmax=k;
	 if (locmax<0)
	    locmax=-locmax;
	 lastodd=locmax;
	 k=3*k+c;
	 while ((k&7)!=0) {
	    while ((k&1)==0) {
	       k=k/2;
	       }
	    delta=k;
	    if (delta<0)
	       delta=-delta;
	    if (delta>locmax) {
	       locmax=delta;
	       usave=k;
	       }
	    lastodd=delta;
	    k=3*k+c;
	    }
	 if (lastodd!=locmax) {
	    k=usave;
	    k=3*k+c;
	    while ((k&7)!=0) {
	       k=k/2;
	       if ((k&1)==0) {
		  k=k/2;
		  delta=k;
		  if (delta<0)
		     delta=-delta;
		  if (delta==lastodd) {
		     if (savjmp==0)
			goto wskip;
		     else {
			printf("error: not a no-jump attachment point \n");
			fprintf(Outfp,"error: not a no-jump attachment point \n");
			goto zskip;
			}
		     }
		  }
	       k=3*k+c;
	       }
	    if (savjmp!=1) {
	       printf("error: not a one-jump attachment point \n");
	       fprintf(Outfp,"error: not a one-jump attachment point \n");
	       goto zskip;
	       }
wskip:	    delta=0;
	    }
	 glomax=0;
	 }
      else
	 olds=s[i];
      }
   index=index+iters;
   if (wflag==0) {
      printf("\n");
      fprintf(Outfp,"\n");
      }
   }
printf("maxdel=%e, c=%d, mindel=%e, c=%d \n",maxdel,cmax,mindel,cmin);
fprintf(Outfp,"maxdel=%e, c=%d, mindel=%e, c=%d \n",maxdel,cmax,mindel,cmin);
printf("\n");
fprintf(Outfp,"\n");
//
// output histogram of evens minus odds
//
printf("histogram of number of evens minus odds in extended sequences \n");
fprintf(Outfp,"histogram of number evens minus odds in extended sequences \n");
flag=99;
for (i=99; i>0; i--) {
   if (histo[i]==0)
      continue;
   else {
      flag=i;
      break;
      }
   }
first=0;
for (i=0; i<=(int)flag; i++) {
   if ((histo[i]==0)&&(first==0))
      continue;
   first=1;
   fprintf(Outfp,"i=%d, h[i]=%d \n",i-offset,histo[i]);
   printf("i=%d, h[i]=%d \n",i-offset,histo[i]);
   }
//
// output histogram of k values (for primary one-jump attachment points)
//
printf("\n");
fprintf(Outfp,"\n");
printf("histogram of k values for primary one-jump attachment points \n");
fprintf(Outfp,"histogram of k values for primary one-jump attachment points \n");
printf("c=%d \n",hflag);
fprintf(Outfp,"c=%d \n",hflag);
flag=99;
for (i=99; i>0; i--) {
   if (histoj[i]==0)
      continue;
   else {
      flag=i;
      break;
      }
   }
first=0;
for (i=0; i<=(int)flag; i++) {
   if ((histoj[i]==0)&&(first==0))
      continue;
   first=1;
   fprintf(Outfp,"i=%d, h[i]=%d \n",i-offset,histoj[i]);
   printf("i=%d, h[i]=%d \n",i-offset,histoj[i]);
   }
//
// output histogram of hops
//
printf("\n");
fprintf(Outfp,"\n");
printf("number of hops before local minimum is reached \n");
fprintf(Outfp,"number of hops before local minimum is reached \n");
for (i=0; i<10; i++) {
   printf("i=%d, h=%d \n",i,hismin[i]);
   fprintf(Outfp,"i=%d, h=%d \n",i,hismin[i]);
   }
//
// output histogram of j values for primary no-jumps
//
printf("\n");
fprintf(Outfp,"\n");
printf("j values for primary no-jumps \n");
fprintf(Outfp,"j values for primary no-jumps \n");
for (i=0; i<20; i++) {
   printf("i=%d, h=%d \n",i,histon[i]);
   fprintf(Outfp,"i=%d, h=%d \n",i,histon[i]);
   }
//
// output histogram of j values for primary multiple-jumps
//
printf("\n");
fprintf(Outfp,"\n");
printf("j values for primary multiple-jumps \n");
fprintf(Outfp,"j values for primary multiple-jumps \n");
for (i=0; i<10; i++) {
   printf("i=%d, h=%d \n",i,histom[i]);
   fprintf(Outfp,"i=%d, h=%d \n",i,histom[i]);
   }
//
// last odd counts
//
printf("\n");
fprintf(Outfp,"\n");
printf("no-jump count=%d, one-jump count=%d, jumped-over=%d \n",county,countn,countx);
fprintf(Outfp,"no-jump count=%d, one-jump count=%d, jumped-over=%d \n",county,countn,countx);
//
// output histogram of k values (for primary one-jump attachment points)
//
printf("primary one-jump attachment points, last odd not equal to locmax \n");
fprintf(Outfp,"primary one-jump attachment points, last odd not equal to locmax \n");
printf("c=%d \n",hflag);
fprintf(Outfp,"c=%d \n",hflag);
flag=99;
for (i=99; i>0; i--) {
   if (newhis[i]==0)
      continue;
   else {
      flag=i;
      break;
      }
   }
first=0;
for (i=0; i<=(int)flag; i++) {
   if ((newhis[i]==0)&&(first==0))
      continue;
   first=1;
   fprintf(Outfp,"i=%d, h[i]=%d \n",i-offset,newhis[i]);
   printf("i=%d, h[i]=%d \n",i-offset,newhis[i]);
   }
//
// output histogram of k values (for primary one-jump attachment points)
//
printf("\n");
fprintf(Outfp,"\n");
printf("primary one-jump attachment points, u not equal to locmin \n");
fprintf(Outfp,"primary one-jump attachment points, u not equal to locmin \n");
printf("c=%d \n",hflag);
fprintf(Outfp,"c=%d \n",hflag);
flag=99;
for (i=99; i>0; i--) {
   if (oldhis[i]==0)
      continue;
   else {
      flag=i;
      break;
      }
   }
first=0;
for (i=0; i<=(int)flag; i++) {
   if ((oldhis[i]==0)&&(first==0))
      continue;
   first=1;
   fprintf(Outfp,"i=%d, h[i]=%d \n",i-offset,oldhis[i]);
   printf("i=%d, h[i]=%d \n",i-offset,oldhis[i]);
   }
printf("\n");
fprintf(Outfp,"\n");
//
// output histogram of odd sum plus hops minus number of evens
//
printf("odd sum minus jump sum plus hops minus number of evens \n");
fprintf(Outfp,"odd sum minus jump sum plus hops minus number of evens (global, histoh \n");
flag=99;
for (i=99; i>0; i--) {
   if (histoh[i]==0)
      continue;
   else {
      flag=i;
      break;
      }
   }
first=0;
for (i=0; i<=(int)flag; i++) {
   if ((histoh[i]==0)&&(first==0))
      continue;
   first=1;
   fprintf(Outfp,"i=%d, h[i]=%d, \n",i-offset1,histoh[i]);
   printf("i=%d, h[i]=%d \n",i-offset1,histoh[i]);
   }
printf("\n");
fprintf(Outfp,"\n");
//
// output histogram of odd sum plus hops minus number of evens
//
printf("number of odds minus jumps plus hops minus number of evens (local) \n");
fprintf(Outfp,"number of odds minus jumps plus hops minus number of evens (local, histoi) \n");
flag=99;
for (i=99; i>0; i--) {
   if (histoi[i]==0)
      continue;
   else {
      flag=i;
      break;
      }
   }
first=0;
for (i=0; i<=(int)flag; i++) {
   if ((histoi[i]==0)&&(first==0))
      continue;
   first=1;
   fprintf(Outfp,"i=%d, h[i]=%d, \n",i-offset,histoi[i]);
   printf("i=%d, h[i]=%d \n",i-offset,histoi[i]);
   }
printf("\n");
fprintf(Outfp,"\n");
//
// output histogram of j minus number of evens plus number of hops
//
printf("j minus number of evens plus number of hops minus jumps \n");
fprintf(Outfp,"j minus number of evens plus number of hops minus jumps (local, histox \n");
flag=99;
for (i=99; i>0; i--) {
   if (histox[i]==0)
      continue;
   else {
      flag=i;
      break;
      }
   }
first=0;
for (i=0; i<=(int)flag; i++) {
   if ((histox[i]==0)&&(first==0))
      continue;
   first=1;
   fprintf(Outfp,"i=%d, h[i]=%d, \n",i-offset,histox[i]);
   printf("i=%d, h[i]=%d \n",i-offset,histox[i]);
   }
printf("\n");
fprintf(Outfp,"\n");
//
// output histogram of j minus number of evens (local)
//
printf("j minus number of evens (local) \n");
fprintf(Outfp,"j minus number of evens (local, histoy) \n");
flag=99;
for (i=99; i>0; i--) {
   if (histoy[i]==0)
      continue;
   else {
      flag=i;
      break;
      }
   }
first=0;
sum=0;
tempi=0;
for (i=0; i<=(int)flag; i++) {
   if ((histoy[i]==0)&&(first==0))
      continue;
   first=1;
   fprintf(Outfp,"i=%d, h[i]=%d, \n",i-offset,histoy[i]);
   printf("i=%d, h[i]=%d \n",i-offset,histoy[i]);
   sum=sum+histoy[i]*(i-offset);
   tempi=tempi+histoy[i];
   }
mean=(double)sum/(double)tempi;
first=0;
var=0.0;
for (i=0; i<=(int)flag; i++) {
   if ((histoy[i]==0)&&(first==0))
      continue;
   first=1;
   tempf=(double)i-(double)offset-mean;
   var=var+tempf*tempf*(double)histoy[i];
   }
var=var/(double)(tempi-1);
std=sqrt(var);
printf("mean=%e, standard deviation=%e \n",mean,std);
fprintf(Outfp,"mean=%e, standard deviation=%e \n",mean,std);
printf("\n");
fprintf(Outfp,"\n");
//
// output histogram of j minus number of evens
//
printf("j minus number of evens (global) \n");
fprintf(Outfp,"j minus number of evens (global, histov) \n");
flag=199;
for (i=199; i>0; i--) {
   if (histov[i]==0)
      continue;
   else {
      flag=i;
      break;
      }
   }
first=0;
for (i=0; i<=(int)flag; i++) {
   if ((histov[i]==0)&&(first==0))
      continue;
   first=1;
   fprintf(Outfp,"i=%d, h[i]=%d, \n",i-offset2,histov[i]);
   printf("i=%d, h[i]=%d \n",i-offset2,histov[i]);
   }
printf("\n");
fprintf(Outfp,"\n");
//
// output histogram of hops minus jumps
//
printf("hops minus number of jumps (local) \n");
fprintf(Outfp,"hops minus number of jumps (local, histoz) \n");
flag=99;
for (i=99; i>0; i--) {
   if (histoz[i]==0)
      continue;
   else {
      flag=i;
      break;
      }
   }
first=0;
for (i=0; i<=(int)flag; i++) {
   if ((histoz[i]==0)&&(first==0))
      continue;
   first=1;
   fprintf(Outfp,"i=%d, h[i]=%d, \n",i-offset,histoz[i]);
   printf("i=%d, h[i]=%d \n",i-offset,histoz[i]);
   }
//
// output histogram of hops minus jumps (global)
//
printf("\n");
fprintf(Outfp,"\n");
printf("hops minus number of jumps \n");
fprintf(Outfp,"hops minus number of jumps (global, histow) \n");
flag=99;
for (i=99; i>0; i--) {
   if (histow[i]==0)
      continue;
   else {
      flag=i;
      break;
      }
   }
first=0;
for (i=0; i<=(int)flag; i++) {
   if ((histow[i]==0)&&(first==0))
      continue;
   first=1;
   fprintf(Outfp,"i=%d, h[i]=%d, \n",i-offset1,histow[i]);
   printf("i=%d, h[i]=%d \n",i-offset1,histow[i]);
   }
printf("\n");
fprintf(Outfp,"\n");
//
// output histogram of odds minus evens (global)
//
printf("sum of odds minus sum of evens (global) \n");
fprintf(Outfp,"sum of odds minus sum of evens (global, histos) \n");
flag=99;
for (i=99; i>0; i--) {
   if (histos[i]==0)
      continue;
   else {
      flag=i;
      break;
      }
   }
first=0;
for (i=0; i<=(int)flag; i++) {
   if ((histos[i]==0)&&(first==0))
      continue;
   first=1;
   fprintf(Outfp,"i=%d, h[i]=%d, \n",i-offset1,histos[i]);
   printf("i=%d, h[i]=%d \n",i-offset1,histos[i]);
   }
printf("\n");
fprintf(Outfp,"\n");
//
// output histogram of odds minus evens (local)
//
printf("odds minus evens (local) \n");
fprintf(Outfp,"odds minus evens (local, histor) \n");
flag=99;
for (i=99; i>0; i--) {
   if (histor[i]==0)
      continue;
   else {
      flag=i;
      break;
      }
   }
first=0;
for (i=0; i<=(int)flag; i++) {
   if ((histor[i]==0)&&(first==0))
      continue;
   first=1;
   fprintf(Outfp,"i=%d, h[i]=%d, \n",i-offset,histor[i]);
   printf("i=%d, h[i]=%d \n",i-offset,histor[i]);
   }
//
// output histogram of j minus evens (continued-fraction convergents)
//
printf("\n");
fprintf(Outfp,"\n");
printf("j minus evens (convergents, evens equal odds) \n");
fprintf(Outfp,"j minus evens (convergents, evens equal odds, local, histoa) \n");
flag=29;
for (i=29; i>0; i--) {
   if (histoa[i]==0)
      flag=flag-1;
   else
      break;
   }
sum=0;
tempi=0;
first=0;
for (i=0; i<=(int)flag; i++) {
   if ((histoa[i]==0)&&(first==0))
      continue;
   first=1;
   fprintf(Outfp,"i=%d, h[i]=%d, \n",i-offset4,histoa[i]);
   printf("i=%d, h[i]=%d \n",i-offset4,histoa[i]);
   sum=sum+histoa[i]*(i-offset4);
   tempi=tempi+histoa[i];
   }
mean=(double)sum/(double)tempi;
printf("n=%d, sum=%d, mean=%e \n",tempi,sum,mean);
fprintf(Outfp,"n=%d, sum=%d, mean=%e \n",tempi,sum,mean);
//
// output histogram of j minus evens (continued-fraction convergents)
//
printf("\n");
fprintf(Outfp,"\n");
printf("j minus evens (convergents, evens equal odds, global) \n");
fprintf(Outfp,"j minus evens (convergents, evens equal odds, global, histob) \n");
flag=29;
for (i=29; i>0; i--) {
   if (histob[i]==0)
      flag=flag-1;
   else
      break;
   }
first=0;
for (i=0; i<=(int)flag; i++) {
   if ((histob[i]==0)&&(first==0))
      continue;
   first=1;
   fprintf(Outfp,"i=%d, h[i]=%d, \n",i-offset5,histob[i]);
   printf("i=%d, h[i]=%d \n",i-offset5,histob[i]);
   }
//
// output histogram
//
printf("\n");
fprintf(Outfp,"\n");
printf("3*log(c)-a \n");
fprintf(Outfp,"3*log(c)-a \n"                                                   );
flag=399;
for (i=399; i>0; i--) {
   if (histod[i]==0)
      flag=flag-1;
   else
      break;
   }
first=0;
for (i=0; i<=(int)flag; i++) {
   if ((histod[i]==0)&&(first==0))
      continue;
   first=1;
   fprintf(Outfp,"i=%d, h[i]=%d, \n",i-offset6,histod[i]);
   printf("i=%d, h[i]=%d \n",i-offset6,histod[i]);
   }
printf("\n");
fprintf(Outfp,"\n");
printf("cycle count=%d, multiple-jump count=%d, two-jump count=%d, non-adjacent count=%d \n",cyccnt,mcount,twojmp,jmphop);
printf("total jumps (in multiple-jumps)=%d, total hops (in multiple-jumps)=%d \n",glojmp,glohop);
printf("hop/hop=%d, jump/hop=%d, hop/jump=%d, jump/jump=%d \n",twojmp0,twojmp1,twojmp2,twojmp3);
fprintf(Outfp,"cycle count=%d, multiple-jump count=%d, two-jump count=%d, non=adjacent count=%d \n",cyccnt,mcount,twojmp,jmphop);
fprintf(Outfp,"total jumps (in multiple-jumps)=%d, total hops (in multiple-jumps)=%d \n",glojmp,glohop);
fprintf(Outfp,"hop/hop=%d, jump/hop=%d, hop/jump=%d, jump/jump=%d \n",twojmp0,twojmp1,twojmp2,twojmp3);
printf("primary attachment points=%d \n",primary);
fprintf(Outfp,"primary attachment points=%d \n",primary);
printf("bad t chains=%d, bad u chains=%d, bad t-u chains=%d \n",badcnt,badcntu,badtucnt);
fprintf(Outfp,"bad t chains=%d, bad u chains=%d, bad t-u chains=%d \n",badcnt,badcntu,badtucnt);
printf("bad comparisons=%d, other comparisons=%d, maximum=%e \n",badcomp,compcnt,maxcmp);
fprintf(Outfp,"bad comparisons=%d, other comparison=%d, maximum=%e \n",badcomp,compcnt,maxcmp);
printf("cycle count=%d, cycle count=%d (convergents) \n",cyccntu,cyccntb);
fprintf(Outfp,"cycle count=%d, cycle count=%d (convergents) \n",cyccntu,cyccntb);
printf("evens equal odds, bad comparison count=%d \n",equcnt);
fprintf(Outfp,"evens equal odds, bad comparison count=%d \n",equcnt);
printf("\n");
fprintf(Outfp,"\n");
for (i=0; i<27; i++) {
   printf("i=%d, c=%d, c=%d, c=%d \n",i,concov[3*i],concov[3*i+1],concov[3*i+2]);
   fprintf(Outfp,"i=%d, c=%d, c=%d, c=%d \n",i,concov[3*i],concov[3*i+1],concov[3*i+2]);
   }
printf("\n");
fprintf(Outfp,"\n");
for (i=0; i<27; i++) {
   printf("i=%d, c=%d, c=%d, c=%d \n",i,concove[3*i],concove[3*i+1],concove[3*i+2]);
   fprintf(Outfp,"i=%d, c=%d, c=%d, c=%d \n",i,concove[3*i],concove[3*i+1],concove[3*i+2]);
   }
zskip:
fclose(Outfp);
return(0);
}