diff --git a/problem_data/no079.txt b/problem_data/no079.txt new file mode 100644 index 0000000..b6f9903 --- /dev/null +++ b/problem_data/no079.txt @@ -0,0 +1,50 @@ +319 +680 +180 +690 +129 +620 +762 +689 +762 +318 +368 +710 +720 +710 +629 +168 +160 +689 +716 +731 +736 +729 +316 +729 +729 +710 +769 +290 +719 +680 +318 +389 +162 +289 +162 +718 +729 +319 +790 +680 +890 +362 +319 +760 +316 +729 +380 +319 +728 +716 diff --git a/problem_data/no081.txt b/problem_data/no081.txt new file mode 100644 index 0000000..1e9e6cd --- /dev/null +++ b/problem_data/no081.txt @@ -0,0 +1,80 @@ +4445,2697,5115,718,2209,2212,654,4348,3079,6821,7668,3276,8874,4190,3785,2752,9473,7817,9137,496,7338,3434,7152,4355,4552,7917,7827,2460,2350,691,3514,5880,3145,7633,7199,3783,5066,7487,3285,1084,8985,760,872,8609,8051,1134,9536,5750,9716,9371,7619,5617,275,9721,2997,2698,1887,8825,6372,3014,2113,7122,7050,6775,5948,2758,1219,3539,348,7989,2735,9862,1263,8089,6401,9462,3168,2758,3748,5870 +1096,20,1318,7586,5167,2642,1443,5741,7621,7030,5526,4244,2348,4641,9827,2448,6918,5883,3737,300,7116,6531,567,5997,3971,6623,820,6148,3287,1874,7981,8424,7672,7575,6797,6717,1078,5008,4051,8795,5820,346,1851,6463,2117,6058,3407,8211,117,4822,1317,4377,4434,5925,8341,4800,1175,4173,690,8978,7470,1295,3799,8724,3509,9849,618,3320,7068,9633,2384,7175,544,6583,1908,9983,481,4187,9353,9377 +9607,7385,521,6084,1364,8983,7623,1585,6935,8551,2574,8267,4781,3834,2764,2084,2669,4656,9343,7709,2203,9328,8004,6192,5856,3555,2260,5118,6504,1839,9227,1259,9451,1388,7909,5733,6968,8519,9973,1663,5315,7571,3035,4325,4283,2304,6438,3815,9213,9806,9536,196,5542,6907,2475,1159,5820,9075,9470,2179,9248,1828,4592,9167,3713,4640,47,3637,309,7344,6955,346,378,9044,8635,7466,5036,9515,6385,9230 +7206,3114,7760,1094,6150,5182,7358,7387,4497,955,101,1478,7777,6966,7010,8417,6453,4955,3496,107,449,8271,131,2948,6185,784,5937,8001,6104,8282,4165,3642,710,2390,575,715,3089,6964,4217,192,5949,7006,715,3328,1152,66,8044,4319,1735,146,4818,5456,6451,4113,1063,4781,6799,602,1504,6245,6550,1417,1343,2363,3785,5448,4545,9371,5420,5068,4613,4882,4241,5043,7873,8042,8434,3939,9256,2187 +3620,8024,577,9997,7377,7682,1314,1158,6282,6310,1896,2509,5436,1732,9480,706,496,101,6232,7375,2207,2306,110,6772,3433,2878,8140,5933,8688,1399,2210,7332,6172,6403,7333,4044,2291,1790,2446,7390,8698,5723,3678,7104,1825,2040,140,3982,4905,4160,2200,5041,2512,1488,2268,1175,7588,8321,8078,7312,977,5257,8465,5068,3453,3096,1651,7906,253,9250,6021,8791,8109,6651,3412,345,4778,5152,4883,7505 +1074,5438,9008,2679,5397,5429,2652,3403,770,9188,4248,2493,4361,8327,9587,707,9525,5913,93,1899,328,2876,3604,673,8576,6908,7659,2544,3359,3883,5273,6587,3065,1749,3223,604,9925,6941,2823,8767,7039,3290,3214,1787,7904,3421,7137,9560,8451,2669,9219,6332,1576,5477,6755,8348,4164,4307,2984,4012,6629,1044,2874,6541,4942,903,1404,9125,5160,8836,4345,2581,460,8438,1538,5507,668,3352,2678,6942 +4295,1176,5596,1521,3061,9868,7037,7129,8933,6659,5947,5063,3653,9447,9245,2679,767,714,116,8558,163,3927,8779,158,5093,2447,5782,3967,1716,931,7772,8164,1117,9244,5783,7776,3846,8862,6014,2330,6947,1777,3112,6008,3491,1906,5952,314,4602,8994,5919,9214,3995,5026,7688,6809,5003,3128,2509,7477,110,8971,3982,8539,2980,4689,6343,5411,2992,5270,5247,9260,2269,7474,1042,7162,5206,1232,4556,4757 +510,3556,5377,1406,5721,4946,2635,7847,4251,8293,8281,6351,4912,287,2870,3380,3948,5322,3840,4738,9563,1906,6298,3234,8959,1562,6297,8835,7861,239,6618,1322,2553,2213,5053,5446,4402,6500,5182,8585,6900,5756,9661,903,5186,7687,5998,7997,8081,8955,4835,6069,2621,1581,732,9564,1082,1853,5442,1342,520,1737,3703,5321,4793,2776,1508,1647,9101,2499,6891,4336,7012,3329,3212,1442,9993,3988,4930,7706 +9444,3401,5891,9716,1228,7107,109,3563,2700,6161,5039,4992,2242,8541,7372,2067,1294,3058,1306,320,8881,5756,9326,411,8650,8824,5495,8282,8397,2000,1228,7817,2099,6473,3571,5994,4447,1299,5991,543,7874,2297,1651,101,2093,3463,9189,6872,6118,872,1008,1779,2805,9084,4048,2123,5877,55,3075,1737,9459,4535,6453,3644,108,5982,4437,5213,1340,6967,9943,5815,669,8074,1838,6979,9132,9315,715,5048 +3327,4030,7177,6336,9933,5296,2621,4785,2755,4832,2512,2118,2244,4407,2170,499,7532,9742,5051,7687,970,6924,3527,4694,5145,1306,2165,5940,2425,8910,3513,1909,6983,346,6377,4304,9330,7203,6605,3709,3346,970,369,9737,5811,4427,9939,3693,8436,5566,1977,3728,2399,3985,8303,2492,5366,9802,9193,7296,1033,5060,9144,2766,1151,7629,5169,5995,58,7619,7565,4208,1713,6279,3209,4908,9224,7409,1325,8540 +6882,1265,1775,3648,4690,959,5837,4520,5394,1378,9485,1360,4018,578,9174,2932,9890,3696,116,1723,1178,9355,7063,1594,1918,8574,7594,7942,1547,6166,7888,354,6932,4651,1010,7759,6905,661,7689,6092,9292,3845,9605,8443,443,8275,5163,7720,7265,6356,7779,1798,1754,5225,6661,1180,8024,5666,88,9153,1840,3508,1193,4445,2648,3538,6243,6375,8107,5902,5423,2520,1122,5015,6113,8859,9370,966,8673,2442 +7338,3423,4723,6533,848,8041,7921,8277,4094,5368,7252,8852,9166,2250,2801,6125,8093,5738,4038,9808,7359,9494,601,9116,4946,2702,5573,2921,9862,1462,1269,2410,4171,2709,7508,6241,7522,615,2407,8200,4189,5492,5649,7353,2590,5203,4274,710,7329,9063,956,8371,3722,4253,4785,1194,4828,4717,4548,940,983,2575,4511,2938,1827,2027,2700,1236,841,5760,1680,6260,2373,3851,1841,4968,1172,5179,7175,3509 +4420,1327,3560,2376,6260,2988,9537,4064,4829,8872,9598,3228,1792,7118,9962,9336,4368,9189,6857,1829,9863,6287,7303,7769,2707,8257,2391,2009,3975,4993,3068,9835,3427,341,8412,2134,4034,8511,6421,3041,9012,2983,7289,100,1355,7904,9186,6920,5856,2008,6545,8331,3655,5011,839,8041,9255,6524,3862,8788,62,7455,3513,5003,8413,3918,2076,7960,6108,3638,6999,3436,1441,4858,4181,1866,8731,7745,3744,1000 +356,8296,8325,1058,1277,4743,3850,2388,6079,6462,2815,5620,8495,5378,75,4324,3441,9870,1113,165,1544,1179,2834,562,6176,2313,6836,8839,2986,9454,5199,6888,1927,5866,8760,320,1792,8296,7898,6121,7241,5886,5814,2815,8336,1576,4314,3109,2572,6011,2086,9061,9403,3947,5487,9731,7281,3159,1819,1334,3181,5844,5114,9898,4634,2531,4412,6430,4262,8482,4546,4555,6804,2607,9421,686,8649,8860,7794,6672 +9870,152,1558,4963,8750,4754,6521,6256,8818,5208,5691,9659,8377,9725,5050,5343,2539,6101,1844,9700,7750,8114,5357,3001,8830,4438,199,9545,8496,43,2078,327,9397,106,6090,8181,8646,6414,7499,5450,4850,6273,5014,4131,7639,3913,6571,8534,9703,4391,7618,445,1320,5,1894,6771,7383,9191,4708,9706,6939,7937,8726,9382,5216,3685,2247,9029,8154,1738,9984,2626,9438,4167,6351,5060,29,1218,1239,4785 +192,5213,8297,8974,4032,6966,5717,1179,6523,4679,9513,1481,3041,5355,9303,9154,1389,8702,6589,7818,6336,3539,5538,3094,6646,6702,6266,2759,4608,4452,617,9406,8064,6379,444,5602,4950,1810,8391,1536,316,8714,1178,5182,5863,5110,5372,4954,1978,2971,5680,4863,2255,4630,5723,2168,538,1692,1319,7540,440,6430,6266,7712,7385,5702,620,641,3136,7350,1478,3155,2820,9109,6261,1122,4470,14,8493,2095 +1046,4301,6082,474,4974,7822,2102,5161,5172,6946,8074,9716,6586,9962,9749,5015,2217,995,5388,4402,7652,6399,6539,1349,8101,3677,1328,9612,7922,2879,231,5887,2655,508,4357,4964,3554,5930,6236,7384,4614,280,3093,9600,2110,7863,2631,6626,6620,68,1311,7198,7561,1768,5139,1431,221,230,2940,968,5283,6517,2146,1646,869,9402,7068,8645,7058,1765,9690,4152,2926,9504,2939,7504,6074,2944,6470,7859 +4659,736,4951,9344,1927,6271,8837,8711,3241,6579,7660,5499,5616,3743,5801,4682,9748,8796,779,1833,4549,8138,4026,775,4170,2432,4174,3741,7540,8017,2833,4027,396,811,2871,1150,9809,2719,9199,8504,1224,540,2051,3519,7982,7367,2761,308,3358,6505,2050,4836,5090,7864,805,2566,2409,6876,3361,8622,5572,5895,3280,441,7893,8105,1634,2929,274,3926,7786,6123,8233,9921,2674,5340,1445,203,4585,3837 +5759,338,7444,7968,7742,3755,1591,4839,1705,650,7061,2461,9230,9391,9373,2413,1213,431,7801,4994,2380,2703,6161,6878,8331,2538,6093,1275,5065,5062,2839,582,1014,8109,3525,1544,1569,8622,7944,2905,6120,1564,1839,5570,7579,1318,2677,5257,4418,5601,7935,7656,5192,1864,5886,6083,5580,6202,8869,1636,7907,4759,9082,5854,3185,7631,6854,5872,5632,5280,1431,2077,9717,7431,4256,8261,9680,4487,4752,4286 +1571,1428,8599,1230,7772,4221,8523,9049,4042,8726,7567,6736,9033,2104,4879,4967,6334,6716,3994,1269,8995,6539,3610,7667,6560,6065,874,848,4597,1711,7161,4811,6734,5723,6356,6026,9183,2586,5636,1092,7779,7923,8747,6887,7505,9909,1792,3233,4526,3176,1508,8043,720,5212,6046,4988,709,5277,8256,3642,1391,5803,1468,2145,3970,6301,7767,2359,8487,9771,8785,7520,856,1605,8972,2402,2386,991,1383,5963 +1822,4824,5957,6511,9868,4113,301,9353,6228,2881,2966,6956,9124,9574,9233,1601,7340,973,9396,540,4747,8590,9535,3650,7333,7583,4806,3593,2738,8157,5215,8472,2284,9473,3906,6982,5505,6053,7936,6074,7179,6688,1564,1103,6860,5839,2022,8490,910,7551,7805,881,7024,1855,9448,4790,1274,3672,2810,774,7623,4223,4850,6071,9975,4935,1915,9771,6690,3846,517,463,7624,4511,614,6394,3661,7409,1395,8127 +8738,3850,9555,3695,4383,2378,87,6256,6740,7682,9546,4255,6105,2000,1851,4073,8957,9022,6547,5189,2487,303,9602,7833,1628,4163,6678,3144,8589,7096,8913,5823,4890,7679,1212,9294,5884,2972,3012,3359,7794,7428,1579,4350,7246,4301,7779,7790,3294,9547,4367,3549,1958,8237,6758,3497,3250,3456,6318,1663,708,7714,6143,6890,3428,6853,9334,7992,591,6449,9786,1412,8500,722,5468,1371,108,3939,4199,2535 +7047,4323,1934,5163,4166,461,3544,2767,6554,203,6098,2265,9078,2075,4644,6641,8412,9183,487,101,7566,5622,1975,5726,2920,5374,7779,5631,3753,3725,2672,3621,4280,1162,5812,345,8173,9785,1525,955,5603,2215,2580,5261,2765,2990,5979,389,3907,2484,1232,5933,5871,3304,1138,1616,5114,9199,5072,7442,7245,6472,4760,6359,9053,7876,2564,9404,3043,9026,2261,3374,4460,7306,2326,966,828,3274,1712,3446 +3975,4565,8131,5800,4570,2306,8838,4392,9147,11,3911,7118,9645,4994,2028,6062,5431,2279,8752,2658,7836,994,7316,5336,7185,3289,1898,9689,2331,5737,3403,1124,2679,3241,7748,16,2724,5441,6640,9368,9081,5618,858,4969,17,2103,6035,8043,7475,2181,939,415,1617,8500,8253,2155,7843,7974,7859,1746,6336,3193,2617,8736,4079,6324,6645,8891,9396,5522,6103,1857,8979,3835,2475,1310,7422,610,8345,7615 +9248,5397,5686,2988,3446,4359,6634,9141,497,9176,6773,7448,1907,8454,916,1596,2241,1626,1384,2741,3649,5362,8791,7170,2903,2475,5325,6451,924,3328,522,90,4813,9737,9557,691,2388,1383,4021,1609,9206,4707,5200,7107,8104,4333,9860,5013,1224,6959,8527,1877,4545,7772,6268,621,4915,9349,5970,706,9583,3071,4127,780,8231,3017,9114,3836,7503,2383,1977,4870,8035,2379,9704,1037,3992,3642,1016,4303 +5093,138,4639,6609,1146,5565,95,7521,9077,2272,974,4388,2465,2650,722,4998,3567,3047,921,2736,7855,173,2065,4238,1048,5,6847,9548,8632,9194,5942,4777,7910,8971,6279,7253,2516,1555,1833,3184,9453,9053,6897,7808,8629,4877,1871,8055,4881,7639,1537,7701,2508,7564,5845,5023,2304,5396,3193,2955,1088,3801,6203,1748,3737,1276,13,4120,7715,8552,3047,2921,106,7508,304,1280,7140,2567,9135,5266 +6237,4607,7527,9047,522,7371,4883,2540,5867,6366,5301,1570,421,276,3361,527,6637,4861,2401,7522,5808,9371,5298,2045,5096,5447,7755,5115,7060,8529,4078,1943,1697,1764,5453,7085,960,2405,739,2100,5800,728,9737,5704,5693,1431,8979,6428,673,7540,6,7773,5857,6823,150,5869,8486,684,5816,9626,7451,5579,8260,3397,5322,6920,1879,2127,2884,5478,4977,9016,6165,6292,3062,5671,5968,78,4619,4763 +9905,7127,9390,5185,6923,3721,9164,9705,4341,1031,1046,5127,7376,6528,3248,4941,1178,7889,3364,4486,5358,9402,9158,8600,1025,874,1839,1783,309,9030,1843,845,8398,1433,7118,70,8071,2877,3904,8866,6722,4299,10,1929,5897,4188,600,1889,3325,2485,6473,4474,7444,6992,4846,6166,4441,2283,2629,4352,7775,1101,2214,9985,215,8270,9750,2740,8361,7103,5930,8664,9690,8302,9267,344,2077,1372,1880,9550 +5825,8517,7769,2405,8204,1060,3603,7025,478,8334,1997,3692,7433,9101,7294,7498,9415,5452,3850,3508,6857,9213,6807,4412,7310,854,5384,686,4978,892,8651,3241,2743,3801,3813,8588,6701,4416,6990,6490,3197,6838,6503,114,8343,5844,8646,8694,65,791,5979,2687,2621,2019,8097,1423,3644,9764,4921,3266,3662,5561,2476,8271,8138,6147,1168,3340,1998,9874,6572,9873,6659,5609,2711,3931,9567,4143,7833,8887 +6223,2099,2700,589,4716,8333,1362,5007,2753,2848,4441,8397,7192,8191,4916,9955,6076,3370,6396,6971,3156,248,3911,2488,4930,2458,7183,5455,170,6809,6417,3390,1956,7188,577,7526,2203,968,8164,479,8699,7915,507,6393,4632,1597,7534,3604,618,3280,6061,9793,9238,8347,568,9645,2070,5198,6482,5000,9212,6655,5961,7513,1323,3872,6170,3812,4146,2736,67,3151,5548,2781,9679,7564,5043,8587,1893,4531 +5826,3690,6724,2121,9308,6986,8106,6659,2142,1642,7170,2877,5757,6494,8026,6571,8387,9961,6043,9758,9607,6450,8631,8334,7359,5256,8523,2225,7487,1977,9555,8048,5763,2414,4948,4265,2427,8978,8088,8841,9208,9601,5810,9398,8866,9138,4176,5875,7212,3272,6759,5678,7649,4922,5422,1343,8197,3154,3600,687,1028,4579,2084,9467,4492,7262,7296,6538,7657,7134,2077,1505,7332,6890,8964,4879,7603,7400,5973,739 +1861,1613,4879,1884,7334,966,2000,7489,2123,4287,1472,3263,4726,9203,1040,4103,6075,6049,330,9253,4062,4268,1635,9960,577,1320,3195,9628,1030,4092,4979,6474,6393,2799,6967,8687,7724,7392,9927,2085,3200,6466,8702,265,7646,8665,7986,7266,4574,6587,612,2724,704,3191,8323,9523,3002,704,5064,3960,8209,2027,2758,8393,4875,4641,9584,6401,7883,7014,768,443,5490,7506,1852,2005,8850,5776,4487,4269 +4052,6687,4705,7260,6645,6715,3706,5504,8672,2853,1136,8187,8203,4016,871,1809,1366,4952,9294,5339,6872,2645,6083,7874,3056,5218,7485,8796,7401,3348,2103,426,8572,4163,9171,3176,948,7654,9344,3217,1650,5580,7971,2622,76,2874,880,2034,9929,1546,2659,5811,3754,7096,7436,9694,9960,7415,2164,953,2360,4194,2397,1047,2196,6827,575,784,2675,8821,6802,7972,5996,6699,2134,7577,2887,1412,4349,4380 +4629,2234,6240,8132,7592,3181,6389,1214,266,1910,2451,8784,2790,1127,6932,1447,8986,2492,5476,397,889,3027,7641,5083,5776,4022,185,3364,5701,2442,2840,4160,9525,4828,6602,2614,7447,3711,4505,7745,8034,6514,4907,2605,7753,6958,7270,6936,3006,8968,439,2326,4652,3085,3425,9863,5049,5361,8688,297,7580,8777,7916,6687,8683,7141,306,9569,2384,1500,3346,4601,7329,9040,6097,2727,6314,4501,4974,2829 +8316,4072,2025,6884,3027,1808,5714,7624,7880,8528,4205,8686,7587,3230,1139,7273,6163,6986,3914,9309,1464,9359,4474,7095,2212,7302,2583,9462,7532,6567,1606,4436,8981,5612,6796,4385,5076,2007,6072,3678,8331,1338,3299,8845,4783,8613,4071,1232,6028,2176,3990,2148,3748,103,9453,538,6745,9110,926,3125,473,5970,8728,7072,9062,1404,1317,5139,9862,6496,6062,3338,464,1600,2532,1088,8232,7739,8274,3873 +2341,523,7096,8397,8301,6541,9844,244,4993,2280,7689,4025,4196,5522,7904,6048,2623,9258,2149,9461,6448,8087,7245,1917,8340,7127,8466,5725,6996,3421,5313,512,9164,9837,9794,8369,4185,1488,7210,1524,1016,4620,9435,2478,7765,8035,697,6677,3724,6988,5853,7662,3895,9593,1185,4727,6025,5734,7665,3070,138,8469,6748,6459,561,7935,8646,2378,462,7755,3115,9690,8877,3946,2728,8793,244,6323,8666,4271 +6430,2406,8994,56,1267,3826,9443,7079,7579,5232,6691,3435,6718,5698,4144,7028,592,2627,217,734,6194,8156,9118,58,2640,8069,4127,3285,694,3197,3377,4143,4802,3324,8134,6953,7625,3598,3584,4289,7065,3434,2106,7132,5802,7920,9060,7531,3321,1725,1067,3751,444,5503,6785,7937,6365,4803,198,6266,8177,1470,6390,1606,2904,7555,9834,8667,2033,1723,5167,1666,8546,8152,473,4475,6451,7947,3062,3281 +2810,3042,7759,1741,2275,2609,7676,8640,4117,1958,7500,8048,1757,3954,9270,1971,4796,2912,660,5511,3553,1012,5757,4525,6084,7198,8352,5775,7726,8591,7710,9589,3122,4392,6856,5016,749,2285,3356,7482,9956,7348,2599,8944,495,3462,3578,551,4543,7207,7169,7796,1247,4278,6916,8176,3742,8385,2310,1345,8692,2667,4568,1770,8319,3585,4920,3890,4928,7343,5385,9772,7947,8786,2056,9266,3454,2807,877,2660 +6206,8252,5928,5837,4177,4333,207,7934,5581,9526,8906,1498,8411,2984,5198,5134,2464,8435,8514,8674,3876,599,5327,826,2152,4084,2433,9327,9697,4800,2728,3608,3849,3861,3498,9943,1407,3991,7191,9110,5666,8434,4704,6545,5944,2357,1163,4995,9619,6754,4200,9682,6654,4862,4744,5953,6632,1054,293,9439,8286,2255,696,8709,1533,1844,6441,430,1999,6063,9431,7018,8057,2920,6266,6799,356,3597,4024,6665 +3847,6356,8541,7225,2325,2946,5199,469,5450,7508,2197,9915,8284,7983,6341,3276,3321,16,1321,7608,5015,3362,8491,6968,6818,797,156,2575,706,9516,5344,5457,9210,5051,8099,1617,9951,7663,8253,9683,2670,1261,4710,1068,8753,4799,1228,2621,3275,6188,4699,1791,9518,8701,5932,4275,6011,9877,2933,4182,6059,2930,6687,6682,9771,654,9437,3169,8596,1827,5471,8909,2352,123,4394,3208,8756,5513,6917,2056 +5458,8173,3138,3290,4570,4892,3317,4251,9699,7973,1163,1935,5477,6648,9614,5655,9592,975,9118,2194,7322,8248,8413,3462,8560,1907,7810,6650,7355,2939,4973,6894,3933,3784,3200,2419,9234,4747,2208,2207,1945,2899,1407,6145,8023,3484,5688,7686,2737,3828,3704,9004,5190,9740,8643,8650,5358,4426,1522,1707,3613,9887,6956,2447,2762,833,1449,9489,2573,1080,4167,3456,6809,2466,227,7125,2759,6250,6472,8089 +3266,7025,9756,3914,1265,9116,7723,9788,6805,5493,2092,8688,6592,9173,4431,4028,6007,7131,4446,4815,3648,6701,759,3312,8355,4485,4187,5188,8746,7759,3528,2177,5243,8379,3838,7233,4607,9187,7216,2190,6967,2920,6082,7910,5354,3609,8958,6949,7731,494,8753,8707,1523,4426,3543,7085,647,6771,9847,646,5049,824,8417,5260,2730,5702,2513,9275,4279,2767,8684,1165,9903,4518,55,9682,8963,6005,2102,6523 +1998,8731,936,1479,5259,7064,4085,91,7745,7136,3773,3810,730,8255,2705,2653,9790,6807,2342,355,9344,2668,3690,2028,9679,8102,574,4318,6481,9175,5423,8062,2867,9657,7553,3442,3920,7430,3945,7639,3714,3392,2525,4995,4850,2867,7951,9667,486,9506,9888,781,8866,1702,3795,90,356,1483,4200,2131,6969,5931,486,6880,4404,1084,5169,4910,6567,8335,4686,5043,2614,3352,2667,4513,6472,7471,5720,1616 +8878,1613,1716,868,1906,2681,564,665,5995,2474,7496,3432,9491,9087,8850,8287,669,823,347,6194,2264,2592,7871,7616,8508,4827,760,2676,4660,4881,7572,3811,9032,939,4384,929,7525,8419,5556,9063,662,8887,7026,8534,3111,1454,2082,7598,5726,6687,9647,7608,73,3014,5063,670,5461,5631,3367,9796,8475,7908,5073,1565,5008,5295,4457,1274,4788,1728,338,600,8415,8535,9351,7750,6887,5845,1741,125 +3637,6489,9634,9464,9055,2413,7824,9517,7532,3577,7050,6186,6980,9365,9782,191,870,2497,8498,2218,2757,5420,6468,586,3320,9230,1034,1393,9886,5072,9391,1178,8464,8042,6869,2075,8275,3601,7715,9470,8786,6475,8373,2159,9237,2066,3264,5000,679,355,3069,4073,494,2308,5512,4334,9438,8786,8637,9774,1169,1949,6594,6072,4270,9158,7916,5752,6794,9391,6301,5842,3285,2141,3898,8027,4310,8821,7079,1307 +8497,6681,4732,7151,7060,5204,9030,7157,833,5014,8723,3207,9796,9286,4913,119,5118,7650,9335,809,3675,2597,5144,3945,5090,8384,187,4102,1260,2445,2792,4422,8389,9290,50,1765,1521,6921,8586,4368,1565,5727,7855,2003,4834,9897,5911,8630,5070,1330,7692,7557,7980,6028,5805,9090,8265,3019,3802,698,9149,5748,1965,9658,4417,5994,5584,8226,2937,272,5743,1278,5698,8736,2595,6475,5342,6596,1149,6920 +8188,8009,9546,6310,8772,2500,9846,6592,6872,3857,1307,8125,7042,1544,6159,2330,643,4604,7899,6848,371,8067,2062,3200,7295,1857,9505,6936,384,2193,2190,301,8535,5503,1462,7380,5114,4824,8833,1763,4974,8711,9262,6698,3999,2645,6937,7747,1128,2933,3556,7943,2885,3122,9105,5447,418,2899,5148,3699,9021,9501,597,4084,175,1621,1,1079,6067,5812,4326,9914,6633,5394,4233,6728,9084,1864,5863,1225 +9935,8793,9117,1825,9542,8246,8437,3331,9128,9675,6086,7075,319,1334,7932,3583,7167,4178,1726,7720,695,8277,7887,6359,5912,1719,2780,8529,1359,2013,4498,8072,1129,9998,1147,8804,9405,6255,1619,2165,7491,1,8882,7378,3337,503,5758,4109,3577,985,3200,7615,8058,5032,1080,6410,6873,5496,1466,2412,9885,5904,4406,3605,8770,4361,6205,9193,1537,9959,214,7260,9566,1685,100,4920,7138,9819,5637,976 +3466,9854,985,1078,7222,8888,5466,5379,3578,4540,6853,8690,3728,6351,7147,3134,6921,9692,857,3307,4998,2172,5783,3931,9417,2541,6299,13,787,2099,9131,9494,896,8600,1643,8419,7248,2660,2609,8579,91,6663,5506,7675,1947,6165,4286,1972,9645,3805,1663,1456,8853,5705,9889,7489,1107,383,4044,2969,3343,152,7805,4980,9929,5033,1737,9953,7197,9158,4071,1324,473,9676,3984,9680,3606,8160,7384,5432 +1005,4512,5186,3953,2164,3372,4097,3247,8697,3022,9896,4101,3871,6791,3219,2742,4630,6967,7829,5991,6134,1197,1414,8923,8787,1394,8852,5019,7768,5147,8004,8825,5062,9625,7988,1110,3992,7984,9966,6516,6251,8270,421,3723,1432,4830,6935,8095,9059,2214,6483,6846,3120,1587,6201,6691,9096,9627,6671,4002,3495,9939,7708,7465,5879,6959,6634,3241,3401,2355,9061,2611,7830,3941,2177,2146,5089,7079,519,6351 +7280,8586,4261,2831,7217,3141,9994,9940,5462,2189,4005,6942,9848,5350,8060,6665,7519,4324,7684,657,9453,9296,2944,6843,7499,7847,1728,9681,3906,6353,5529,2822,3355,3897,7724,4257,7489,8672,4356,3983,1948,6892,7415,4153,5893,4190,621,1736,4045,9532,7701,3671,1211,1622,3176,4524,9317,7800,5638,6644,6943,5463,3531,2821,1347,5958,3436,1438,2999,994,850,4131,2616,1549,3465,5946,690,9273,6954,7991 +9517,399,3249,2596,7736,2142,1322,968,7350,1614,468,3346,3265,7222,6086,1661,5317,2582,7959,4685,2807,2917,1037,5698,1529,3972,8716,2634,3301,3412,8621,743,8001,4734,888,7744,8092,3671,8941,1487,5658,7099,2781,99,1932,4443,4756,4652,9328,1581,7855,4312,5976,7255,6480,3996,2748,1973,9731,4530,2790,9417,7186,5303,3557,351,7182,9428,1342,9020,7599,1392,8304,2070,9138,7215,2008,9937,1106,7110 +7444,769,9688,632,1571,6820,8743,4338,337,3366,3073,1946,8219,104,4210,6986,249,5061,8693,7960,6546,1004,8857,5997,9352,4338,6105,5008,2556,6518,6694,4345,3727,7956,20,3954,8652,4424,9387,2035,8358,5962,5304,5194,8650,8282,1256,1103,2138,6679,1985,3653,2770,2433,4278,615,2863,1715,242,3790,2636,6998,3088,1671,2239,957,5411,4595,6282,2881,9974,2401,875,7574,2987,4587,3147,6766,9885,2965 +3287,3016,3619,6818,9073,6120,5423,557,2900,2015,8111,3873,1314,4189,1846,4399,7041,7583,2427,2864,3525,5002,2069,748,1948,6015,2684,438,770,8367,1663,7887,7759,1885,157,7770,4520,4878,3857,1137,3525,3050,6276,5569,7649,904,4533,7843,2199,5648,7628,9075,9441,3600,7231,2388,5640,9096,958,3058,584,5899,8150,1181,9616,1098,8162,6819,8171,1519,1140,7665,8801,2632,1299,9192,707,9955,2710,7314 +1772,2963,7578,3541,3095,1488,7026,2634,6015,4633,4370,2762,1650,2174,909,8158,2922,8467,4198,4280,9092,8856,8835,5457,2790,8574,9742,5054,9547,4156,7940,8126,9824,7340,8840,6574,3547,1477,3014,6798,7134,435,9484,9859,3031,4,1502,4133,1738,1807,4825,463,6343,9701,8506,9822,9555,8688,8168,3467,3234,6318,1787,5591,419,6593,7974,8486,9861,6381,6758,194,3061,4315,2863,4665,3789,2201,1492,4416 +126,8927,6608,5682,8986,6867,1715,6076,3159,788,3140,4744,830,9253,5812,5021,7616,8534,1546,9590,1101,9012,9821,8132,7857,4086,1069,7491,2988,1579,2442,4321,2149,7642,6108,250,6086,3167,24,9528,7663,2685,1220,9196,1397,5776,1577,1730,5481,977,6115,199,6326,2183,3767,5928,5586,7561,663,8649,9688,949,5913,9160,1870,5764,9887,4477,6703,1413,4995,5494,7131,2192,8969,7138,3997,8697,646,1028 +8074,1731,8245,624,4601,8706,155,8891,309,2552,8208,8452,2954,3124,3469,4246,3352,1105,4509,8677,9901,4416,8191,9283,5625,7120,2952,8881,7693,830,4580,8228,9459,8611,4499,1179,4988,1394,550,2336,6089,6872,269,7213,1848,917,6672,4890,656,1478,6536,3165,4743,4990,1176,6211,7207,5284,9730,4738,1549,4986,4942,8645,3698,9429,1439,2175,6549,3058,6513,1574,6988,8333,3406,5245,5431,7140,7085,6407 +7845,4694,2530,8249,290,5948,5509,1588,5940,4495,5866,5021,4626,3979,3296,7589,4854,1998,5627,3926,8346,6512,9608,1918,7070,4747,4182,2858,2766,4606,6269,4107,8982,8568,9053,4244,5604,102,2756,727,5887,2566,7922,44,5986,621,1202,374,6988,4130,3627,6744,9443,4568,1398,8679,397,3928,9159,367,2917,6127,5788,3304,8129,911,2669,1463,9749,264,4478,8940,1109,7309,2462,117,4692,7724,225,2312 +4164,3637,2000,941,8903,39,3443,7172,1031,3687,4901,8082,4945,4515,7204,9310,9349,9535,9940,218,1788,9245,2237,1541,5670,6538,6047,5553,9807,8101,1925,8714,445,8332,7309,6830,5786,5736,7306,2710,3034,1838,7969,6318,7912,2584,2080,7437,6705,2254,7428,820,782,9861,7596,3842,3631,8063,5240,6666,394,4565,7865,4895,9890,6028,6117,4724,9156,4473,4552,602,470,6191,4927,5387,884,3146,1978,3000 +4258,6880,1696,3582,5793,4923,2119,1155,9056,9698,6603,3768,5514,9927,9609,6166,6566,4536,4985,4934,8076,9062,6741,6163,7399,4562,2337,5600,2919,9012,8459,1308,6072,1225,9306,8818,5886,7243,7365,8792,6007,9256,6699,7171,4230,7002,8720,7839,4533,1671,478,7774,1607,2317,5437,4705,7886,4760,6760,7271,3081,2997,3088,7675,6208,3101,6821,6840,122,9633,4900,2067,8546,4549,2091,7188,5605,8599,6758,5229 +7854,5243,9155,3556,8812,7047,2202,1541,5993,4600,4760,713,434,7911,7426,7414,8729,322,803,7960,7563,4908,6285,6291,736,3389,9339,4132,8701,7534,5287,3646,592,3065,7582,2592,8755,6068,8597,1982,5782,1894,2900,6236,4039,6569,3037,5837,7698,700,7815,2491,7272,5878,3083,6778,6639,3589,5010,8313,2581,6617,5869,8402,6808,2951,2321,5195,497,2190,6187,1342,1316,4453,7740,4154,2959,1781,1482,8256 +7178,2046,4419,744,8312,5356,6855,8839,319,2962,5662,47,6307,8662,68,4813,567,2712,9931,1678,3101,8227,6533,4933,6656,92,5846,4780,6256,6361,4323,9985,1231,2175,7178,3034,9744,6155,9165,7787,5836,9318,7860,9644,8941,6480,9443,8188,5928,161,6979,2352,5628,6991,1198,8067,5867,6620,3778,8426,2994,3122,3124,6335,3918,8897,2655,9670,634,1088,1576,8935,7255,474,8166,7417,9547,2886,5560,3842 +6957,3111,26,7530,7143,1295,1744,6057,3009,1854,8098,5405,2234,4874,9447,2620,9303,27,7410,969,40,2966,5648,7596,8637,4238,3143,3679,7187,690,9980,7085,7714,9373,5632,7526,6707,3951,9734,4216,2146,3602,5371,6029,3039,4433,4855,4151,1449,3376,8009,7240,7027,4602,2947,9081,4045,8424,9352,8742,923,2705,4266,3232,2264,6761,363,2651,3383,7770,6730,7856,7340,9679,2158,610,4471,4608,910,6241 +4417,6756,1013,8797,658,8809,5032,8703,7541,846,3357,2920,9817,1745,9980,7593,4667,3087,779,3218,6233,5568,4296,2289,2654,7898,5021,9461,5593,8214,9173,4203,2271,7980,2983,5952,9992,8399,3468,1776,3188,9314,1720,6523,2933,621,8685,5483,8986,6163,3444,9539,4320,155,3992,2828,2150,6071,524,2895,5468,8063,1210,3348,9071,4862,483,9017,4097,6186,9815,3610,5048,1644,1003,9865,9332,2145,1944,2213 +9284,3803,4920,1927,6706,4344,7383,4786,9890,2010,5228,1224,3158,6967,8580,8990,8883,5213,76,8306,2031,4980,5639,9519,7184,5645,7769,3259,8077,9130,1317,3096,9624,3818,1770,695,2454,947,6029,3474,9938,3527,5696,4760,7724,7738,2848,6442,5767,6845,8323,4131,2859,7595,2500,4815,3660,9130,8580,7016,8231,4391,8369,3444,4069,4021,556,6154,627,2778,1496,4206,6356,8434,8491,3816,8231,3190,5575,1015 +3787,7572,1788,6803,5641,6844,1961,4811,8535,9914,9999,1450,8857,738,4662,8569,6679,2225,7839,8618,286,2648,5342,2294,3205,4546,176,8705,3741,6134,8324,8021,7004,5205,7032,6637,9442,5539,5584,4819,5874,5807,8589,6871,9016,983,1758,3786,1519,6241,185,8398,495,3370,9133,3051,4549,9674,7311,9738,3316,9383,2658,2776,9481,7558,619,3943,3324,6491,4933,153,9738,4623,912,3595,7771,7939,1219,4405 +2650,3883,4154,5809,315,7756,4430,1788,4451,1631,6461,7230,6017,5751,138,588,5282,2442,9110,9035,6349,2515,1570,6122,4192,4174,3530,1933,4186,4420,4609,5739,4135,2963,6308,1161,8809,8619,2796,3819,6971,8228,4188,1492,909,8048,2328,6772,8467,7671,9068,2226,7579,6422,7056,8042,3296,2272,3006,2196,7320,3238,3490,3102,37,1293,3212,4767,5041,8773,5794,4456,6174,7279,7054,2835,7053,9088,790,6640 +3101,1057,7057,3826,6077,1025,2955,1224,1114,6729,5902,4698,6239,7203,9423,1804,4417,6686,1426,6941,8071,1029,4985,9010,6122,6597,1622,1574,3513,1684,7086,5505,3244,411,9638,4150,907,9135,829,981,1707,5359,8781,9751,5,9131,3973,7159,1340,6955,7514,7993,6964,8198,1933,2797,877,3993,4453,8020,9349,8646,2779,8679,2961,3547,3374,3510,1129,3568,2241,2625,9138,5974,8206,7669,7678,1833,8700,4480 +4865,9912,8038,8238,782,3095,8199,1127,4501,7280,2112,2487,3626,2790,9432,1475,6312,8277,4827,2218,5806,7132,8752,1468,7471,6386,739,8762,8323,8120,5169,9078,9058,3370,9560,7987,8585,8531,5347,9312,1058,4271,1159,5286,5404,6925,8606,9204,7361,2415,560,586,4002,2644,1927,2824,768,4409,2942,3345,1002,808,4941,6267,7979,5140,8643,7553,9438,7320,4938,2666,4609,2778,8158,6730,3748,3867,1866,7181 +171,3771,7134,8927,4778,2913,3326,2004,3089,7853,1378,1729,4777,2706,9578,1360,5693,3036,1851,7248,2403,2273,8536,6501,9216,613,9671,7131,7719,6425,773,717,8803,160,1114,7554,7197,753,4513,4322,8499,4533,2609,4226,8710,6627,644,9666,6260,4870,5744,7385,6542,6203,7703,6130,8944,5589,2262,6803,6381,7414,6888,5123,7320,9392,9061,6780,322,8975,7050,5089,1061,2260,3199,1150,1865,5386,9699,6501 +3744,8454,6885,8277,919,1923,4001,6864,7854,5519,2491,6057,8794,9645,1776,5714,9786,9281,7538,6916,3215,395,2501,9618,4835,8846,9708,2813,3303,1794,8309,7176,2206,1602,1838,236,4593,2245,8993,4017,10,8215,6921,5206,4023,5932,6997,7801,262,7640,3107,8275,4938,7822,2425,3223,3886,2105,8700,9526,2088,8662,8034,7004,5710,2124,7164,3574,6630,9980,4242,2901,9471,1491,2117,4562,1130,9086,4117,6698 +2810,2280,2331,1170,4554,4071,8387,1215,2274,9848,6738,1604,7281,8805,439,1298,8318,7834,9426,8603,6092,7944,1309,8828,303,3157,4638,4439,9175,1921,4695,7716,1494,1015,1772,5913,1127,1952,1950,8905,4064,9890,385,9357,7945,5035,7082,5369,4093,6546,5187,5637,2041,8946,1758,7111,6566,1027,1049,5148,7224,7248,296,6169,375,1656,7993,2816,3717,4279,4675,1609,3317,42,6201,3100,3144,163,9530,4531 +7096,6070,1009,4988,3538,5801,7149,3063,2324,2912,7911,7002,4338,7880,2481,7368,3516,2016,7556,2193,1388,3865,8125,4637,4096,8114,750,3144,1938,7002,9343,4095,1392,4220,3455,6969,9647,1321,9048,1996,1640,6626,1788,314,9578,6630,2813,6626,4981,9908,7024,4355,3201,3521,3864,3303,464,1923,595,9801,3391,8366,8084,9374,1041,8807,9085,1892,9431,8317,9016,9221,8574,9981,9240,5395,2009,6310,2854,9255 +8830,3145,2960,9615,8220,6061,3452,2918,6481,9278,2297,3385,6565,7066,7316,5682,107,7646,4466,68,1952,9603,8615,54,7191,791,6833,2560,693,9733,4168,570,9127,9537,1925,8287,5508,4297,8452,8795,6213,7994,2420,4208,524,5915,8602,8330,2651,8547,6156,1812,6271,7991,9407,9804,1553,6866,1128,2119,4691,9711,8315,5879,9935,6900,482,682,4126,1041,428,6247,3720,5882,7526,2582,4327,7725,3503,2631 +2738,9323,721,7434,1453,6294,2957,3786,5722,6019,8685,4386,3066,9057,6860,499,5315,3045,5194,7111,3137,9104,941,586,3066,755,4177,8819,7040,5309,3583,3897,4428,7788,4721,7249,6559,7324,825,7311,3760,6064,6070,9672,4882,584,1365,9739,9331,5783,2624,7889,1604,1303,1555,7125,8312,425,8936,3233,7724,1480,403,7440,1784,1754,4721,1569,652,3893,4574,5692,9730,4813,9844,8291,9199,7101,3391,8914 +6044,2928,9332,3328,8588,447,3830,1176,3523,2705,8365,6136,5442,9049,5526,8575,8869,9031,7280,706,2794,8814,5767,4241,7696,78,6570,556,5083,1426,4502,3336,9518,2292,1885,3740,3153,9348,9331,8051,2759,5407,9028,7840,9255,831,515,2612,9747,7435,8964,4971,2048,4900,5967,8271,1719,9670,2810,6777,1594,6367,6259,8316,3815,1689,6840,9437,4361,822,9619,3065,83,6344,7486,8657,8228,9635,6932,4864 +8478,4777,6334,4678,7476,4963,6735,3096,5860,1405,5127,7269,7793,4738,227,9168,2996,8928,765,733,1276,7677,6258,1528,9558,3329,302,8901,1422,8277,6340,645,9125,8869,5952,141,8141,1816,9635,4025,4184,3093,83,2344,2747,9352,7966,1206,1126,1826,218,7939,2957,2729,810,8752,5247,4174,4038,8884,7899,9567,301,5265,5752,7524,4381,1669,3106,8270,6228,6373,754,2547,4240,2313,5514,3022,1040,9738 +2265,8192,1763,1369,8469,8789,4836,52,1212,6690,5257,8918,6723,6319,378,4039,2421,8555,8184,9577,1432,7139,8078,5452,9628,7579,4161,7490,5159,8559,1011,81,478,5840,1964,1334,6875,8670,9900,739,1514,8692,522,9316,6955,1345,8132,2277,3193,9773,3923,4177,2183,1236,6747,6575,4874,6003,6409,8187,745,8776,9440,7543,9825,2582,7381,8147,7236,5185,7564,6125,218,7991,6394,391,7659,7456,5128,5294 +2132,8992,8160,5782,4420,3371,3798,5054,552,5631,7546,4716,1332,6486,7892,7441,4370,6231,4579,2121,8615,1145,9391,1524,1385,2400,9437,2454,7896,7467,2928,8400,3299,4025,7458,4703,7206,6358,792,6200,725,4275,4136,7390,5984,4502,7929,5085,8176,4600,119,3568,76,9363,6943,2248,9077,9731,6213,5817,6729,4190,3092,6910,759,2682,8380,1254,9604,3011,9291,5329,9453,9746,2739,6522,3765,5634,1113,5789 +5304,5499,564,2801,679,2653,1783,3608,7359,7797,3284,796,3222,437,7185,6135,8571,2778,7488,5746,678,6140,861,7750,803,9859,9918,2425,3734,2698,9005,4864,9818,6743,2475,132,9486,3825,5472,919,292,4411,7213,7699,6435,9019,6769,1388,802,2124,1345,8493,9487,8558,7061,8777,8833,2427,2238,5409,4957,8503,3171,7622,5779,6145,2417,5873,5563,5693,9574,9491,1937,7384,4563,6842,5432,2751,3406,7981 diff --git a/problem_data/no082.txt b/problem_data/no082.txt new file mode 100644 index 0000000..1e9e6cd --- /dev/null +++ b/problem_data/no082.txt @@ -0,0 +1,80 @@ +4445,2697,5115,718,2209,2212,654,4348,3079,6821,7668,3276,8874,4190,3785,2752,9473,7817,9137,496,7338,3434,7152,4355,4552,7917,7827,2460,2350,691,3514,5880,3145,7633,7199,3783,5066,7487,3285,1084,8985,760,872,8609,8051,1134,9536,5750,9716,9371,7619,5617,275,9721,2997,2698,1887,8825,6372,3014,2113,7122,7050,6775,5948,2758,1219,3539,348,7989,2735,9862,1263,8089,6401,9462,3168,2758,3748,5870 +1096,20,1318,7586,5167,2642,1443,5741,7621,7030,5526,4244,2348,4641,9827,2448,6918,5883,3737,300,7116,6531,567,5997,3971,6623,820,6148,3287,1874,7981,8424,7672,7575,6797,6717,1078,5008,4051,8795,5820,346,1851,6463,2117,6058,3407,8211,117,4822,1317,4377,4434,5925,8341,4800,1175,4173,690,8978,7470,1295,3799,8724,3509,9849,618,3320,7068,9633,2384,7175,544,6583,1908,9983,481,4187,9353,9377 +9607,7385,521,6084,1364,8983,7623,1585,6935,8551,2574,8267,4781,3834,2764,2084,2669,4656,9343,7709,2203,9328,8004,6192,5856,3555,2260,5118,6504,1839,9227,1259,9451,1388,7909,5733,6968,8519,9973,1663,5315,7571,3035,4325,4283,2304,6438,3815,9213,9806,9536,196,5542,6907,2475,1159,5820,9075,9470,2179,9248,1828,4592,9167,3713,4640,47,3637,309,7344,6955,346,378,9044,8635,7466,5036,9515,6385,9230 +7206,3114,7760,1094,6150,5182,7358,7387,4497,955,101,1478,7777,6966,7010,8417,6453,4955,3496,107,449,8271,131,2948,6185,784,5937,8001,6104,8282,4165,3642,710,2390,575,715,3089,6964,4217,192,5949,7006,715,3328,1152,66,8044,4319,1735,146,4818,5456,6451,4113,1063,4781,6799,602,1504,6245,6550,1417,1343,2363,3785,5448,4545,9371,5420,5068,4613,4882,4241,5043,7873,8042,8434,3939,9256,2187 +3620,8024,577,9997,7377,7682,1314,1158,6282,6310,1896,2509,5436,1732,9480,706,496,101,6232,7375,2207,2306,110,6772,3433,2878,8140,5933,8688,1399,2210,7332,6172,6403,7333,4044,2291,1790,2446,7390,8698,5723,3678,7104,1825,2040,140,3982,4905,4160,2200,5041,2512,1488,2268,1175,7588,8321,8078,7312,977,5257,8465,5068,3453,3096,1651,7906,253,9250,6021,8791,8109,6651,3412,345,4778,5152,4883,7505 +1074,5438,9008,2679,5397,5429,2652,3403,770,9188,4248,2493,4361,8327,9587,707,9525,5913,93,1899,328,2876,3604,673,8576,6908,7659,2544,3359,3883,5273,6587,3065,1749,3223,604,9925,6941,2823,8767,7039,3290,3214,1787,7904,3421,7137,9560,8451,2669,9219,6332,1576,5477,6755,8348,4164,4307,2984,4012,6629,1044,2874,6541,4942,903,1404,9125,5160,8836,4345,2581,460,8438,1538,5507,668,3352,2678,6942 +4295,1176,5596,1521,3061,9868,7037,7129,8933,6659,5947,5063,3653,9447,9245,2679,767,714,116,8558,163,3927,8779,158,5093,2447,5782,3967,1716,931,7772,8164,1117,9244,5783,7776,3846,8862,6014,2330,6947,1777,3112,6008,3491,1906,5952,314,4602,8994,5919,9214,3995,5026,7688,6809,5003,3128,2509,7477,110,8971,3982,8539,2980,4689,6343,5411,2992,5270,5247,9260,2269,7474,1042,7162,5206,1232,4556,4757 +510,3556,5377,1406,5721,4946,2635,7847,4251,8293,8281,6351,4912,287,2870,3380,3948,5322,3840,4738,9563,1906,6298,3234,8959,1562,6297,8835,7861,239,6618,1322,2553,2213,5053,5446,4402,6500,5182,8585,6900,5756,9661,903,5186,7687,5998,7997,8081,8955,4835,6069,2621,1581,732,9564,1082,1853,5442,1342,520,1737,3703,5321,4793,2776,1508,1647,9101,2499,6891,4336,7012,3329,3212,1442,9993,3988,4930,7706 +9444,3401,5891,9716,1228,7107,109,3563,2700,6161,5039,4992,2242,8541,7372,2067,1294,3058,1306,320,8881,5756,9326,411,8650,8824,5495,8282,8397,2000,1228,7817,2099,6473,3571,5994,4447,1299,5991,543,7874,2297,1651,101,2093,3463,9189,6872,6118,872,1008,1779,2805,9084,4048,2123,5877,55,3075,1737,9459,4535,6453,3644,108,5982,4437,5213,1340,6967,9943,5815,669,8074,1838,6979,9132,9315,715,5048 +3327,4030,7177,6336,9933,5296,2621,4785,2755,4832,2512,2118,2244,4407,2170,499,7532,9742,5051,7687,970,6924,3527,4694,5145,1306,2165,5940,2425,8910,3513,1909,6983,346,6377,4304,9330,7203,6605,3709,3346,970,369,9737,5811,4427,9939,3693,8436,5566,1977,3728,2399,3985,8303,2492,5366,9802,9193,7296,1033,5060,9144,2766,1151,7629,5169,5995,58,7619,7565,4208,1713,6279,3209,4908,9224,7409,1325,8540 +6882,1265,1775,3648,4690,959,5837,4520,5394,1378,9485,1360,4018,578,9174,2932,9890,3696,116,1723,1178,9355,7063,1594,1918,8574,7594,7942,1547,6166,7888,354,6932,4651,1010,7759,6905,661,7689,6092,9292,3845,9605,8443,443,8275,5163,7720,7265,6356,7779,1798,1754,5225,6661,1180,8024,5666,88,9153,1840,3508,1193,4445,2648,3538,6243,6375,8107,5902,5423,2520,1122,5015,6113,8859,9370,966,8673,2442 +7338,3423,4723,6533,848,8041,7921,8277,4094,5368,7252,8852,9166,2250,2801,6125,8093,5738,4038,9808,7359,9494,601,9116,4946,2702,5573,2921,9862,1462,1269,2410,4171,2709,7508,6241,7522,615,2407,8200,4189,5492,5649,7353,2590,5203,4274,710,7329,9063,956,8371,3722,4253,4785,1194,4828,4717,4548,940,983,2575,4511,2938,1827,2027,2700,1236,841,5760,1680,6260,2373,3851,1841,4968,1172,5179,7175,3509 +4420,1327,3560,2376,6260,2988,9537,4064,4829,8872,9598,3228,1792,7118,9962,9336,4368,9189,6857,1829,9863,6287,7303,7769,2707,8257,2391,2009,3975,4993,3068,9835,3427,341,8412,2134,4034,8511,6421,3041,9012,2983,7289,100,1355,7904,9186,6920,5856,2008,6545,8331,3655,5011,839,8041,9255,6524,3862,8788,62,7455,3513,5003,8413,3918,2076,7960,6108,3638,6999,3436,1441,4858,4181,1866,8731,7745,3744,1000 +356,8296,8325,1058,1277,4743,3850,2388,6079,6462,2815,5620,8495,5378,75,4324,3441,9870,1113,165,1544,1179,2834,562,6176,2313,6836,8839,2986,9454,5199,6888,1927,5866,8760,320,1792,8296,7898,6121,7241,5886,5814,2815,8336,1576,4314,3109,2572,6011,2086,9061,9403,3947,5487,9731,7281,3159,1819,1334,3181,5844,5114,9898,4634,2531,4412,6430,4262,8482,4546,4555,6804,2607,9421,686,8649,8860,7794,6672 +9870,152,1558,4963,8750,4754,6521,6256,8818,5208,5691,9659,8377,9725,5050,5343,2539,6101,1844,9700,7750,8114,5357,3001,8830,4438,199,9545,8496,43,2078,327,9397,106,6090,8181,8646,6414,7499,5450,4850,6273,5014,4131,7639,3913,6571,8534,9703,4391,7618,445,1320,5,1894,6771,7383,9191,4708,9706,6939,7937,8726,9382,5216,3685,2247,9029,8154,1738,9984,2626,9438,4167,6351,5060,29,1218,1239,4785 +192,5213,8297,8974,4032,6966,5717,1179,6523,4679,9513,1481,3041,5355,9303,9154,1389,8702,6589,7818,6336,3539,5538,3094,6646,6702,6266,2759,4608,4452,617,9406,8064,6379,444,5602,4950,1810,8391,1536,316,8714,1178,5182,5863,5110,5372,4954,1978,2971,5680,4863,2255,4630,5723,2168,538,1692,1319,7540,440,6430,6266,7712,7385,5702,620,641,3136,7350,1478,3155,2820,9109,6261,1122,4470,14,8493,2095 +1046,4301,6082,474,4974,7822,2102,5161,5172,6946,8074,9716,6586,9962,9749,5015,2217,995,5388,4402,7652,6399,6539,1349,8101,3677,1328,9612,7922,2879,231,5887,2655,508,4357,4964,3554,5930,6236,7384,4614,280,3093,9600,2110,7863,2631,6626,6620,68,1311,7198,7561,1768,5139,1431,221,230,2940,968,5283,6517,2146,1646,869,9402,7068,8645,7058,1765,9690,4152,2926,9504,2939,7504,6074,2944,6470,7859 +4659,736,4951,9344,1927,6271,8837,8711,3241,6579,7660,5499,5616,3743,5801,4682,9748,8796,779,1833,4549,8138,4026,775,4170,2432,4174,3741,7540,8017,2833,4027,396,811,2871,1150,9809,2719,9199,8504,1224,540,2051,3519,7982,7367,2761,308,3358,6505,2050,4836,5090,7864,805,2566,2409,6876,3361,8622,5572,5895,3280,441,7893,8105,1634,2929,274,3926,7786,6123,8233,9921,2674,5340,1445,203,4585,3837 +5759,338,7444,7968,7742,3755,1591,4839,1705,650,7061,2461,9230,9391,9373,2413,1213,431,7801,4994,2380,2703,6161,6878,8331,2538,6093,1275,5065,5062,2839,582,1014,8109,3525,1544,1569,8622,7944,2905,6120,1564,1839,5570,7579,1318,2677,5257,4418,5601,7935,7656,5192,1864,5886,6083,5580,6202,8869,1636,7907,4759,9082,5854,3185,7631,6854,5872,5632,5280,1431,2077,9717,7431,4256,8261,9680,4487,4752,4286 +1571,1428,8599,1230,7772,4221,8523,9049,4042,8726,7567,6736,9033,2104,4879,4967,6334,6716,3994,1269,8995,6539,3610,7667,6560,6065,874,848,4597,1711,7161,4811,6734,5723,6356,6026,9183,2586,5636,1092,7779,7923,8747,6887,7505,9909,1792,3233,4526,3176,1508,8043,720,5212,6046,4988,709,5277,8256,3642,1391,5803,1468,2145,3970,6301,7767,2359,8487,9771,8785,7520,856,1605,8972,2402,2386,991,1383,5963 +1822,4824,5957,6511,9868,4113,301,9353,6228,2881,2966,6956,9124,9574,9233,1601,7340,973,9396,540,4747,8590,9535,3650,7333,7583,4806,3593,2738,8157,5215,8472,2284,9473,3906,6982,5505,6053,7936,6074,7179,6688,1564,1103,6860,5839,2022,8490,910,7551,7805,881,7024,1855,9448,4790,1274,3672,2810,774,7623,4223,4850,6071,9975,4935,1915,9771,6690,3846,517,463,7624,4511,614,6394,3661,7409,1395,8127 +8738,3850,9555,3695,4383,2378,87,6256,6740,7682,9546,4255,6105,2000,1851,4073,8957,9022,6547,5189,2487,303,9602,7833,1628,4163,6678,3144,8589,7096,8913,5823,4890,7679,1212,9294,5884,2972,3012,3359,7794,7428,1579,4350,7246,4301,7779,7790,3294,9547,4367,3549,1958,8237,6758,3497,3250,3456,6318,1663,708,7714,6143,6890,3428,6853,9334,7992,591,6449,9786,1412,8500,722,5468,1371,108,3939,4199,2535 +7047,4323,1934,5163,4166,461,3544,2767,6554,203,6098,2265,9078,2075,4644,6641,8412,9183,487,101,7566,5622,1975,5726,2920,5374,7779,5631,3753,3725,2672,3621,4280,1162,5812,345,8173,9785,1525,955,5603,2215,2580,5261,2765,2990,5979,389,3907,2484,1232,5933,5871,3304,1138,1616,5114,9199,5072,7442,7245,6472,4760,6359,9053,7876,2564,9404,3043,9026,2261,3374,4460,7306,2326,966,828,3274,1712,3446 +3975,4565,8131,5800,4570,2306,8838,4392,9147,11,3911,7118,9645,4994,2028,6062,5431,2279,8752,2658,7836,994,7316,5336,7185,3289,1898,9689,2331,5737,3403,1124,2679,3241,7748,16,2724,5441,6640,9368,9081,5618,858,4969,17,2103,6035,8043,7475,2181,939,415,1617,8500,8253,2155,7843,7974,7859,1746,6336,3193,2617,8736,4079,6324,6645,8891,9396,5522,6103,1857,8979,3835,2475,1310,7422,610,8345,7615 +9248,5397,5686,2988,3446,4359,6634,9141,497,9176,6773,7448,1907,8454,916,1596,2241,1626,1384,2741,3649,5362,8791,7170,2903,2475,5325,6451,924,3328,522,90,4813,9737,9557,691,2388,1383,4021,1609,9206,4707,5200,7107,8104,4333,9860,5013,1224,6959,8527,1877,4545,7772,6268,621,4915,9349,5970,706,9583,3071,4127,780,8231,3017,9114,3836,7503,2383,1977,4870,8035,2379,9704,1037,3992,3642,1016,4303 +5093,138,4639,6609,1146,5565,95,7521,9077,2272,974,4388,2465,2650,722,4998,3567,3047,921,2736,7855,173,2065,4238,1048,5,6847,9548,8632,9194,5942,4777,7910,8971,6279,7253,2516,1555,1833,3184,9453,9053,6897,7808,8629,4877,1871,8055,4881,7639,1537,7701,2508,7564,5845,5023,2304,5396,3193,2955,1088,3801,6203,1748,3737,1276,13,4120,7715,8552,3047,2921,106,7508,304,1280,7140,2567,9135,5266 +6237,4607,7527,9047,522,7371,4883,2540,5867,6366,5301,1570,421,276,3361,527,6637,4861,2401,7522,5808,9371,5298,2045,5096,5447,7755,5115,7060,8529,4078,1943,1697,1764,5453,7085,960,2405,739,2100,5800,728,9737,5704,5693,1431,8979,6428,673,7540,6,7773,5857,6823,150,5869,8486,684,5816,9626,7451,5579,8260,3397,5322,6920,1879,2127,2884,5478,4977,9016,6165,6292,3062,5671,5968,78,4619,4763 +9905,7127,9390,5185,6923,3721,9164,9705,4341,1031,1046,5127,7376,6528,3248,4941,1178,7889,3364,4486,5358,9402,9158,8600,1025,874,1839,1783,309,9030,1843,845,8398,1433,7118,70,8071,2877,3904,8866,6722,4299,10,1929,5897,4188,600,1889,3325,2485,6473,4474,7444,6992,4846,6166,4441,2283,2629,4352,7775,1101,2214,9985,215,8270,9750,2740,8361,7103,5930,8664,9690,8302,9267,344,2077,1372,1880,9550 +5825,8517,7769,2405,8204,1060,3603,7025,478,8334,1997,3692,7433,9101,7294,7498,9415,5452,3850,3508,6857,9213,6807,4412,7310,854,5384,686,4978,892,8651,3241,2743,3801,3813,8588,6701,4416,6990,6490,3197,6838,6503,114,8343,5844,8646,8694,65,791,5979,2687,2621,2019,8097,1423,3644,9764,4921,3266,3662,5561,2476,8271,8138,6147,1168,3340,1998,9874,6572,9873,6659,5609,2711,3931,9567,4143,7833,8887 +6223,2099,2700,589,4716,8333,1362,5007,2753,2848,4441,8397,7192,8191,4916,9955,6076,3370,6396,6971,3156,248,3911,2488,4930,2458,7183,5455,170,6809,6417,3390,1956,7188,577,7526,2203,968,8164,479,8699,7915,507,6393,4632,1597,7534,3604,618,3280,6061,9793,9238,8347,568,9645,2070,5198,6482,5000,9212,6655,5961,7513,1323,3872,6170,3812,4146,2736,67,3151,5548,2781,9679,7564,5043,8587,1893,4531 +5826,3690,6724,2121,9308,6986,8106,6659,2142,1642,7170,2877,5757,6494,8026,6571,8387,9961,6043,9758,9607,6450,8631,8334,7359,5256,8523,2225,7487,1977,9555,8048,5763,2414,4948,4265,2427,8978,8088,8841,9208,9601,5810,9398,8866,9138,4176,5875,7212,3272,6759,5678,7649,4922,5422,1343,8197,3154,3600,687,1028,4579,2084,9467,4492,7262,7296,6538,7657,7134,2077,1505,7332,6890,8964,4879,7603,7400,5973,739 +1861,1613,4879,1884,7334,966,2000,7489,2123,4287,1472,3263,4726,9203,1040,4103,6075,6049,330,9253,4062,4268,1635,9960,577,1320,3195,9628,1030,4092,4979,6474,6393,2799,6967,8687,7724,7392,9927,2085,3200,6466,8702,265,7646,8665,7986,7266,4574,6587,612,2724,704,3191,8323,9523,3002,704,5064,3960,8209,2027,2758,8393,4875,4641,9584,6401,7883,7014,768,443,5490,7506,1852,2005,8850,5776,4487,4269 +4052,6687,4705,7260,6645,6715,3706,5504,8672,2853,1136,8187,8203,4016,871,1809,1366,4952,9294,5339,6872,2645,6083,7874,3056,5218,7485,8796,7401,3348,2103,426,8572,4163,9171,3176,948,7654,9344,3217,1650,5580,7971,2622,76,2874,880,2034,9929,1546,2659,5811,3754,7096,7436,9694,9960,7415,2164,953,2360,4194,2397,1047,2196,6827,575,784,2675,8821,6802,7972,5996,6699,2134,7577,2887,1412,4349,4380 +4629,2234,6240,8132,7592,3181,6389,1214,266,1910,2451,8784,2790,1127,6932,1447,8986,2492,5476,397,889,3027,7641,5083,5776,4022,185,3364,5701,2442,2840,4160,9525,4828,6602,2614,7447,3711,4505,7745,8034,6514,4907,2605,7753,6958,7270,6936,3006,8968,439,2326,4652,3085,3425,9863,5049,5361,8688,297,7580,8777,7916,6687,8683,7141,306,9569,2384,1500,3346,4601,7329,9040,6097,2727,6314,4501,4974,2829 +8316,4072,2025,6884,3027,1808,5714,7624,7880,8528,4205,8686,7587,3230,1139,7273,6163,6986,3914,9309,1464,9359,4474,7095,2212,7302,2583,9462,7532,6567,1606,4436,8981,5612,6796,4385,5076,2007,6072,3678,8331,1338,3299,8845,4783,8613,4071,1232,6028,2176,3990,2148,3748,103,9453,538,6745,9110,926,3125,473,5970,8728,7072,9062,1404,1317,5139,9862,6496,6062,3338,464,1600,2532,1088,8232,7739,8274,3873 +2341,523,7096,8397,8301,6541,9844,244,4993,2280,7689,4025,4196,5522,7904,6048,2623,9258,2149,9461,6448,8087,7245,1917,8340,7127,8466,5725,6996,3421,5313,512,9164,9837,9794,8369,4185,1488,7210,1524,1016,4620,9435,2478,7765,8035,697,6677,3724,6988,5853,7662,3895,9593,1185,4727,6025,5734,7665,3070,138,8469,6748,6459,561,7935,8646,2378,462,7755,3115,9690,8877,3946,2728,8793,244,6323,8666,4271 +6430,2406,8994,56,1267,3826,9443,7079,7579,5232,6691,3435,6718,5698,4144,7028,592,2627,217,734,6194,8156,9118,58,2640,8069,4127,3285,694,3197,3377,4143,4802,3324,8134,6953,7625,3598,3584,4289,7065,3434,2106,7132,5802,7920,9060,7531,3321,1725,1067,3751,444,5503,6785,7937,6365,4803,198,6266,8177,1470,6390,1606,2904,7555,9834,8667,2033,1723,5167,1666,8546,8152,473,4475,6451,7947,3062,3281 +2810,3042,7759,1741,2275,2609,7676,8640,4117,1958,7500,8048,1757,3954,9270,1971,4796,2912,660,5511,3553,1012,5757,4525,6084,7198,8352,5775,7726,8591,7710,9589,3122,4392,6856,5016,749,2285,3356,7482,9956,7348,2599,8944,495,3462,3578,551,4543,7207,7169,7796,1247,4278,6916,8176,3742,8385,2310,1345,8692,2667,4568,1770,8319,3585,4920,3890,4928,7343,5385,9772,7947,8786,2056,9266,3454,2807,877,2660 +6206,8252,5928,5837,4177,4333,207,7934,5581,9526,8906,1498,8411,2984,5198,5134,2464,8435,8514,8674,3876,599,5327,826,2152,4084,2433,9327,9697,4800,2728,3608,3849,3861,3498,9943,1407,3991,7191,9110,5666,8434,4704,6545,5944,2357,1163,4995,9619,6754,4200,9682,6654,4862,4744,5953,6632,1054,293,9439,8286,2255,696,8709,1533,1844,6441,430,1999,6063,9431,7018,8057,2920,6266,6799,356,3597,4024,6665 +3847,6356,8541,7225,2325,2946,5199,469,5450,7508,2197,9915,8284,7983,6341,3276,3321,16,1321,7608,5015,3362,8491,6968,6818,797,156,2575,706,9516,5344,5457,9210,5051,8099,1617,9951,7663,8253,9683,2670,1261,4710,1068,8753,4799,1228,2621,3275,6188,4699,1791,9518,8701,5932,4275,6011,9877,2933,4182,6059,2930,6687,6682,9771,654,9437,3169,8596,1827,5471,8909,2352,123,4394,3208,8756,5513,6917,2056 +5458,8173,3138,3290,4570,4892,3317,4251,9699,7973,1163,1935,5477,6648,9614,5655,9592,975,9118,2194,7322,8248,8413,3462,8560,1907,7810,6650,7355,2939,4973,6894,3933,3784,3200,2419,9234,4747,2208,2207,1945,2899,1407,6145,8023,3484,5688,7686,2737,3828,3704,9004,5190,9740,8643,8650,5358,4426,1522,1707,3613,9887,6956,2447,2762,833,1449,9489,2573,1080,4167,3456,6809,2466,227,7125,2759,6250,6472,8089 +3266,7025,9756,3914,1265,9116,7723,9788,6805,5493,2092,8688,6592,9173,4431,4028,6007,7131,4446,4815,3648,6701,759,3312,8355,4485,4187,5188,8746,7759,3528,2177,5243,8379,3838,7233,4607,9187,7216,2190,6967,2920,6082,7910,5354,3609,8958,6949,7731,494,8753,8707,1523,4426,3543,7085,647,6771,9847,646,5049,824,8417,5260,2730,5702,2513,9275,4279,2767,8684,1165,9903,4518,55,9682,8963,6005,2102,6523 +1998,8731,936,1479,5259,7064,4085,91,7745,7136,3773,3810,730,8255,2705,2653,9790,6807,2342,355,9344,2668,3690,2028,9679,8102,574,4318,6481,9175,5423,8062,2867,9657,7553,3442,3920,7430,3945,7639,3714,3392,2525,4995,4850,2867,7951,9667,486,9506,9888,781,8866,1702,3795,90,356,1483,4200,2131,6969,5931,486,6880,4404,1084,5169,4910,6567,8335,4686,5043,2614,3352,2667,4513,6472,7471,5720,1616 +8878,1613,1716,868,1906,2681,564,665,5995,2474,7496,3432,9491,9087,8850,8287,669,823,347,6194,2264,2592,7871,7616,8508,4827,760,2676,4660,4881,7572,3811,9032,939,4384,929,7525,8419,5556,9063,662,8887,7026,8534,3111,1454,2082,7598,5726,6687,9647,7608,73,3014,5063,670,5461,5631,3367,9796,8475,7908,5073,1565,5008,5295,4457,1274,4788,1728,338,600,8415,8535,9351,7750,6887,5845,1741,125 +3637,6489,9634,9464,9055,2413,7824,9517,7532,3577,7050,6186,6980,9365,9782,191,870,2497,8498,2218,2757,5420,6468,586,3320,9230,1034,1393,9886,5072,9391,1178,8464,8042,6869,2075,8275,3601,7715,9470,8786,6475,8373,2159,9237,2066,3264,5000,679,355,3069,4073,494,2308,5512,4334,9438,8786,8637,9774,1169,1949,6594,6072,4270,9158,7916,5752,6794,9391,6301,5842,3285,2141,3898,8027,4310,8821,7079,1307 +8497,6681,4732,7151,7060,5204,9030,7157,833,5014,8723,3207,9796,9286,4913,119,5118,7650,9335,809,3675,2597,5144,3945,5090,8384,187,4102,1260,2445,2792,4422,8389,9290,50,1765,1521,6921,8586,4368,1565,5727,7855,2003,4834,9897,5911,8630,5070,1330,7692,7557,7980,6028,5805,9090,8265,3019,3802,698,9149,5748,1965,9658,4417,5994,5584,8226,2937,272,5743,1278,5698,8736,2595,6475,5342,6596,1149,6920 +8188,8009,9546,6310,8772,2500,9846,6592,6872,3857,1307,8125,7042,1544,6159,2330,643,4604,7899,6848,371,8067,2062,3200,7295,1857,9505,6936,384,2193,2190,301,8535,5503,1462,7380,5114,4824,8833,1763,4974,8711,9262,6698,3999,2645,6937,7747,1128,2933,3556,7943,2885,3122,9105,5447,418,2899,5148,3699,9021,9501,597,4084,175,1621,1,1079,6067,5812,4326,9914,6633,5394,4233,6728,9084,1864,5863,1225 +9935,8793,9117,1825,9542,8246,8437,3331,9128,9675,6086,7075,319,1334,7932,3583,7167,4178,1726,7720,695,8277,7887,6359,5912,1719,2780,8529,1359,2013,4498,8072,1129,9998,1147,8804,9405,6255,1619,2165,7491,1,8882,7378,3337,503,5758,4109,3577,985,3200,7615,8058,5032,1080,6410,6873,5496,1466,2412,9885,5904,4406,3605,8770,4361,6205,9193,1537,9959,214,7260,9566,1685,100,4920,7138,9819,5637,976 +3466,9854,985,1078,7222,8888,5466,5379,3578,4540,6853,8690,3728,6351,7147,3134,6921,9692,857,3307,4998,2172,5783,3931,9417,2541,6299,13,787,2099,9131,9494,896,8600,1643,8419,7248,2660,2609,8579,91,6663,5506,7675,1947,6165,4286,1972,9645,3805,1663,1456,8853,5705,9889,7489,1107,383,4044,2969,3343,152,7805,4980,9929,5033,1737,9953,7197,9158,4071,1324,473,9676,3984,9680,3606,8160,7384,5432 +1005,4512,5186,3953,2164,3372,4097,3247,8697,3022,9896,4101,3871,6791,3219,2742,4630,6967,7829,5991,6134,1197,1414,8923,8787,1394,8852,5019,7768,5147,8004,8825,5062,9625,7988,1110,3992,7984,9966,6516,6251,8270,421,3723,1432,4830,6935,8095,9059,2214,6483,6846,3120,1587,6201,6691,9096,9627,6671,4002,3495,9939,7708,7465,5879,6959,6634,3241,3401,2355,9061,2611,7830,3941,2177,2146,5089,7079,519,6351 +7280,8586,4261,2831,7217,3141,9994,9940,5462,2189,4005,6942,9848,5350,8060,6665,7519,4324,7684,657,9453,9296,2944,6843,7499,7847,1728,9681,3906,6353,5529,2822,3355,3897,7724,4257,7489,8672,4356,3983,1948,6892,7415,4153,5893,4190,621,1736,4045,9532,7701,3671,1211,1622,3176,4524,9317,7800,5638,6644,6943,5463,3531,2821,1347,5958,3436,1438,2999,994,850,4131,2616,1549,3465,5946,690,9273,6954,7991 +9517,399,3249,2596,7736,2142,1322,968,7350,1614,468,3346,3265,7222,6086,1661,5317,2582,7959,4685,2807,2917,1037,5698,1529,3972,8716,2634,3301,3412,8621,743,8001,4734,888,7744,8092,3671,8941,1487,5658,7099,2781,99,1932,4443,4756,4652,9328,1581,7855,4312,5976,7255,6480,3996,2748,1973,9731,4530,2790,9417,7186,5303,3557,351,7182,9428,1342,9020,7599,1392,8304,2070,9138,7215,2008,9937,1106,7110 +7444,769,9688,632,1571,6820,8743,4338,337,3366,3073,1946,8219,104,4210,6986,249,5061,8693,7960,6546,1004,8857,5997,9352,4338,6105,5008,2556,6518,6694,4345,3727,7956,20,3954,8652,4424,9387,2035,8358,5962,5304,5194,8650,8282,1256,1103,2138,6679,1985,3653,2770,2433,4278,615,2863,1715,242,3790,2636,6998,3088,1671,2239,957,5411,4595,6282,2881,9974,2401,875,7574,2987,4587,3147,6766,9885,2965 +3287,3016,3619,6818,9073,6120,5423,557,2900,2015,8111,3873,1314,4189,1846,4399,7041,7583,2427,2864,3525,5002,2069,748,1948,6015,2684,438,770,8367,1663,7887,7759,1885,157,7770,4520,4878,3857,1137,3525,3050,6276,5569,7649,904,4533,7843,2199,5648,7628,9075,9441,3600,7231,2388,5640,9096,958,3058,584,5899,8150,1181,9616,1098,8162,6819,8171,1519,1140,7665,8801,2632,1299,9192,707,9955,2710,7314 +1772,2963,7578,3541,3095,1488,7026,2634,6015,4633,4370,2762,1650,2174,909,8158,2922,8467,4198,4280,9092,8856,8835,5457,2790,8574,9742,5054,9547,4156,7940,8126,9824,7340,8840,6574,3547,1477,3014,6798,7134,435,9484,9859,3031,4,1502,4133,1738,1807,4825,463,6343,9701,8506,9822,9555,8688,8168,3467,3234,6318,1787,5591,419,6593,7974,8486,9861,6381,6758,194,3061,4315,2863,4665,3789,2201,1492,4416 +126,8927,6608,5682,8986,6867,1715,6076,3159,788,3140,4744,830,9253,5812,5021,7616,8534,1546,9590,1101,9012,9821,8132,7857,4086,1069,7491,2988,1579,2442,4321,2149,7642,6108,250,6086,3167,24,9528,7663,2685,1220,9196,1397,5776,1577,1730,5481,977,6115,199,6326,2183,3767,5928,5586,7561,663,8649,9688,949,5913,9160,1870,5764,9887,4477,6703,1413,4995,5494,7131,2192,8969,7138,3997,8697,646,1028 +8074,1731,8245,624,4601,8706,155,8891,309,2552,8208,8452,2954,3124,3469,4246,3352,1105,4509,8677,9901,4416,8191,9283,5625,7120,2952,8881,7693,830,4580,8228,9459,8611,4499,1179,4988,1394,550,2336,6089,6872,269,7213,1848,917,6672,4890,656,1478,6536,3165,4743,4990,1176,6211,7207,5284,9730,4738,1549,4986,4942,8645,3698,9429,1439,2175,6549,3058,6513,1574,6988,8333,3406,5245,5431,7140,7085,6407 +7845,4694,2530,8249,290,5948,5509,1588,5940,4495,5866,5021,4626,3979,3296,7589,4854,1998,5627,3926,8346,6512,9608,1918,7070,4747,4182,2858,2766,4606,6269,4107,8982,8568,9053,4244,5604,102,2756,727,5887,2566,7922,44,5986,621,1202,374,6988,4130,3627,6744,9443,4568,1398,8679,397,3928,9159,367,2917,6127,5788,3304,8129,911,2669,1463,9749,264,4478,8940,1109,7309,2462,117,4692,7724,225,2312 +4164,3637,2000,941,8903,39,3443,7172,1031,3687,4901,8082,4945,4515,7204,9310,9349,9535,9940,218,1788,9245,2237,1541,5670,6538,6047,5553,9807,8101,1925,8714,445,8332,7309,6830,5786,5736,7306,2710,3034,1838,7969,6318,7912,2584,2080,7437,6705,2254,7428,820,782,9861,7596,3842,3631,8063,5240,6666,394,4565,7865,4895,9890,6028,6117,4724,9156,4473,4552,602,470,6191,4927,5387,884,3146,1978,3000 +4258,6880,1696,3582,5793,4923,2119,1155,9056,9698,6603,3768,5514,9927,9609,6166,6566,4536,4985,4934,8076,9062,6741,6163,7399,4562,2337,5600,2919,9012,8459,1308,6072,1225,9306,8818,5886,7243,7365,8792,6007,9256,6699,7171,4230,7002,8720,7839,4533,1671,478,7774,1607,2317,5437,4705,7886,4760,6760,7271,3081,2997,3088,7675,6208,3101,6821,6840,122,9633,4900,2067,8546,4549,2091,7188,5605,8599,6758,5229 +7854,5243,9155,3556,8812,7047,2202,1541,5993,4600,4760,713,434,7911,7426,7414,8729,322,803,7960,7563,4908,6285,6291,736,3389,9339,4132,8701,7534,5287,3646,592,3065,7582,2592,8755,6068,8597,1982,5782,1894,2900,6236,4039,6569,3037,5837,7698,700,7815,2491,7272,5878,3083,6778,6639,3589,5010,8313,2581,6617,5869,8402,6808,2951,2321,5195,497,2190,6187,1342,1316,4453,7740,4154,2959,1781,1482,8256 +7178,2046,4419,744,8312,5356,6855,8839,319,2962,5662,47,6307,8662,68,4813,567,2712,9931,1678,3101,8227,6533,4933,6656,92,5846,4780,6256,6361,4323,9985,1231,2175,7178,3034,9744,6155,9165,7787,5836,9318,7860,9644,8941,6480,9443,8188,5928,161,6979,2352,5628,6991,1198,8067,5867,6620,3778,8426,2994,3122,3124,6335,3918,8897,2655,9670,634,1088,1576,8935,7255,474,8166,7417,9547,2886,5560,3842 +6957,3111,26,7530,7143,1295,1744,6057,3009,1854,8098,5405,2234,4874,9447,2620,9303,27,7410,969,40,2966,5648,7596,8637,4238,3143,3679,7187,690,9980,7085,7714,9373,5632,7526,6707,3951,9734,4216,2146,3602,5371,6029,3039,4433,4855,4151,1449,3376,8009,7240,7027,4602,2947,9081,4045,8424,9352,8742,923,2705,4266,3232,2264,6761,363,2651,3383,7770,6730,7856,7340,9679,2158,610,4471,4608,910,6241 +4417,6756,1013,8797,658,8809,5032,8703,7541,846,3357,2920,9817,1745,9980,7593,4667,3087,779,3218,6233,5568,4296,2289,2654,7898,5021,9461,5593,8214,9173,4203,2271,7980,2983,5952,9992,8399,3468,1776,3188,9314,1720,6523,2933,621,8685,5483,8986,6163,3444,9539,4320,155,3992,2828,2150,6071,524,2895,5468,8063,1210,3348,9071,4862,483,9017,4097,6186,9815,3610,5048,1644,1003,9865,9332,2145,1944,2213 +9284,3803,4920,1927,6706,4344,7383,4786,9890,2010,5228,1224,3158,6967,8580,8990,8883,5213,76,8306,2031,4980,5639,9519,7184,5645,7769,3259,8077,9130,1317,3096,9624,3818,1770,695,2454,947,6029,3474,9938,3527,5696,4760,7724,7738,2848,6442,5767,6845,8323,4131,2859,7595,2500,4815,3660,9130,8580,7016,8231,4391,8369,3444,4069,4021,556,6154,627,2778,1496,4206,6356,8434,8491,3816,8231,3190,5575,1015 +3787,7572,1788,6803,5641,6844,1961,4811,8535,9914,9999,1450,8857,738,4662,8569,6679,2225,7839,8618,286,2648,5342,2294,3205,4546,176,8705,3741,6134,8324,8021,7004,5205,7032,6637,9442,5539,5584,4819,5874,5807,8589,6871,9016,983,1758,3786,1519,6241,185,8398,495,3370,9133,3051,4549,9674,7311,9738,3316,9383,2658,2776,9481,7558,619,3943,3324,6491,4933,153,9738,4623,912,3595,7771,7939,1219,4405 +2650,3883,4154,5809,315,7756,4430,1788,4451,1631,6461,7230,6017,5751,138,588,5282,2442,9110,9035,6349,2515,1570,6122,4192,4174,3530,1933,4186,4420,4609,5739,4135,2963,6308,1161,8809,8619,2796,3819,6971,8228,4188,1492,909,8048,2328,6772,8467,7671,9068,2226,7579,6422,7056,8042,3296,2272,3006,2196,7320,3238,3490,3102,37,1293,3212,4767,5041,8773,5794,4456,6174,7279,7054,2835,7053,9088,790,6640 +3101,1057,7057,3826,6077,1025,2955,1224,1114,6729,5902,4698,6239,7203,9423,1804,4417,6686,1426,6941,8071,1029,4985,9010,6122,6597,1622,1574,3513,1684,7086,5505,3244,411,9638,4150,907,9135,829,981,1707,5359,8781,9751,5,9131,3973,7159,1340,6955,7514,7993,6964,8198,1933,2797,877,3993,4453,8020,9349,8646,2779,8679,2961,3547,3374,3510,1129,3568,2241,2625,9138,5974,8206,7669,7678,1833,8700,4480 +4865,9912,8038,8238,782,3095,8199,1127,4501,7280,2112,2487,3626,2790,9432,1475,6312,8277,4827,2218,5806,7132,8752,1468,7471,6386,739,8762,8323,8120,5169,9078,9058,3370,9560,7987,8585,8531,5347,9312,1058,4271,1159,5286,5404,6925,8606,9204,7361,2415,560,586,4002,2644,1927,2824,768,4409,2942,3345,1002,808,4941,6267,7979,5140,8643,7553,9438,7320,4938,2666,4609,2778,8158,6730,3748,3867,1866,7181 +171,3771,7134,8927,4778,2913,3326,2004,3089,7853,1378,1729,4777,2706,9578,1360,5693,3036,1851,7248,2403,2273,8536,6501,9216,613,9671,7131,7719,6425,773,717,8803,160,1114,7554,7197,753,4513,4322,8499,4533,2609,4226,8710,6627,644,9666,6260,4870,5744,7385,6542,6203,7703,6130,8944,5589,2262,6803,6381,7414,6888,5123,7320,9392,9061,6780,322,8975,7050,5089,1061,2260,3199,1150,1865,5386,9699,6501 +3744,8454,6885,8277,919,1923,4001,6864,7854,5519,2491,6057,8794,9645,1776,5714,9786,9281,7538,6916,3215,395,2501,9618,4835,8846,9708,2813,3303,1794,8309,7176,2206,1602,1838,236,4593,2245,8993,4017,10,8215,6921,5206,4023,5932,6997,7801,262,7640,3107,8275,4938,7822,2425,3223,3886,2105,8700,9526,2088,8662,8034,7004,5710,2124,7164,3574,6630,9980,4242,2901,9471,1491,2117,4562,1130,9086,4117,6698 +2810,2280,2331,1170,4554,4071,8387,1215,2274,9848,6738,1604,7281,8805,439,1298,8318,7834,9426,8603,6092,7944,1309,8828,303,3157,4638,4439,9175,1921,4695,7716,1494,1015,1772,5913,1127,1952,1950,8905,4064,9890,385,9357,7945,5035,7082,5369,4093,6546,5187,5637,2041,8946,1758,7111,6566,1027,1049,5148,7224,7248,296,6169,375,1656,7993,2816,3717,4279,4675,1609,3317,42,6201,3100,3144,163,9530,4531 +7096,6070,1009,4988,3538,5801,7149,3063,2324,2912,7911,7002,4338,7880,2481,7368,3516,2016,7556,2193,1388,3865,8125,4637,4096,8114,750,3144,1938,7002,9343,4095,1392,4220,3455,6969,9647,1321,9048,1996,1640,6626,1788,314,9578,6630,2813,6626,4981,9908,7024,4355,3201,3521,3864,3303,464,1923,595,9801,3391,8366,8084,9374,1041,8807,9085,1892,9431,8317,9016,9221,8574,9981,9240,5395,2009,6310,2854,9255 +8830,3145,2960,9615,8220,6061,3452,2918,6481,9278,2297,3385,6565,7066,7316,5682,107,7646,4466,68,1952,9603,8615,54,7191,791,6833,2560,693,9733,4168,570,9127,9537,1925,8287,5508,4297,8452,8795,6213,7994,2420,4208,524,5915,8602,8330,2651,8547,6156,1812,6271,7991,9407,9804,1553,6866,1128,2119,4691,9711,8315,5879,9935,6900,482,682,4126,1041,428,6247,3720,5882,7526,2582,4327,7725,3503,2631 +2738,9323,721,7434,1453,6294,2957,3786,5722,6019,8685,4386,3066,9057,6860,499,5315,3045,5194,7111,3137,9104,941,586,3066,755,4177,8819,7040,5309,3583,3897,4428,7788,4721,7249,6559,7324,825,7311,3760,6064,6070,9672,4882,584,1365,9739,9331,5783,2624,7889,1604,1303,1555,7125,8312,425,8936,3233,7724,1480,403,7440,1784,1754,4721,1569,652,3893,4574,5692,9730,4813,9844,8291,9199,7101,3391,8914 +6044,2928,9332,3328,8588,447,3830,1176,3523,2705,8365,6136,5442,9049,5526,8575,8869,9031,7280,706,2794,8814,5767,4241,7696,78,6570,556,5083,1426,4502,3336,9518,2292,1885,3740,3153,9348,9331,8051,2759,5407,9028,7840,9255,831,515,2612,9747,7435,8964,4971,2048,4900,5967,8271,1719,9670,2810,6777,1594,6367,6259,8316,3815,1689,6840,9437,4361,822,9619,3065,83,6344,7486,8657,8228,9635,6932,4864 +8478,4777,6334,4678,7476,4963,6735,3096,5860,1405,5127,7269,7793,4738,227,9168,2996,8928,765,733,1276,7677,6258,1528,9558,3329,302,8901,1422,8277,6340,645,9125,8869,5952,141,8141,1816,9635,4025,4184,3093,83,2344,2747,9352,7966,1206,1126,1826,218,7939,2957,2729,810,8752,5247,4174,4038,8884,7899,9567,301,5265,5752,7524,4381,1669,3106,8270,6228,6373,754,2547,4240,2313,5514,3022,1040,9738 +2265,8192,1763,1369,8469,8789,4836,52,1212,6690,5257,8918,6723,6319,378,4039,2421,8555,8184,9577,1432,7139,8078,5452,9628,7579,4161,7490,5159,8559,1011,81,478,5840,1964,1334,6875,8670,9900,739,1514,8692,522,9316,6955,1345,8132,2277,3193,9773,3923,4177,2183,1236,6747,6575,4874,6003,6409,8187,745,8776,9440,7543,9825,2582,7381,8147,7236,5185,7564,6125,218,7991,6394,391,7659,7456,5128,5294 +2132,8992,8160,5782,4420,3371,3798,5054,552,5631,7546,4716,1332,6486,7892,7441,4370,6231,4579,2121,8615,1145,9391,1524,1385,2400,9437,2454,7896,7467,2928,8400,3299,4025,7458,4703,7206,6358,792,6200,725,4275,4136,7390,5984,4502,7929,5085,8176,4600,119,3568,76,9363,6943,2248,9077,9731,6213,5817,6729,4190,3092,6910,759,2682,8380,1254,9604,3011,9291,5329,9453,9746,2739,6522,3765,5634,1113,5789 +5304,5499,564,2801,679,2653,1783,3608,7359,7797,3284,796,3222,437,7185,6135,8571,2778,7488,5746,678,6140,861,7750,803,9859,9918,2425,3734,2698,9005,4864,9818,6743,2475,132,9486,3825,5472,919,292,4411,7213,7699,6435,9019,6769,1388,802,2124,1345,8493,9487,8558,7061,8777,8833,2427,2238,5409,4957,8503,3171,7622,5779,6145,2417,5873,5563,5693,9574,9491,1937,7384,4563,6842,5432,2751,3406,7981 diff --git a/problem_data/no083.txt b/problem_data/no083.txt new file mode 100644 index 0000000..1e9e6cd --- /dev/null +++ b/problem_data/no083.txt @@ -0,0 +1,80 @@ +4445,2697,5115,718,2209,2212,654,4348,3079,6821,7668,3276,8874,4190,3785,2752,9473,7817,9137,496,7338,3434,7152,4355,4552,7917,7827,2460,2350,691,3514,5880,3145,7633,7199,3783,5066,7487,3285,1084,8985,760,872,8609,8051,1134,9536,5750,9716,9371,7619,5617,275,9721,2997,2698,1887,8825,6372,3014,2113,7122,7050,6775,5948,2758,1219,3539,348,7989,2735,9862,1263,8089,6401,9462,3168,2758,3748,5870 +1096,20,1318,7586,5167,2642,1443,5741,7621,7030,5526,4244,2348,4641,9827,2448,6918,5883,3737,300,7116,6531,567,5997,3971,6623,820,6148,3287,1874,7981,8424,7672,7575,6797,6717,1078,5008,4051,8795,5820,346,1851,6463,2117,6058,3407,8211,117,4822,1317,4377,4434,5925,8341,4800,1175,4173,690,8978,7470,1295,3799,8724,3509,9849,618,3320,7068,9633,2384,7175,544,6583,1908,9983,481,4187,9353,9377 +9607,7385,521,6084,1364,8983,7623,1585,6935,8551,2574,8267,4781,3834,2764,2084,2669,4656,9343,7709,2203,9328,8004,6192,5856,3555,2260,5118,6504,1839,9227,1259,9451,1388,7909,5733,6968,8519,9973,1663,5315,7571,3035,4325,4283,2304,6438,3815,9213,9806,9536,196,5542,6907,2475,1159,5820,9075,9470,2179,9248,1828,4592,9167,3713,4640,47,3637,309,7344,6955,346,378,9044,8635,7466,5036,9515,6385,9230 +7206,3114,7760,1094,6150,5182,7358,7387,4497,955,101,1478,7777,6966,7010,8417,6453,4955,3496,107,449,8271,131,2948,6185,784,5937,8001,6104,8282,4165,3642,710,2390,575,715,3089,6964,4217,192,5949,7006,715,3328,1152,66,8044,4319,1735,146,4818,5456,6451,4113,1063,4781,6799,602,1504,6245,6550,1417,1343,2363,3785,5448,4545,9371,5420,5068,4613,4882,4241,5043,7873,8042,8434,3939,9256,2187 +3620,8024,577,9997,7377,7682,1314,1158,6282,6310,1896,2509,5436,1732,9480,706,496,101,6232,7375,2207,2306,110,6772,3433,2878,8140,5933,8688,1399,2210,7332,6172,6403,7333,4044,2291,1790,2446,7390,8698,5723,3678,7104,1825,2040,140,3982,4905,4160,2200,5041,2512,1488,2268,1175,7588,8321,8078,7312,977,5257,8465,5068,3453,3096,1651,7906,253,9250,6021,8791,8109,6651,3412,345,4778,5152,4883,7505 +1074,5438,9008,2679,5397,5429,2652,3403,770,9188,4248,2493,4361,8327,9587,707,9525,5913,93,1899,328,2876,3604,673,8576,6908,7659,2544,3359,3883,5273,6587,3065,1749,3223,604,9925,6941,2823,8767,7039,3290,3214,1787,7904,3421,7137,9560,8451,2669,9219,6332,1576,5477,6755,8348,4164,4307,2984,4012,6629,1044,2874,6541,4942,903,1404,9125,5160,8836,4345,2581,460,8438,1538,5507,668,3352,2678,6942 +4295,1176,5596,1521,3061,9868,7037,7129,8933,6659,5947,5063,3653,9447,9245,2679,767,714,116,8558,163,3927,8779,158,5093,2447,5782,3967,1716,931,7772,8164,1117,9244,5783,7776,3846,8862,6014,2330,6947,1777,3112,6008,3491,1906,5952,314,4602,8994,5919,9214,3995,5026,7688,6809,5003,3128,2509,7477,110,8971,3982,8539,2980,4689,6343,5411,2992,5270,5247,9260,2269,7474,1042,7162,5206,1232,4556,4757 +510,3556,5377,1406,5721,4946,2635,7847,4251,8293,8281,6351,4912,287,2870,3380,3948,5322,3840,4738,9563,1906,6298,3234,8959,1562,6297,8835,7861,239,6618,1322,2553,2213,5053,5446,4402,6500,5182,8585,6900,5756,9661,903,5186,7687,5998,7997,8081,8955,4835,6069,2621,1581,732,9564,1082,1853,5442,1342,520,1737,3703,5321,4793,2776,1508,1647,9101,2499,6891,4336,7012,3329,3212,1442,9993,3988,4930,7706 +9444,3401,5891,9716,1228,7107,109,3563,2700,6161,5039,4992,2242,8541,7372,2067,1294,3058,1306,320,8881,5756,9326,411,8650,8824,5495,8282,8397,2000,1228,7817,2099,6473,3571,5994,4447,1299,5991,543,7874,2297,1651,101,2093,3463,9189,6872,6118,872,1008,1779,2805,9084,4048,2123,5877,55,3075,1737,9459,4535,6453,3644,108,5982,4437,5213,1340,6967,9943,5815,669,8074,1838,6979,9132,9315,715,5048 +3327,4030,7177,6336,9933,5296,2621,4785,2755,4832,2512,2118,2244,4407,2170,499,7532,9742,5051,7687,970,6924,3527,4694,5145,1306,2165,5940,2425,8910,3513,1909,6983,346,6377,4304,9330,7203,6605,3709,3346,970,369,9737,5811,4427,9939,3693,8436,5566,1977,3728,2399,3985,8303,2492,5366,9802,9193,7296,1033,5060,9144,2766,1151,7629,5169,5995,58,7619,7565,4208,1713,6279,3209,4908,9224,7409,1325,8540 +6882,1265,1775,3648,4690,959,5837,4520,5394,1378,9485,1360,4018,578,9174,2932,9890,3696,116,1723,1178,9355,7063,1594,1918,8574,7594,7942,1547,6166,7888,354,6932,4651,1010,7759,6905,661,7689,6092,9292,3845,9605,8443,443,8275,5163,7720,7265,6356,7779,1798,1754,5225,6661,1180,8024,5666,88,9153,1840,3508,1193,4445,2648,3538,6243,6375,8107,5902,5423,2520,1122,5015,6113,8859,9370,966,8673,2442 +7338,3423,4723,6533,848,8041,7921,8277,4094,5368,7252,8852,9166,2250,2801,6125,8093,5738,4038,9808,7359,9494,601,9116,4946,2702,5573,2921,9862,1462,1269,2410,4171,2709,7508,6241,7522,615,2407,8200,4189,5492,5649,7353,2590,5203,4274,710,7329,9063,956,8371,3722,4253,4785,1194,4828,4717,4548,940,983,2575,4511,2938,1827,2027,2700,1236,841,5760,1680,6260,2373,3851,1841,4968,1172,5179,7175,3509 +4420,1327,3560,2376,6260,2988,9537,4064,4829,8872,9598,3228,1792,7118,9962,9336,4368,9189,6857,1829,9863,6287,7303,7769,2707,8257,2391,2009,3975,4993,3068,9835,3427,341,8412,2134,4034,8511,6421,3041,9012,2983,7289,100,1355,7904,9186,6920,5856,2008,6545,8331,3655,5011,839,8041,9255,6524,3862,8788,62,7455,3513,5003,8413,3918,2076,7960,6108,3638,6999,3436,1441,4858,4181,1866,8731,7745,3744,1000 +356,8296,8325,1058,1277,4743,3850,2388,6079,6462,2815,5620,8495,5378,75,4324,3441,9870,1113,165,1544,1179,2834,562,6176,2313,6836,8839,2986,9454,5199,6888,1927,5866,8760,320,1792,8296,7898,6121,7241,5886,5814,2815,8336,1576,4314,3109,2572,6011,2086,9061,9403,3947,5487,9731,7281,3159,1819,1334,3181,5844,5114,9898,4634,2531,4412,6430,4262,8482,4546,4555,6804,2607,9421,686,8649,8860,7794,6672 +9870,152,1558,4963,8750,4754,6521,6256,8818,5208,5691,9659,8377,9725,5050,5343,2539,6101,1844,9700,7750,8114,5357,3001,8830,4438,199,9545,8496,43,2078,327,9397,106,6090,8181,8646,6414,7499,5450,4850,6273,5014,4131,7639,3913,6571,8534,9703,4391,7618,445,1320,5,1894,6771,7383,9191,4708,9706,6939,7937,8726,9382,5216,3685,2247,9029,8154,1738,9984,2626,9438,4167,6351,5060,29,1218,1239,4785 +192,5213,8297,8974,4032,6966,5717,1179,6523,4679,9513,1481,3041,5355,9303,9154,1389,8702,6589,7818,6336,3539,5538,3094,6646,6702,6266,2759,4608,4452,617,9406,8064,6379,444,5602,4950,1810,8391,1536,316,8714,1178,5182,5863,5110,5372,4954,1978,2971,5680,4863,2255,4630,5723,2168,538,1692,1319,7540,440,6430,6266,7712,7385,5702,620,641,3136,7350,1478,3155,2820,9109,6261,1122,4470,14,8493,2095 +1046,4301,6082,474,4974,7822,2102,5161,5172,6946,8074,9716,6586,9962,9749,5015,2217,995,5388,4402,7652,6399,6539,1349,8101,3677,1328,9612,7922,2879,231,5887,2655,508,4357,4964,3554,5930,6236,7384,4614,280,3093,9600,2110,7863,2631,6626,6620,68,1311,7198,7561,1768,5139,1431,221,230,2940,968,5283,6517,2146,1646,869,9402,7068,8645,7058,1765,9690,4152,2926,9504,2939,7504,6074,2944,6470,7859 +4659,736,4951,9344,1927,6271,8837,8711,3241,6579,7660,5499,5616,3743,5801,4682,9748,8796,779,1833,4549,8138,4026,775,4170,2432,4174,3741,7540,8017,2833,4027,396,811,2871,1150,9809,2719,9199,8504,1224,540,2051,3519,7982,7367,2761,308,3358,6505,2050,4836,5090,7864,805,2566,2409,6876,3361,8622,5572,5895,3280,441,7893,8105,1634,2929,274,3926,7786,6123,8233,9921,2674,5340,1445,203,4585,3837 +5759,338,7444,7968,7742,3755,1591,4839,1705,650,7061,2461,9230,9391,9373,2413,1213,431,7801,4994,2380,2703,6161,6878,8331,2538,6093,1275,5065,5062,2839,582,1014,8109,3525,1544,1569,8622,7944,2905,6120,1564,1839,5570,7579,1318,2677,5257,4418,5601,7935,7656,5192,1864,5886,6083,5580,6202,8869,1636,7907,4759,9082,5854,3185,7631,6854,5872,5632,5280,1431,2077,9717,7431,4256,8261,9680,4487,4752,4286 +1571,1428,8599,1230,7772,4221,8523,9049,4042,8726,7567,6736,9033,2104,4879,4967,6334,6716,3994,1269,8995,6539,3610,7667,6560,6065,874,848,4597,1711,7161,4811,6734,5723,6356,6026,9183,2586,5636,1092,7779,7923,8747,6887,7505,9909,1792,3233,4526,3176,1508,8043,720,5212,6046,4988,709,5277,8256,3642,1391,5803,1468,2145,3970,6301,7767,2359,8487,9771,8785,7520,856,1605,8972,2402,2386,991,1383,5963 +1822,4824,5957,6511,9868,4113,301,9353,6228,2881,2966,6956,9124,9574,9233,1601,7340,973,9396,540,4747,8590,9535,3650,7333,7583,4806,3593,2738,8157,5215,8472,2284,9473,3906,6982,5505,6053,7936,6074,7179,6688,1564,1103,6860,5839,2022,8490,910,7551,7805,881,7024,1855,9448,4790,1274,3672,2810,774,7623,4223,4850,6071,9975,4935,1915,9771,6690,3846,517,463,7624,4511,614,6394,3661,7409,1395,8127 +8738,3850,9555,3695,4383,2378,87,6256,6740,7682,9546,4255,6105,2000,1851,4073,8957,9022,6547,5189,2487,303,9602,7833,1628,4163,6678,3144,8589,7096,8913,5823,4890,7679,1212,9294,5884,2972,3012,3359,7794,7428,1579,4350,7246,4301,7779,7790,3294,9547,4367,3549,1958,8237,6758,3497,3250,3456,6318,1663,708,7714,6143,6890,3428,6853,9334,7992,591,6449,9786,1412,8500,722,5468,1371,108,3939,4199,2535 +7047,4323,1934,5163,4166,461,3544,2767,6554,203,6098,2265,9078,2075,4644,6641,8412,9183,487,101,7566,5622,1975,5726,2920,5374,7779,5631,3753,3725,2672,3621,4280,1162,5812,345,8173,9785,1525,955,5603,2215,2580,5261,2765,2990,5979,389,3907,2484,1232,5933,5871,3304,1138,1616,5114,9199,5072,7442,7245,6472,4760,6359,9053,7876,2564,9404,3043,9026,2261,3374,4460,7306,2326,966,828,3274,1712,3446 +3975,4565,8131,5800,4570,2306,8838,4392,9147,11,3911,7118,9645,4994,2028,6062,5431,2279,8752,2658,7836,994,7316,5336,7185,3289,1898,9689,2331,5737,3403,1124,2679,3241,7748,16,2724,5441,6640,9368,9081,5618,858,4969,17,2103,6035,8043,7475,2181,939,415,1617,8500,8253,2155,7843,7974,7859,1746,6336,3193,2617,8736,4079,6324,6645,8891,9396,5522,6103,1857,8979,3835,2475,1310,7422,610,8345,7615 +9248,5397,5686,2988,3446,4359,6634,9141,497,9176,6773,7448,1907,8454,916,1596,2241,1626,1384,2741,3649,5362,8791,7170,2903,2475,5325,6451,924,3328,522,90,4813,9737,9557,691,2388,1383,4021,1609,9206,4707,5200,7107,8104,4333,9860,5013,1224,6959,8527,1877,4545,7772,6268,621,4915,9349,5970,706,9583,3071,4127,780,8231,3017,9114,3836,7503,2383,1977,4870,8035,2379,9704,1037,3992,3642,1016,4303 +5093,138,4639,6609,1146,5565,95,7521,9077,2272,974,4388,2465,2650,722,4998,3567,3047,921,2736,7855,173,2065,4238,1048,5,6847,9548,8632,9194,5942,4777,7910,8971,6279,7253,2516,1555,1833,3184,9453,9053,6897,7808,8629,4877,1871,8055,4881,7639,1537,7701,2508,7564,5845,5023,2304,5396,3193,2955,1088,3801,6203,1748,3737,1276,13,4120,7715,8552,3047,2921,106,7508,304,1280,7140,2567,9135,5266 +6237,4607,7527,9047,522,7371,4883,2540,5867,6366,5301,1570,421,276,3361,527,6637,4861,2401,7522,5808,9371,5298,2045,5096,5447,7755,5115,7060,8529,4078,1943,1697,1764,5453,7085,960,2405,739,2100,5800,728,9737,5704,5693,1431,8979,6428,673,7540,6,7773,5857,6823,150,5869,8486,684,5816,9626,7451,5579,8260,3397,5322,6920,1879,2127,2884,5478,4977,9016,6165,6292,3062,5671,5968,78,4619,4763 +9905,7127,9390,5185,6923,3721,9164,9705,4341,1031,1046,5127,7376,6528,3248,4941,1178,7889,3364,4486,5358,9402,9158,8600,1025,874,1839,1783,309,9030,1843,845,8398,1433,7118,70,8071,2877,3904,8866,6722,4299,10,1929,5897,4188,600,1889,3325,2485,6473,4474,7444,6992,4846,6166,4441,2283,2629,4352,7775,1101,2214,9985,215,8270,9750,2740,8361,7103,5930,8664,9690,8302,9267,344,2077,1372,1880,9550 +5825,8517,7769,2405,8204,1060,3603,7025,478,8334,1997,3692,7433,9101,7294,7498,9415,5452,3850,3508,6857,9213,6807,4412,7310,854,5384,686,4978,892,8651,3241,2743,3801,3813,8588,6701,4416,6990,6490,3197,6838,6503,114,8343,5844,8646,8694,65,791,5979,2687,2621,2019,8097,1423,3644,9764,4921,3266,3662,5561,2476,8271,8138,6147,1168,3340,1998,9874,6572,9873,6659,5609,2711,3931,9567,4143,7833,8887 +6223,2099,2700,589,4716,8333,1362,5007,2753,2848,4441,8397,7192,8191,4916,9955,6076,3370,6396,6971,3156,248,3911,2488,4930,2458,7183,5455,170,6809,6417,3390,1956,7188,577,7526,2203,968,8164,479,8699,7915,507,6393,4632,1597,7534,3604,618,3280,6061,9793,9238,8347,568,9645,2070,5198,6482,5000,9212,6655,5961,7513,1323,3872,6170,3812,4146,2736,67,3151,5548,2781,9679,7564,5043,8587,1893,4531 +5826,3690,6724,2121,9308,6986,8106,6659,2142,1642,7170,2877,5757,6494,8026,6571,8387,9961,6043,9758,9607,6450,8631,8334,7359,5256,8523,2225,7487,1977,9555,8048,5763,2414,4948,4265,2427,8978,8088,8841,9208,9601,5810,9398,8866,9138,4176,5875,7212,3272,6759,5678,7649,4922,5422,1343,8197,3154,3600,687,1028,4579,2084,9467,4492,7262,7296,6538,7657,7134,2077,1505,7332,6890,8964,4879,7603,7400,5973,739 +1861,1613,4879,1884,7334,966,2000,7489,2123,4287,1472,3263,4726,9203,1040,4103,6075,6049,330,9253,4062,4268,1635,9960,577,1320,3195,9628,1030,4092,4979,6474,6393,2799,6967,8687,7724,7392,9927,2085,3200,6466,8702,265,7646,8665,7986,7266,4574,6587,612,2724,704,3191,8323,9523,3002,704,5064,3960,8209,2027,2758,8393,4875,4641,9584,6401,7883,7014,768,443,5490,7506,1852,2005,8850,5776,4487,4269 +4052,6687,4705,7260,6645,6715,3706,5504,8672,2853,1136,8187,8203,4016,871,1809,1366,4952,9294,5339,6872,2645,6083,7874,3056,5218,7485,8796,7401,3348,2103,426,8572,4163,9171,3176,948,7654,9344,3217,1650,5580,7971,2622,76,2874,880,2034,9929,1546,2659,5811,3754,7096,7436,9694,9960,7415,2164,953,2360,4194,2397,1047,2196,6827,575,784,2675,8821,6802,7972,5996,6699,2134,7577,2887,1412,4349,4380 +4629,2234,6240,8132,7592,3181,6389,1214,266,1910,2451,8784,2790,1127,6932,1447,8986,2492,5476,397,889,3027,7641,5083,5776,4022,185,3364,5701,2442,2840,4160,9525,4828,6602,2614,7447,3711,4505,7745,8034,6514,4907,2605,7753,6958,7270,6936,3006,8968,439,2326,4652,3085,3425,9863,5049,5361,8688,297,7580,8777,7916,6687,8683,7141,306,9569,2384,1500,3346,4601,7329,9040,6097,2727,6314,4501,4974,2829 +8316,4072,2025,6884,3027,1808,5714,7624,7880,8528,4205,8686,7587,3230,1139,7273,6163,6986,3914,9309,1464,9359,4474,7095,2212,7302,2583,9462,7532,6567,1606,4436,8981,5612,6796,4385,5076,2007,6072,3678,8331,1338,3299,8845,4783,8613,4071,1232,6028,2176,3990,2148,3748,103,9453,538,6745,9110,926,3125,473,5970,8728,7072,9062,1404,1317,5139,9862,6496,6062,3338,464,1600,2532,1088,8232,7739,8274,3873 +2341,523,7096,8397,8301,6541,9844,244,4993,2280,7689,4025,4196,5522,7904,6048,2623,9258,2149,9461,6448,8087,7245,1917,8340,7127,8466,5725,6996,3421,5313,512,9164,9837,9794,8369,4185,1488,7210,1524,1016,4620,9435,2478,7765,8035,697,6677,3724,6988,5853,7662,3895,9593,1185,4727,6025,5734,7665,3070,138,8469,6748,6459,561,7935,8646,2378,462,7755,3115,9690,8877,3946,2728,8793,244,6323,8666,4271 +6430,2406,8994,56,1267,3826,9443,7079,7579,5232,6691,3435,6718,5698,4144,7028,592,2627,217,734,6194,8156,9118,58,2640,8069,4127,3285,694,3197,3377,4143,4802,3324,8134,6953,7625,3598,3584,4289,7065,3434,2106,7132,5802,7920,9060,7531,3321,1725,1067,3751,444,5503,6785,7937,6365,4803,198,6266,8177,1470,6390,1606,2904,7555,9834,8667,2033,1723,5167,1666,8546,8152,473,4475,6451,7947,3062,3281 +2810,3042,7759,1741,2275,2609,7676,8640,4117,1958,7500,8048,1757,3954,9270,1971,4796,2912,660,5511,3553,1012,5757,4525,6084,7198,8352,5775,7726,8591,7710,9589,3122,4392,6856,5016,749,2285,3356,7482,9956,7348,2599,8944,495,3462,3578,551,4543,7207,7169,7796,1247,4278,6916,8176,3742,8385,2310,1345,8692,2667,4568,1770,8319,3585,4920,3890,4928,7343,5385,9772,7947,8786,2056,9266,3454,2807,877,2660 +6206,8252,5928,5837,4177,4333,207,7934,5581,9526,8906,1498,8411,2984,5198,5134,2464,8435,8514,8674,3876,599,5327,826,2152,4084,2433,9327,9697,4800,2728,3608,3849,3861,3498,9943,1407,3991,7191,9110,5666,8434,4704,6545,5944,2357,1163,4995,9619,6754,4200,9682,6654,4862,4744,5953,6632,1054,293,9439,8286,2255,696,8709,1533,1844,6441,430,1999,6063,9431,7018,8057,2920,6266,6799,356,3597,4024,6665 +3847,6356,8541,7225,2325,2946,5199,469,5450,7508,2197,9915,8284,7983,6341,3276,3321,16,1321,7608,5015,3362,8491,6968,6818,797,156,2575,706,9516,5344,5457,9210,5051,8099,1617,9951,7663,8253,9683,2670,1261,4710,1068,8753,4799,1228,2621,3275,6188,4699,1791,9518,8701,5932,4275,6011,9877,2933,4182,6059,2930,6687,6682,9771,654,9437,3169,8596,1827,5471,8909,2352,123,4394,3208,8756,5513,6917,2056 +5458,8173,3138,3290,4570,4892,3317,4251,9699,7973,1163,1935,5477,6648,9614,5655,9592,975,9118,2194,7322,8248,8413,3462,8560,1907,7810,6650,7355,2939,4973,6894,3933,3784,3200,2419,9234,4747,2208,2207,1945,2899,1407,6145,8023,3484,5688,7686,2737,3828,3704,9004,5190,9740,8643,8650,5358,4426,1522,1707,3613,9887,6956,2447,2762,833,1449,9489,2573,1080,4167,3456,6809,2466,227,7125,2759,6250,6472,8089 +3266,7025,9756,3914,1265,9116,7723,9788,6805,5493,2092,8688,6592,9173,4431,4028,6007,7131,4446,4815,3648,6701,759,3312,8355,4485,4187,5188,8746,7759,3528,2177,5243,8379,3838,7233,4607,9187,7216,2190,6967,2920,6082,7910,5354,3609,8958,6949,7731,494,8753,8707,1523,4426,3543,7085,647,6771,9847,646,5049,824,8417,5260,2730,5702,2513,9275,4279,2767,8684,1165,9903,4518,55,9682,8963,6005,2102,6523 +1998,8731,936,1479,5259,7064,4085,91,7745,7136,3773,3810,730,8255,2705,2653,9790,6807,2342,355,9344,2668,3690,2028,9679,8102,574,4318,6481,9175,5423,8062,2867,9657,7553,3442,3920,7430,3945,7639,3714,3392,2525,4995,4850,2867,7951,9667,486,9506,9888,781,8866,1702,3795,90,356,1483,4200,2131,6969,5931,486,6880,4404,1084,5169,4910,6567,8335,4686,5043,2614,3352,2667,4513,6472,7471,5720,1616 +8878,1613,1716,868,1906,2681,564,665,5995,2474,7496,3432,9491,9087,8850,8287,669,823,347,6194,2264,2592,7871,7616,8508,4827,760,2676,4660,4881,7572,3811,9032,939,4384,929,7525,8419,5556,9063,662,8887,7026,8534,3111,1454,2082,7598,5726,6687,9647,7608,73,3014,5063,670,5461,5631,3367,9796,8475,7908,5073,1565,5008,5295,4457,1274,4788,1728,338,600,8415,8535,9351,7750,6887,5845,1741,125 +3637,6489,9634,9464,9055,2413,7824,9517,7532,3577,7050,6186,6980,9365,9782,191,870,2497,8498,2218,2757,5420,6468,586,3320,9230,1034,1393,9886,5072,9391,1178,8464,8042,6869,2075,8275,3601,7715,9470,8786,6475,8373,2159,9237,2066,3264,5000,679,355,3069,4073,494,2308,5512,4334,9438,8786,8637,9774,1169,1949,6594,6072,4270,9158,7916,5752,6794,9391,6301,5842,3285,2141,3898,8027,4310,8821,7079,1307 +8497,6681,4732,7151,7060,5204,9030,7157,833,5014,8723,3207,9796,9286,4913,119,5118,7650,9335,809,3675,2597,5144,3945,5090,8384,187,4102,1260,2445,2792,4422,8389,9290,50,1765,1521,6921,8586,4368,1565,5727,7855,2003,4834,9897,5911,8630,5070,1330,7692,7557,7980,6028,5805,9090,8265,3019,3802,698,9149,5748,1965,9658,4417,5994,5584,8226,2937,272,5743,1278,5698,8736,2595,6475,5342,6596,1149,6920 +8188,8009,9546,6310,8772,2500,9846,6592,6872,3857,1307,8125,7042,1544,6159,2330,643,4604,7899,6848,371,8067,2062,3200,7295,1857,9505,6936,384,2193,2190,301,8535,5503,1462,7380,5114,4824,8833,1763,4974,8711,9262,6698,3999,2645,6937,7747,1128,2933,3556,7943,2885,3122,9105,5447,418,2899,5148,3699,9021,9501,597,4084,175,1621,1,1079,6067,5812,4326,9914,6633,5394,4233,6728,9084,1864,5863,1225 +9935,8793,9117,1825,9542,8246,8437,3331,9128,9675,6086,7075,319,1334,7932,3583,7167,4178,1726,7720,695,8277,7887,6359,5912,1719,2780,8529,1359,2013,4498,8072,1129,9998,1147,8804,9405,6255,1619,2165,7491,1,8882,7378,3337,503,5758,4109,3577,985,3200,7615,8058,5032,1080,6410,6873,5496,1466,2412,9885,5904,4406,3605,8770,4361,6205,9193,1537,9959,214,7260,9566,1685,100,4920,7138,9819,5637,976 +3466,9854,985,1078,7222,8888,5466,5379,3578,4540,6853,8690,3728,6351,7147,3134,6921,9692,857,3307,4998,2172,5783,3931,9417,2541,6299,13,787,2099,9131,9494,896,8600,1643,8419,7248,2660,2609,8579,91,6663,5506,7675,1947,6165,4286,1972,9645,3805,1663,1456,8853,5705,9889,7489,1107,383,4044,2969,3343,152,7805,4980,9929,5033,1737,9953,7197,9158,4071,1324,473,9676,3984,9680,3606,8160,7384,5432 +1005,4512,5186,3953,2164,3372,4097,3247,8697,3022,9896,4101,3871,6791,3219,2742,4630,6967,7829,5991,6134,1197,1414,8923,8787,1394,8852,5019,7768,5147,8004,8825,5062,9625,7988,1110,3992,7984,9966,6516,6251,8270,421,3723,1432,4830,6935,8095,9059,2214,6483,6846,3120,1587,6201,6691,9096,9627,6671,4002,3495,9939,7708,7465,5879,6959,6634,3241,3401,2355,9061,2611,7830,3941,2177,2146,5089,7079,519,6351 +7280,8586,4261,2831,7217,3141,9994,9940,5462,2189,4005,6942,9848,5350,8060,6665,7519,4324,7684,657,9453,9296,2944,6843,7499,7847,1728,9681,3906,6353,5529,2822,3355,3897,7724,4257,7489,8672,4356,3983,1948,6892,7415,4153,5893,4190,621,1736,4045,9532,7701,3671,1211,1622,3176,4524,9317,7800,5638,6644,6943,5463,3531,2821,1347,5958,3436,1438,2999,994,850,4131,2616,1549,3465,5946,690,9273,6954,7991 +9517,399,3249,2596,7736,2142,1322,968,7350,1614,468,3346,3265,7222,6086,1661,5317,2582,7959,4685,2807,2917,1037,5698,1529,3972,8716,2634,3301,3412,8621,743,8001,4734,888,7744,8092,3671,8941,1487,5658,7099,2781,99,1932,4443,4756,4652,9328,1581,7855,4312,5976,7255,6480,3996,2748,1973,9731,4530,2790,9417,7186,5303,3557,351,7182,9428,1342,9020,7599,1392,8304,2070,9138,7215,2008,9937,1106,7110 +7444,769,9688,632,1571,6820,8743,4338,337,3366,3073,1946,8219,104,4210,6986,249,5061,8693,7960,6546,1004,8857,5997,9352,4338,6105,5008,2556,6518,6694,4345,3727,7956,20,3954,8652,4424,9387,2035,8358,5962,5304,5194,8650,8282,1256,1103,2138,6679,1985,3653,2770,2433,4278,615,2863,1715,242,3790,2636,6998,3088,1671,2239,957,5411,4595,6282,2881,9974,2401,875,7574,2987,4587,3147,6766,9885,2965 +3287,3016,3619,6818,9073,6120,5423,557,2900,2015,8111,3873,1314,4189,1846,4399,7041,7583,2427,2864,3525,5002,2069,748,1948,6015,2684,438,770,8367,1663,7887,7759,1885,157,7770,4520,4878,3857,1137,3525,3050,6276,5569,7649,904,4533,7843,2199,5648,7628,9075,9441,3600,7231,2388,5640,9096,958,3058,584,5899,8150,1181,9616,1098,8162,6819,8171,1519,1140,7665,8801,2632,1299,9192,707,9955,2710,7314 +1772,2963,7578,3541,3095,1488,7026,2634,6015,4633,4370,2762,1650,2174,909,8158,2922,8467,4198,4280,9092,8856,8835,5457,2790,8574,9742,5054,9547,4156,7940,8126,9824,7340,8840,6574,3547,1477,3014,6798,7134,435,9484,9859,3031,4,1502,4133,1738,1807,4825,463,6343,9701,8506,9822,9555,8688,8168,3467,3234,6318,1787,5591,419,6593,7974,8486,9861,6381,6758,194,3061,4315,2863,4665,3789,2201,1492,4416 +126,8927,6608,5682,8986,6867,1715,6076,3159,788,3140,4744,830,9253,5812,5021,7616,8534,1546,9590,1101,9012,9821,8132,7857,4086,1069,7491,2988,1579,2442,4321,2149,7642,6108,250,6086,3167,24,9528,7663,2685,1220,9196,1397,5776,1577,1730,5481,977,6115,199,6326,2183,3767,5928,5586,7561,663,8649,9688,949,5913,9160,1870,5764,9887,4477,6703,1413,4995,5494,7131,2192,8969,7138,3997,8697,646,1028 +8074,1731,8245,624,4601,8706,155,8891,309,2552,8208,8452,2954,3124,3469,4246,3352,1105,4509,8677,9901,4416,8191,9283,5625,7120,2952,8881,7693,830,4580,8228,9459,8611,4499,1179,4988,1394,550,2336,6089,6872,269,7213,1848,917,6672,4890,656,1478,6536,3165,4743,4990,1176,6211,7207,5284,9730,4738,1549,4986,4942,8645,3698,9429,1439,2175,6549,3058,6513,1574,6988,8333,3406,5245,5431,7140,7085,6407 +7845,4694,2530,8249,290,5948,5509,1588,5940,4495,5866,5021,4626,3979,3296,7589,4854,1998,5627,3926,8346,6512,9608,1918,7070,4747,4182,2858,2766,4606,6269,4107,8982,8568,9053,4244,5604,102,2756,727,5887,2566,7922,44,5986,621,1202,374,6988,4130,3627,6744,9443,4568,1398,8679,397,3928,9159,367,2917,6127,5788,3304,8129,911,2669,1463,9749,264,4478,8940,1109,7309,2462,117,4692,7724,225,2312 +4164,3637,2000,941,8903,39,3443,7172,1031,3687,4901,8082,4945,4515,7204,9310,9349,9535,9940,218,1788,9245,2237,1541,5670,6538,6047,5553,9807,8101,1925,8714,445,8332,7309,6830,5786,5736,7306,2710,3034,1838,7969,6318,7912,2584,2080,7437,6705,2254,7428,820,782,9861,7596,3842,3631,8063,5240,6666,394,4565,7865,4895,9890,6028,6117,4724,9156,4473,4552,602,470,6191,4927,5387,884,3146,1978,3000 +4258,6880,1696,3582,5793,4923,2119,1155,9056,9698,6603,3768,5514,9927,9609,6166,6566,4536,4985,4934,8076,9062,6741,6163,7399,4562,2337,5600,2919,9012,8459,1308,6072,1225,9306,8818,5886,7243,7365,8792,6007,9256,6699,7171,4230,7002,8720,7839,4533,1671,478,7774,1607,2317,5437,4705,7886,4760,6760,7271,3081,2997,3088,7675,6208,3101,6821,6840,122,9633,4900,2067,8546,4549,2091,7188,5605,8599,6758,5229 +7854,5243,9155,3556,8812,7047,2202,1541,5993,4600,4760,713,434,7911,7426,7414,8729,322,803,7960,7563,4908,6285,6291,736,3389,9339,4132,8701,7534,5287,3646,592,3065,7582,2592,8755,6068,8597,1982,5782,1894,2900,6236,4039,6569,3037,5837,7698,700,7815,2491,7272,5878,3083,6778,6639,3589,5010,8313,2581,6617,5869,8402,6808,2951,2321,5195,497,2190,6187,1342,1316,4453,7740,4154,2959,1781,1482,8256 +7178,2046,4419,744,8312,5356,6855,8839,319,2962,5662,47,6307,8662,68,4813,567,2712,9931,1678,3101,8227,6533,4933,6656,92,5846,4780,6256,6361,4323,9985,1231,2175,7178,3034,9744,6155,9165,7787,5836,9318,7860,9644,8941,6480,9443,8188,5928,161,6979,2352,5628,6991,1198,8067,5867,6620,3778,8426,2994,3122,3124,6335,3918,8897,2655,9670,634,1088,1576,8935,7255,474,8166,7417,9547,2886,5560,3842 +6957,3111,26,7530,7143,1295,1744,6057,3009,1854,8098,5405,2234,4874,9447,2620,9303,27,7410,969,40,2966,5648,7596,8637,4238,3143,3679,7187,690,9980,7085,7714,9373,5632,7526,6707,3951,9734,4216,2146,3602,5371,6029,3039,4433,4855,4151,1449,3376,8009,7240,7027,4602,2947,9081,4045,8424,9352,8742,923,2705,4266,3232,2264,6761,363,2651,3383,7770,6730,7856,7340,9679,2158,610,4471,4608,910,6241 +4417,6756,1013,8797,658,8809,5032,8703,7541,846,3357,2920,9817,1745,9980,7593,4667,3087,779,3218,6233,5568,4296,2289,2654,7898,5021,9461,5593,8214,9173,4203,2271,7980,2983,5952,9992,8399,3468,1776,3188,9314,1720,6523,2933,621,8685,5483,8986,6163,3444,9539,4320,155,3992,2828,2150,6071,524,2895,5468,8063,1210,3348,9071,4862,483,9017,4097,6186,9815,3610,5048,1644,1003,9865,9332,2145,1944,2213 +9284,3803,4920,1927,6706,4344,7383,4786,9890,2010,5228,1224,3158,6967,8580,8990,8883,5213,76,8306,2031,4980,5639,9519,7184,5645,7769,3259,8077,9130,1317,3096,9624,3818,1770,695,2454,947,6029,3474,9938,3527,5696,4760,7724,7738,2848,6442,5767,6845,8323,4131,2859,7595,2500,4815,3660,9130,8580,7016,8231,4391,8369,3444,4069,4021,556,6154,627,2778,1496,4206,6356,8434,8491,3816,8231,3190,5575,1015 +3787,7572,1788,6803,5641,6844,1961,4811,8535,9914,9999,1450,8857,738,4662,8569,6679,2225,7839,8618,286,2648,5342,2294,3205,4546,176,8705,3741,6134,8324,8021,7004,5205,7032,6637,9442,5539,5584,4819,5874,5807,8589,6871,9016,983,1758,3786,1519,6241,185,8398,495,3370,9133,3051,4549,9674,7311,9738,3316,9383,2658,2776,9481,7558,619,3943,3324,6491,4933,153,9738,4623,912,3595,7771,7939,1219,4405 +2650,3883,4154,5809,315,7756,4430,1788,4451,1631,6461,7230,6017,5751,138,588,5282,2442,9110,9035,6349,2515,1570,6122,4192,4174,3530,1933,4186,4420,4609,5739,4135,2963,6308,1161,8809,8619,2796,3819,6971,8228,4188,1492,909,8048,2328,6772,8467,7671,9068,2226,7579,6422,7056,8042,3296,2272,3006,2196,7320,3238,3490,3102,37,1293,3212,4767,5041,8773,5794,4456,6174,7279,7054,2835,7053,9088,790,6640 +3101,1057,7057,3826,6077,1025,2955,1224,1114,6729,5902,4698,6239,7203,9423,1804,4417,6686,1426,6941,8071,1029,4985,9010,6122,6597,1622,1574,3513,1684,7086,5505,3244,411,9638,4150,907,9135,829,981,1707,5359,8781,9751,5,9131,3973,7159,1340,6955,7514,7993,6964,8198,1933,2797,877,3993,4453,8020,9349,8646,2779,8679,2961,3547,3374,3510,1129,3568,2241,2625,9138,5974,8206,7669,7678,1833,8700,4480 +4865,9912,8038,8238,782,3095,8199,1127,4501,7280,2112,2487,3626,2790,9432,1475,6312,8277,4827,2218,5806,7132,8752,1468,7471,6386,739,8762,8323,8120,5169,9078,9058,3370,9560,7987,8585,8531,5347,9312,1058,4271,1159,5286,5404,6925,8606,9204,7361,2415,560,586,4002,2644,1927,2824,768,4409,2942,3345,1002,808,4941,6267,7979,5140,8643,7553,9438,7320,4938,2666,4609,2778,8158,6730,3748,3867,1866,7181 +171,3771,7134,8927,4778,2913,3326,2004,3089,7853,1378,1729,4777,2706,9578,1360,5693,3036,1851,7248,2403,2273,8536,6501,9216,613,9671,7131,7719,6425,773,717,8803,160,1114,7554,7197,753,4513,4322,8499,4533,2609,4226,8710,6627,644,9666,6260,4870,5744,7385,6542,6203,7703,6130,8944,5589,2262,6803,6381,7414,6888,5123,7320,9392,9061,6780,322,8975,7050,5089,1061,2260,3199,1150,1865,5386,9699,6501 +3744,8454,6885,8277,919,1923,4001,6864,7854,5519,2491,6057,8794,9645,1776,5714,9786,9281,7538,6916,3215,395,2501,9618,4835,8846,9708,2813,3303,1794,8309,7176,2206,1602,1838,236,4593,2245,8993,4017,10,8215,6921,5206,4023,5932,6997,7801,262,7640,3107,8275,4938,7822,2425,3223,3886,2105,8700,9526,2088,8662,8034,7004,5710,2124,7164,3574,6630,9980,4242,2901,9471,1491,2117,4562,1130,9086,4117,6698 +2810,2280,2331,1170,4554,4071,8387,1215,2274,9848,6738,1604,7281,8805,439,1298,8318,7834,9426,8603,6092,7944,1309,8828,303,3157,4638,4439,9175,1921,4695,7716,1494,1015,1772,5913,1127,1952,1950,8905,4064,9890,385,9357,7945,5035,7082,5369,4093,6546,5187,5637,2041,8946,1758,7111,6566,1027,1049,5148,7224,7248,296,6169,375,1656,7993,2816,3717,4279,4675,1609,3317,42,6201,3100,3144,163,9530,4531 +7096,6070,1009,4988,3538,5801,7149,3063,2324,2912,7911,7002,4338,7880,2481,7368,3516,2016,7556,2193,1388,3865,8125,4637,4096,8114,750,3144,1938,7002,9343,4095,1392,4220,3455,6969,9647,1321,9048,1996,1640,6626,1788,314,9578,6630,2813,6626,4981,9908,7024,4355,3201,3521,3864,3303,464,1923,595,9801,3391,8366,8084,9374,1041,8807,9085,1892,9431,8317,9016,9221,8574,9981,9240,5395,2009,6310,2854,9255 +8830,3145,2960,9615,8220,6061,3452,2918,6481,9278,2297,3385,6565,7066,7316,5682,107,7646,4466,68,1952,9603,8615,54,7191,791,6833,2560,693,9733,4168,570,9127,9537,1925,8287,5508,4297,8452,8795,6213,7994,2420,4208,524,5915,8602,8330,2651,8547,6156,1812,6271,7991,9407,9804,1553,6866,1128,2119,4691,9711,8315,5879,9935,6900,482,682,4126,1041,428,6247,3720,5882,7526,2582,4327,7725,3503,2631 +2738,9323,721,7434,1453,6294,2957,3786,5722,6019,8685,4386,3066,9057,6860,499,5315,3045,5194,7111,3137,9104,941,586,3066,755,4177,8819,7040,5309,3583,3897,4428,7788,4721,7249,6559,7324,825,7311,3760,6064,6070,9672,4882,584,1365,9739,9331,5783,2624,7889,1604,1303,1555,7125,8312,425,8936,3233,7724,1480,403,7440,1784,1754,4721,1569,652,3893,4574,5692,9730,4813,9844,8291,9199,7101,3391,8914 +6044,2928,9332,3328,8588,447,3830,1176,3523,2705,8365,6136,5442,9049,5526,8575,8869,9031,7280,706,2794,8814,5767,4241,7696,78,6570,556,5083,1426,4502,3336,9518,2292,1885,3740,3153,9348,9331,8051,2759,5407,9028,7840,9255,831,515,2612,9747,7435,8964,4971,2048,4900,5967,8271,1719,9670,2810,6777,1594,6367,6259,8316,3815,1689,6840,9437,4361,822,9619,3065,83,6344,7486,8657,8228,9635,6932,4864 +8478,4777,6334,4678,7476,4963,6735,3096,5860,1405,5127,7269,7793,4738,227,9168,2996,8928,765,733,1276,7677,6258,1528,9558,3329,302,8901,1422,8277,6340,645,9125,8869,5952,141,8141,1816,9635,4025,4184,3093,83,2344,2747,9352,7966,1206,1126,1826,218,7939,2957,2729,810,8752,5247,4174,4038,8884,7899,9567,301,5265,5752,7524,4381,1669,3106,8270,6228,6373,754,2547,4240,2313,5514,3022,1040,9738 +2265,8192,1763,1369,8469,8789,4836,52,1212,6690,5257,8918,6723,6319,378,4039,2421,8555,8184,9577,1432,7139,8078,5452,9628,7579,4161,7490,5159,8559,1011,81,478,5840,1964,1334,6875,8670,9900,739,1514,8692,522,9316,6955,1345,8132,2277,3193,9773,3923,4177,2183,1236,6747,6575,4874,6003,6409,8187,745,8776,9440,7543,9825,2582,7381,8147,7236,5185,7564,6125,218,7991,6394,391,7659,7456,5128,5294 +2132,8992,8160,5782,4420,3371,3798,5054,552,5631,7546,4716,1332,6486,7892,7441,4370,6231,4579,2121,8615,1145,9391,1524,1385,2400,9437,2454,7896,7467,2928,8400,3299,4025,7458,4703,7206,6358,792,6200,725,4275,4136,7390,5984,4502,7929,5085,8176,4600,119,3568,76,9363,6943,2248,9077,9731,6213,5817,6729,4190,3092,6910,759,2682,8380,1254,9604,3011,9291,5329,9453,9746,2739,6522,3765,5634,1113,5789 +5304,5499,564,2801,679,2653,1783,3608,7359,7797,3284,796,3222,437,7185,6135,8571,2778,7488,5746,678,6140,861,7750,803,9859,9918,2425,3734,2698,9005,4864,9818,6743,2475,132,9486,3825,5472,919,292,4411,7213,7699,6435,9019,6769,1388,802,2124,1345,8493,9487,8558,7061,8777,8833,2427,2238,5409,4957,8503,3171,7622,5779,6145,2417,5873,5563,5693,9574,9491,1937,7384,4563,6842,5432,2751,3406,7981 diff --git a/problem_data/no096.txt b/problem_data/no096.txt new file mode 100644 index 0000000..6b146f9 --- /dev/null +++ b/problem_data/no096.txt @@ -0,0 +1,500 @@ +Grid 01 +003020600 +900305001 +001806400 +008102900 +700000008 +006708200 +002609500 +800203009 +005010300 +Grid 02 +200080300 +060070084 +030500209 +000105408 +000000000 +402706000 +301007040 +720040060 +004010003 +Grid 03 +000000907 +000420180 +000705026 +100904000 +050000040 +000507009 +920108000 +034059000 +507000000 +Grid 04 +030050040 +008010500 +460000012 +070502080 +000603000 +040109030 +250000098 +001020600 +080060020 +Grid 05 +020810740 +700003100 +090002805 +009040087 +400208003 +160030200 +302700060 +005600008 +076051090 +Grid 06 +100920000 +524010000 +000000070 +050008102 +000000000 +402700090 +060000000 +000030945 +000071006 +Grid 07 +043080250 +600000000 +000001094 +900004070 +000608000 +010200003 +820500000 +000000005 +034090710 +Grid 08 +480006902 +002008001 +900370060 +840010200 +003704100 +001060049 +020085007 +700900600 +609200018 +Grid 09 +000900002 +050123400 +030000160 +908000000 +070000090 +000000205 +091000050 +007439020 +400007000 +Grid 10 +001900003 +900700160 +030005007 +050000009 +004302600 +200000070 +600100030 +042007006 +500006800 +Grid 11 +000125400 +008400000 +420800000 +030000095 +060902010 +510000060 +000003049 +000007200 +001298000 +Grid 12 +062340750 +100005600 +570000040 +000094800 +400000006 +005830000 +030000091 +006400007 +059083260 +Grid 13 +300000000 +005009000 +200504000 +020000700 +160000058 +704310600 +000890100 +000067080 +000005437 +Grid 14 +630000000 +000500008 +005674000 +000020000 +003401020 +000000345 +000007004 +080300902 +947100080 +Grid 15 +000020040 +008035000 +000070602 +031046970 +200000000 +000501203 +049000730 +000000010 +800004000 +Grid 16 +361025900 +080960010 +400000057 +008000471 +000603000 +259000800 +740000005 +020018060 +005470329 +Grid 17 +050807020 +600010090 +702540006 +070020301 +504000908 +103080070 +900076205 +060090003 +080103040 +Grid 18 +080005000 +000003457 +000070809 +060400903 +007010500 +408007020 +901020000 +842300000 +000100080 +Grid 19 +003502900 +000040000 +106000305 +900251008 +070408030 +800763001 +308000104 +000020000 +005104800 +Grid 20 +000000000 +009805100 +051907420 +290401065 +000000000 +140508093 +026709580 +005103600 +000000000 +Grid 21 +020030090 +000907000 +900208005 +004806500 +607000208 +003102900 +800605007 +000309000 +030020050 +Grid 22 +005000006 +070009020 +000500107 +804150000 +000803000 +000092805 +907006000 +030400010 +200000600 +Grid 23 +040000050 +001943600 +009000300 +600050002 +103000506 +800020007 +005000200 +002436700 +030000040 +Grid 24 +004000000 +000030002 +390700080 +400009001 +209801307 +600200008 +010008053 +900040000 +000000800 +Grid 25 +360020089 +000361000 +000000000 +803000602 +400603007 +607000108 +000000000 +000418000 +970030014 +Grid 26 +500400060 +009000800 +640020000 +000001008 +208000501 +700500000 +000090084 +003000600 +060003002 +Grid 27 +007256400 +400000005 +010030060 +000508000 +008060200 +000107000 +030070090 +200000004 +006312700 +Grid 28 +000000000 +079050180 +800000007 +007306800 +450708096 +003502700 +700000005 +016030420 +000000000 +Grid 29 +030000080 +009000500 +007509200 +700105008 +020090030 +900402001 +004207100 +002000800 +070000090 +Grid 30 +200170603 +050000100 +000006079 +000040700 +000801000 +009050000 +310400000 +005000060 +906037002 +Grid 31 +000000080 +800701040 +040020030 +374000900 +000030000 +005000321 +010060050 +050802006 +080000000 +Grid 32 +000000085 +000210009 +960080100 +500800016 +000000000 +890006007 +009070052 +300054000 +480000000 +Grid 33 +608070502 +050608070 +002000300 +500090006 +040302050 +800050003 +005000200 +010704090 +409060701 +Grid 34 +050010040 +107000602 +000905000 +208030501 +040070020 +901080406 +000401000 +304000709 +020060010 +Grid 35 +053000790 +009753400 +100000002 +090080010 +000907000 +080030070 +500000003 +007641200 +061000940 +Grid 36 +006080300 +049070250 +000405000 +600317004 +007000800 +100826009 +000702000 +075040190 +003090600 +Grid 37 +005080700 +700204005 +320000084 +060105040 +008000500 +070803010 +450000091 +600508007 +003010600 +Grid 38 +000900800 +128006400 +070800060 +800430007 +500000009 +600079008 +090004010 +003600284 +001007000 +Grid 39 +000080000 +270000054 +095000810 +009806400 +020403060 +006905100 +017000620 +460000038 +000090000 +Grid 40 +000602000 +400050001 +085010620 +038206710 +000000000 +019407350 +026040530 +900020007 +000809000 +Grid 41 +000900002 +050123400 +030000160 +908000000 +070000090 +000000205 +091000050 +007439020 +400007000 +Grid 42 +380000000 +000400785 +009020300 +060090000 +800302009 +000040070 +001070500 +495006000 +000000092 +Grid 43 +000158000 +002060800 +030000040 +027030510 +000000000 +046080790 +050000080 +004070100 +000325000 +Grid 44 +010500200 +900001000 +002008030 +500030007 +008000500 +600080004 +040100700 +000700006 +003004050 +Grid 45 +080000040 +000469000 +400000007 +005904600 +070608030 +008502100 +900000005 +000781000 +060000010 +Grid 46 +904200007 +010000000 +000706500 +000800090 +020904060 +040002000 +001607000 +000000030 +300005702 +Grid 47 +000700800 +006000031 +040002000 +024070000 +010030080 +000060290 +000800070 +860000500 +002006000 +Grid 48 +001007090 +590080001 +030000080 +000005800 +050060020 +004100000 +080000030 +100020079 +020700400 +Grid 49 +000003017 +015009008 +060000000 +100007000 +009000200 +000500004 +000000020 +500600340 +340200000 +Grid 50 +300200000 +000107000 +706030500 +070009080 +900020004 +010800050 +009040301 +000702000 +000008006 \ No newline at end of file diff --git a/problem_data/no098.txt b/problem_data/no098.txt new file mode 100644 index 0000000..7177624 --- /dev/null +++ b/problem_data/no098.txt @@ -0,0 +1 @@ +"A","ABILITY","ABLE","ABOUT","ABOVE","ABSENCE","ABSOLUTELY","ACADEMIC","ACCEPT","ACCESS","ACCIDENT","ACCOMPANY","ACCORDING","ACCOUNT","ACHIEVE","ACHIEVEMENT","ACID","ACQUIRE","ACROSS","ACT","ACTION","ACTIVE","ACTIVITY","ACTUAL","ACTUALLY","ADD","ADDITION","ADDITIONAL","ADDRESS","ADMINISTRATION","ADMIT","ADOPT","ADULT","ADVANCE","ADVANTAGE","ADVICE","ADVISE","AFFAIR","AFFECT","AFFORD","AFRAID","AFTER","AFTERNOON","AFTERWARDS","AGAIN","AGAINST","AGE","AGENCY","AGENT","AGO","AGREE","AGREEMENT","AHEAD","AID","AIM","AIR","AIRCRAFT","ALL","ALLOW","ALMOST","ALONE","ALONG","ALREADY","ALRIGHT","ALSO","ALTERNATIVE","ALTHOUGH","ALWAYS","AMONG","AMONGST","AMOUNT","AN","ANALYSIS","ANCIENT","AND","ANIMAL","ANNOUNCE","ANNUAL","ANOTHER","ANSWER","ANY","ANYBODY","ANYONE","ANYTHING","ANYWAY","APART","APPARENT","APPARENTLY","APPEAL","APPEAR","APPEARANCE","APPLICATION","APPLY","APPOINT","APPOINTMENT","APPROACH","APPROPRIATE","APPROVE","AREA","ARGUE","ARGUMENT","ARISE","ARM","ARMY","AROUND","ARRANGE","ARRANGEMENT","ARRIVE","ART","ARTICLE","ARTIST","AS","ASK","ASPECT","ASSEMBLY","ASSESS","ASSESSMENT","ASSET","ASSOCIATE","ASSOCIATION","ASSUME","ASSUMPTION","AT","ATMOSPHERE","ATTACH","ATTACK","ATTEMPT","ATTEND","ATTENTION","ATTITUDE","ATTRACT","ATTRACTIVE","AUDIENCE","AUTHOR","AUTHORITY","AVAILABLE","AVERAGE","AVOID","AWARD","AWARE","AWAY","AYE","BABY","BACK","BACKGROUND","BAD","BAG","BALANCE","BALL","BAND","BANK","BAR","BASE","BASIC","BASIS","BATTLE","BE","BEAR","BEAT","BEAUTIFUL","BECAUSE","BECOME","BED","BEDROOM","BEFORE","BEGIN","BEGINNING","BEHAVIOUR","BEHIND","BELIEF","BELIEVE","BELONG","BELOW","BENEATH","BENEFIT","BESIDE","BEST","BETTER","BETWEEN","BEYOND","BIG","BILL","BIND","BIRD","BIRTH","BIT","BLACK","BLOCK","BLOOD","BLOODY","BLOW","BLUE","BOARD","BOAT","BODY","BONE","BOOK","BORDER","BOTH","BOTTLE","BOTTOM","BOX","BOY","BRAIN","BRANCH","BREAK","BREATH","BRIDGE","BRIEF","BRIGHT","BRING","BROAD","BROTHER","BUDGET","BUILD","BUILDING","BURN","BUS","BUSINESS","BUSY","BUT","BUY","BY","CABINET","CALL","CAMPAIGN","CAN","CANDIDATE","CAPABLE","CAPACITY","CAPITAL","CAR","CARD","CARE","CAREER","CAREFUL","CAREFULLY","CARRY","CASE","CASH","CAT","CATCH","CATEGORY","CAUSE","CELL","CENTRAL","CENTRE","CENTURY","CERTAIN","CERTAINLY","CHAIN","CHAIR","CHAIRMAN","CHALLENGE","CHANCE","CHANGE","CHANNEL","CHAPTER","CHARACTER","CHARACTERISTIC","CHARGE","CHEAP","CHECK","CHEMICAL","CHIEF","CHILD","CHOICE","CHOOSE","CHURCH","CIRCLE","CIRCUMSTANCE","CITIZEN","CITY","CIVIL","CLAIM","CLASS","CLEAN","CLEAR","CLEARLY","CLIENT","CLIMB","CLOSE","CLOSELY","CLOTHES","CLUB","COAL","CODE","COFFEE","COLD","COLLEAGUE","COLLECT","COLLECTION","COLLEGE","COLOUR","COMBINATION","COMBINE","COME","COMMENT","COMMERCIAL","COMMISSION","COMMIT","COMMITMENT","COMMITTEE","COMMON","COMMUNICATION","COMMUNITY","COMPANY","COMPARE","COMPARISON","COMPETITION","COMPLETE","COMPLETELY","COMPLEX","COMPONENT","COMPUTER","CONCENTRATE","CONCENTRATION","CONCEPT","CONCERN","CONCERNED","CONCLUDE","CONCLUSION","CONDITION","CONDUCT","CONFERENCE","CONFIDENCE","CONFIRM","CONFLICT","CONGRESS","CONNECT","CONNECTION","CONSEQUENCE","CONSERVATIVE","CONSIDER","CONSIDERABLE","CONSIDERATION","CONSIST","CONSTANT","CONSTRUCTION","CONSUMER","CONTACT","CONTAIN","CONTENT","CONTEXT","CONTINUE","CONTRACT","CONTRAST","CONTRIBUTE","CONTRIBUTION","CONTROL","CONVENTION","CONVERSATION","COPY","CORNER","CORPORATE","CORRECT","COS","COST","COULD","COUNCIL","COUNT","COUNTRY","COUNTY","COUPLE","COURSE","COURT","COVER","CREATE","CREATION","CREDIT","CRIME","CRIMINAL","CRISIS","CRITERION","CRITICAL","CRITICISM","CROSS","CROWD","CRY","CULTURAL","CULTURE","CUP","CURRENT","CURRENTLY","CURRICULUM","CUSTOMER","CUT","DAMAGE","DANGER","DANGEROUS","DARK","DATA","DATE","DAUGHTER","DAY","DEAD","DEAL","DEATH","DEBATE","DEBT","DECADE","DECIDE","DECISION","DECLARE","DEEP","DEFENCE","DEFENDANT","DEFINE","DEFINITION","DEGREE","DELIVER","DEMAND","DEMOCRATIC","DEMONSTRATE","DENY","DEPARTMENT","DEPEND","DEPUTY","DERIVE","DESCRIBE","DESCRIPTION","DESIGN","DESIRE","DESK","DESPITE","DESTROY","DETAIL","DETAILED","DETERMINE","DEVELOP","DEVELOPMENT","DEVICE","DIE","DIFFERENCE","DIFFERENT","DIFFICULT","DIFFICULTY","DINNER","DIRECT","DIRECTION","DIRECTLY","DIRECTOR","DISAPPEAR","DISCIPLINE","DISCOVER","DISCUSS","DISCUSSION","DISEASE","DISPLAY","DISTANCE","DISTINCTION","DISTRIBUTION","DISTRICT","DIVIDE","DIVISION","DO","DOCTOR","DOCUMENT","DOG","DOMESTIC","DOOR","DOUBLE","DOUBT","DOWN","DRAW","DRAWING","DREAM","DRESS","DRINK","DRIVE","DRIVER","DROP","DRUG","DRY","DUE","DURING","DUTY","EACH","EAR","EARLY","EARN","EARTH","EASILY","EAST","EASY","EAT","ECONOMIC","ECONOMY","EDGE","EDITOR","EDUCATION","EDUCATIONAL","EFFECT","EFFECTIVE","EFFECTIVELY","EFFORT","EGG","EITHER","ELDERLY","ELECTION","ELEMENT","ELSE","ELSEWHERE","EMERGE","EMPHASIS","EMPLOY","EMPLOYEE","EMPLOYER","EMPLOYMENT","EMPTY","ENABLE","ENCOURAGE","END","ENEMY","ENERGY","ENGINE","ENGINEERING","ENJOY","ENOUGH","ENSURE","ENTER","ENTERPRISE","ENTIRE","ENTIRELY","ENTITLE","ENTRY","ENVIRONMENT","ENVIRONMENTAL","EQUAL","EQUALLY","EQUIPMENT","ERROR","ESCAPE","ESPECIALLY","ESSENTIAL","ESTABLISH","ESTABLISHMENT","ESTATE","ESTIMATE","EVEN","EVENING","EVENT","EVENTUALLY","EVER","EVERY","EVERYBODY","EVERYONE","EVERYTHING","EVIDENCE","EXACTLY","EXAMINATION","EXAMINE","EXAMPLE","EXCELLENT","EXCEPT","EXCHANGE","EXECUTIVE","EXERCISE","EXHIBITION","EXIST","EXISTENCE","EXISTING","EXPECT","EXPECTATION","EXPENDITURE","EXPENSE","EXPENSIVE","EXPERIENCE","EXPERIMENT","EXPERT","EXPLAIN","EXPLANATION","EXPLORE","EXPRESS","EXPRESSION","EXTEND","EXTENT","EXTERNAL","EXTRA","EXTREMELY","EYE","FACE","FACILITY","FACT","FACTOR","FACTORY","FAIL","FAILURE","FAIR","FAIRLY","FAITH","FALL","FAMILIAR","FAMILY","FAMOUS","FAR","FARM","FARMER","FASHION","FAST","FATHER","FAVOUR","FEAR","FEATURE","FEE","FEEL","FEELING","FEMALE","FEW","FIELD","FIGHT","FIGURE","FILE","FILL","FILM","FINAL","FINALLY","FINANCE","FINANCIAL","FIND","FINDING","FINE","FINGER","FINISH","FIRE","FIRM","FIRST","FISH","FIT","FIX","FLAT","FLIGHT","FLOOR","FLOW","FLOWER","FLY","FOCUS","FOLLOW","FOLLOWING","FOOD","FOOT","FOOTBALL","FOR","FORCE","FOREIGN","FOREST","FORGET","FORM","FORMAL","FORMER","FORWARD","FOUNDATION","FREE","FREEDOM","FREQUENTLY","FRESH","FRIEND","FROM","FRONT","FRUIT","FUEL","FULL","FULLY","FUNCTION","FUND","FUNNY","FURTHER","FUTURE","GAIN","GAME","GARDEN","GAS","GATE","GATHER","GENERAL","GENERALLY","GENERATE","GENERATION","GENTLEMAN","GET","GIRL","GIVE","GLASS","GO","GOAL","GOD","GOLD","GOOD","GOVERNMENT","GRANT","GREAT","GREEN","GREY","GROUND","GROUP","GROW","GROWING","GROWTH","GUEST","GUIDE","GUN","HAIR","HALF","HALL","HAND","HANDLE","HANG","HAPPEN","HAPPY","HARD","HARDLY","HATE","HAVE","HE","HEAD","HEALTH","HEAR","HEART","HEAT","HEAVY","HELL","HELP","HENCE","HER","HERE","HERSELF","HIDE","HIGH","HIGHLY","HILL","HIM","HIMSELF","HIS","HISTORICAL","HISTORY","HIT","HOLD","HOLE","HOLIDAY","HOME","HOPE","HORSE","HOSPITAL","HOT","HOTEL","HOUR","HOUSE","HOUSEHOLD","HOUSING","HOW","HOWEVER","HUGE","HUMAN","HURT","HUSBAND","I","IDEA","IDENTIFY","IF","IGNORE","ILLUSTRATE","IMAGE","IMAGINE","IMMEDIATE","IMMEDIATELY","IMPACT","IMPLICATION","IMPLY","IMPORTANCE","IMPORTANT","IMPOSE","IMPOSSIBLE","IMPRESSION","IMPROVE","IMPROVEMENT","IN","INCIDENT","INCLUDE","INCLUDING","INCOME","INCREASE","INCREASED","INCREASINGLY","INDEED","INDEPENDENT","INDEX","INDICATE","INDIVIDUAL","INDUSTRIAL","INDUSTRY","INFLUENCE","INFORM","INFORMATION","INITIAL","INITIATIVE","INJURY","INSIDE","INSIST","INSTANCE","INSTEAD","INSTITUTE","INSTITUTION","INSTRUCTION","INSTRUMENT","INSURANCE","INTEND","INTENTION","INTEREST","INTERESTED","INTERESTING","INTERNAL","INTERNATIONAL","INTERPRETATION","INTERVIEW","INTO","INTRODUCE","INTRODUCTION","INVESTIGATE","INVESTIGATION","INVESTMENT","INVITE","INVOLVE","IRON","IS","ISLAND","ISSUE","IT","ITEM","ITS","ITSELF","JOB","JOIN","JOINT","JOURNEY","JUDGE","JUMP","JUST","JUSTICE","KEEP","KEY","KID","KILL","KIND","KING","KITCHEN","KNEE","KNOW","KNOWLEDGE","LABOUR","LACK","LADY","LAND","LANGUAGE","LARGE","LARGELY","LAST","LATE","LATER","LATTER","LAUGH","LAUNCH","LAW","LAWYER","LAY","LEAD","LEADER","LEADERSHIP","LEADING","LEAF","LEAGUE","LEAN","LEARN","LEAST","LEAVE","LEFT","LEG","LEGAL","LEGISLATION","LENGTH","LESS","LET","LETTER","LEVEL","LIABILITY","LIBERAL","LIBRARY","LIE","LIFE","LIFT","LIGHT","LIKE","LIKELY","LIMIT","LIMITED","LINE","LINK","LIP","LIST","LISTEN","LITERATURE","LITTLE","LIVE","LIVING","LOAN","LOCAL","LOCATION","LONG","LOOK","LORD","LOSE","LOSS","LOT","LOVE","LOVELY","LOW","LUNCH","MACHINE","MAGAZINE","MAIN","MAINLY","MAINTAIN","MAJOR","MAJORITY","MAKE","MALE","MAN","MANAGE","MANAGEMENT","MANAGER","MANNER","MANY","MAP","MARK","MARKET","MARRIAGE","MARRIED","MARRY","MASS","MASTER","MATCH","MATERIAL","MATTER","MAY","MAYBE","ME","MEAL","MEAN","MEANING","MEANS","MEANWHILE","MEASURE","MECHANISM","MEDIA","MEDICAL","MEET","MEETING","MEMBER","MEMBERSHIP","MEMORY","MENTAL","MENTION","MERELY","MESSAGE","METAL","METHOD","MIDDLE","MIGHT","MILE","MILITARY","MILK","MIND","MINE","MINISTER","MINISTRY","MINUTE","MISS","MISTAKE","MODEL","MODERN","MODULE","MOMENT","MONEY","MONTH","MORE","MORNING","MOST","MOTHER","MOTION","MOTOR","MOUNTAIN","MOUTH","MOVE","MOVEMENT","MUCH","MURDER","MUSEUM","MUSIC","MUST","MY","MYSELF","NAME","NARROW","NATION","NATIONAL","NATURAL","NATURE","NEAR","NEARLY","NECESSARILY","NECESSARY","NECK","NEED","NEGOTIATION","NEIGHBOUR","NEITHER","NETWORK","NEVER","NEVERTHELESS","NEW","NEWS","NEWSPAPER","NEXT","NICE","NIGHT","NO","NOBODY","NOD","NOISE","NONE","NOR","NORMAL","NORMALLY","NORTH","NORTHERN","NOSE","NOT","NOTE","NOTHING","NOTICE","NOTION","NOW","NUCLEAR","NUMBER","NURSE","OBJECT","OBJECTIVE","OBSERVATION","OBSERVE","OBTAIN","OBVIOUS","OBVIOUSLY","OCCASION","OCCUR","ODD","OF","OFF","OFFENCE","OFFER","OFFICE","OFFICER","OFFICIAL","OFTEN","OIL","OKAY","OLD","ON","ONCE","ONE","ONLY","ONTO","OPEN","OPERATE","OPERATION","OPINION","OPPORTUNITY","OPPOSITION","OPTION","OR","ORDER","ORDINARY","ORGANISATION","ORGANISE","ORGANIZATION","ORIGIN","ORIGINAL","OTHER","OTHERWISE","OUGHT","OUR","OURSELVES","OUT","OUTCOME","OUTPUT","OUTSIDE","OVER","OVERALL","OWN","OWNER","PACKAGE","PAGE","PAIN","PAINT","PAINTING","PAIR","PANEL","PAPER","PARENT","PARK","PARLIAMENT","PART","PARTICULAR","PARTICULARLY","PARTLY","PARTNER","PARTY","PASS","PASSAGE","PAST","PATH","PATIENT","PATTERN","PAY","PAYMENT","PEACE","PENSION","PEOPLE","PER","PERCENT","PERFECT","PERFORM","PERFORMANCE","PERHAPS","PERIOD","PERMANENT","PERSON","PERSONAL","PERSUADE","PHASE","PHONE","PHOTOGRAPH","PHYSICAL","PICK","PICTURE","PIECE","PLACE","PLAN","PLANNING","PLANT","PLASTIC","PLATE","PLAY","PLAYER","PLEASE","PLEASURE","PLENTY","PLUS","POCKET","POINT","POLICE","POLICY","POLITICAL","POLITICS","POOL","POOR","POPULAR","POPULATION","POSITION","POSITIVE","POSSIBILITY","POSSIBLE","POSSIBLY","POST","POTENTIAL","POUND","POWER","POWERFUL","PRACTICAL","PRACTICE","PREFER","PREPARE","PRESENCE","PRESENT","PRESIDENT","PRESS","PRESSURE","PRETTY","PREVENT","PREVIOUS","PREVIOUSLY","PRICE","PRIMARY","PRIME","PRINCIPLE","PRIORITY","PRISON","PRISONER","PRIVATE","PROBABLY","PROBLEM","PROCEDURE","PROCESS","PRODUCE","PRODUCT","PRODUCTION","PROFESSIONAL","PROFIT","PROGRAM","PROGRAMME","PROGRESS","PROJECT","PROMISE","PROMOTE","PROPER","PROPERLY","PROPERTY","PROPORTION","PROPOSE","PROPOSAL","PROSPECT","PROTECT","PROTECTION","PROVE","PROVIDE","PROVIDED","PROVISION","PUB","PUBLIC","PUBLICATION","PUBLISH","PULL","PUPIL","PURPOSE","PUSH","PUT","QUALITY","QUARTER","QUESTION","QUICK","QUICKLY","QUIET","QUITE","RACE","RADIO","RAILWAY","RAIN","RAISE","RANGE","RAPIDLY","RARE","RATE","RATHER","REACH","REACTION","READ","READER","READING","READY","REAL","REALISE","REALITY","REALIZE","REALLY","REASON","REASONABLE","RECALL","RECEIVE","RECENT","RECENTLY","RECOGNISE","RECOGNITION","RECOGNIZE","RECOMMEND","RECORD","RECOVER","RED","REDUCE","REDUCTION","REFER","REFERENCE","REFLECT","REFORM","REFUSE","REGARD","REGION","REGIONAL","REGULAR","REGULATION","REJECT","RELATE","RELATION","RELATIONSHIP","RELATIVE","RELATIVELY","RELEASE","RELEVANT","RELIEF","RELIGION","RELIGIOUS","RELY","REMAIN","REMEMBER","REMIND","REMOVE","REPEAT","REPLACE","REPLY","REPORT","REPRESENT","REPRESENTATION","REPRESENTATIVE","REQUEST","REQUIRE","REQUIREMENT","RESEARCH","RESOURCE","RESPECT","RESPOND","RESPONSE","RESPONSIBILITY","RESPONSIBLE","REST","RESTAURANT","RESULT","RETAIN","RETURN","REVEAL","REVENUE","REVIEW","REVOLUTION","RICH","RIDE","RIGHT","RING","RISE","RISK","RIVER","ROAD","ROCK","ROLE","ROLL","ROOF","ROOM","ROUND","ROUTE","ROW","ROYAL","RULE","RUN","RURAL","SAFE","SAFETY","SALE","SAME","SAMPLE","SATISFY","SAVE","SAY","SCALE","SCENE","SCHEME","SCHOOL","SCIENCE","SCIENTIFIC","SCIENTIST","SCORE","SCREEN","SEA","SEARCH","SEASON","SEAT","SECOND","SECONDARY","SECRETARY","SECTION","SECTOR","SECURE","SECURITY","SEE","SEEK","SEEM","SELECT","SELECTION","SELL","SEND","SENIOR","SENSE","SENTENCE","SEPARATE","SEQUENCE","SERIES","SERIOUS","SERIOUSLY","SERVANT","SERVE","SERVICE","SESSION","SET","SETTLE","SETTLEMENT","SEVERAL","SEVERE","SEX","SEXUAL","SHAKE","SHALL","SHAPE","SHARE","SHE","SHEET","SHIP","SHOE","SHOOT","SHOP","SHORT","SHOT","SHOULD","SHOULDER","SHOUT","SHOW","SHUT","SIDE","SIGHT","SIGN","SIGNAL","SIGNIFICANCE","SIGNIFICANT","SILENCE","SIMILAR","SIMPLE","SIMPLY","SINCE","SING","SINGLE","SIR","SISTER","SIT","SITE","SITUATION","SIZE","SKILL","SKIN","SKY","SLEEP","SLIGHTLY","SLIP","SLOW","SLOWLY","SMALL","SMILE","SO","SOCIAL","SOCIETY","SOFT","SOFTWARE","SOIL","SOLDIER","SOLICITOR","SOLUTION","SOME","SOMEBODY","SOMEONE","SOMETHING","SOMETIMES","SOMEWHAT","SOMEWHERE","SON","SONG","SOON","SORRY","SORT","SOUND","SOURCE","SOUTH","SOUTHERN","SPACE","SPEAK","SPEAKER","SPECIAL","SPECIES","SPECIFIC","SPEECH","SPEED","SPEND","SPIRIT","SPORT","SPOT","SPREAD","SPRING","STAFF","STAGE","STAND","STANDARD","STAR","START","STATE","STATEMENT","STATION","STATUS","STAY","STEAL","STEP","STICK","STILL","STOCK","STONE","STOP","STORE","STORY","STRAIGHT","STRANGE","STRATEGY","STREET","STRENGTH","STRIKE","STRONG","STRONGLY","STRUCTURE","STUDENT","STUDIO","STUDY","STUFF","STYLE","SUBJECT","SUBSTANTIAL","SUCCEED","SUCCESS","SUCCESSFUL","SUCH","SUDDENLY","SUFFER","SUFFICIENT","SUGGEST","SUGGESTION","SUITABLE","SUM","SUMMER","SUN","SUPPLY","SUPPORT","SUPPOSE","SURE","SURELY","SURFACE","SURPRISE","SURROUND","SURVEY","SURVIVE","SWITCH","SYSTEM","TABLE","TAKE","TALK","TALL","TAPE","TARGET","TASK","TAX","TEA","TEACH","TEACHER","TEACHING","TEAM","TEAR","TECHNICAL","TECHNIQUE","TECHNOLOGY","TELEPHONE","TELEVISION","TELL","TEMPERATURE","TEND","TERM","TERMS","TERRIBLE","TEST","TEXT","THAN","THANK","THANKS","THAT","THE","THEATRE","THEIR","THEM","THEME","THEMSELVES","THEN","THEORY","THERE","THEREFORE","THESE","THEY","THIN","THING","THINK","THIS","THOSE","THOUGH","THOUGHT","THREAT","THREATEN","THROUGH","THROUGHOUT","THROW","THUS","TICKET","TIME","TINY","TITLE","TO","TODAY","TOGETHER","TOMORROW","TONE","TONIGHT","TOO","TOOL","TOOTH","TOP","TOTAL","TOTALLY","TOUCH","TOUR","TOWARDS","TOWN","TRACK","TRADE","TRADITION","TRADITIONAL","TRAFFIC","TRAIN","TRAINING","TRANSFER","TRANSPORT","TRAVEL","TREAT","TREATMENT","TREATY","TREE","TREND","TRIAL","TRIP","TROOP","TROUBLE","TRUE","TRUST","TRUTH","TRY","TURN","TWICE","TYPE","TYPICAL","UNABLE","UNDER","UNDERSTAND","UNDERSTANDING","UNDERTAKE","UNEMPLOYMENT","UNFORTUNATELY","UNION","UNIT","UNITED","UNIVERSITY","UNLESS","UNLIKELY","UNTIL","UP","UPON","UPPER","URBAN","US","USE","USED","USEFUL","USER","USUAL","USUALLY","VALUE","VARIATION","VARIETY","VARIOUS","VARY","VAST","VEHICLE","VERSION","VERY","VIA","VICTIM","VICTORY","VIDEO","VIEW","VILLAGE","VIOLENCE","VISION","VISIT","VISITOR","VITAL","VOICE","VOLUME","VOTE","WAGE","WAIT","WALK","WALL","WANT","WAR","WARM","WARN","WASH","WATCH","WATER","WAVE","WAY","WE","WEAK","WEAPON","WEAR","WEATHER","WEEK","WEEKEND","WEIGHT","WELCOME","WELFARE","WELL","WEST","WESTERN","WHAT","WHATEVER","WHEN","WHERE","WHEREAS","WHETHER","WHICH","WHILE","WHILST","WHITE","WHO","WHOLE","WHOM","WHOSE","WHY","WIDE","WIDELY","WIFE","WILD","WILL","WIN","WIND","WINDOW","WINE","WING","WINNER","WINTER","WISH","WITH","WITHDRAW","WITHIN","WITHOUT","WOMAN","WONDER","WONDERFUL","WOOD","WORD","WORK","WORKER","WORKING","WORKS","WORLD","WORRY","WORTH","WOULD","WRITE","WRITER","WRITING","WRONG","YARD","YEAH","YEAR","YES","YESTERDAY","YET","YOU","YOUNG","YOUR","YOURSELF","YOUTH" \ No newline at end of file diff --git a/problem_data/no099.txt b/problem_data/no099.txt new file mode 100644 index 0000000..92201db --- /dev/null +++ b/problem_data/no099.txt @@ -0,0 +1,1000 @@ +519432,525806 +632382,518061 +78864,613712 +466580,530130 +780495,510032 +525895,525320 +15991,714883 +960290,502358 +760018,511029 +166800,575487 +210884,564478 +555151,523163 +681146,515199 +563395,522587 +738250,512126 +923525,503780 +595148,520429 +177108,572629 +750923,511482 +440902,532446 +881418,505504 +422489,534197 +979858,501616 +685893,514935 +747477,511661 +167214,575367 +234140,559696 +940238,503122 +728969,512609 +232083,560102 +900971,504694 +688801,514772 +189664,569402 +891022,505104 +445689,531996 +119570,591871 +821453,508118 +371084,539600 +911745,504251 +623655,518600 +144361,582486 +352442,541775 +420726,534367 +295298,549387 +6530,787777 +468397,529976 +672336,515696 +431861,533289 +84228,610150 +805376,508857 +444409,532117 +33833,663511 +381850,538396 +402931,536157 +92901,604930 +304825,548004 +731917,512452 +753734,511344 +51894,637373 +151578,580103 +295075,549421 +303590,548183 +333594,544123 +683952,515042 +60090,628880 +951420,502692 +28335,674991 +714940,513349 +343858,542826 +549279,523586 +804571,508887 +260653,554881 +291399,549966 +402342,536213 +408889,535550 +40328,652524 +375856,539061 +768907,510590 +165993,575715 +976327,501755 +898500,504795 +360404,540830 +478714,529095 +694144,514472 +488726,528258 +841380,507226 +328012,544839 +22389,690868 +604053,519852 +329514,544641 +772965,510390 +492798,527927 +30125,670983 +895603,504906 +450785,531539 +840237,507276 +380711,538522 +63577,625673 +76801,615157 +502694,527123 +597706,520257 +310484,547206 +944468,502959 +121283,591152 +451131,531507 +566499,522367 +425373,533918 +40240,652665 +39130,654392 +714926,513355 +469219,529903 +806929,508783 +287970,550487 +92189,605332 +103841,599094 +671839,515725 +452048,531421 +987837,501323 +935192,503321 +88585,607450 +613883,519216 +144551,582413 +647359,517155 +213902,563816 +184120,570789 +258126,555322 +502546,527130 +407655,535678 +401528,536306 +477490,529193 +841085,507237 +732831,512408 +833000,507595 +904694,504542 +581435,521348 +455545,531110 +873558,505829 +94916,603796 +720176,513068 +545034,523891 +246348,557409 +556452,523079 +832015,507634 +173663,573564 +502634,527125 +250732,556611 +569786,522139 +216919,563178 +521815,525623 +92304,605270 +164446,576167 +753413,511364 +11410,740712 +448845,531712 +925072,503725 +564888,522477 +7062,780812 +641155,517535 +738878,512100 +636204,517828 +372540,539436 +443162,532237 +571192,522042 +655350,516680 +299741,548735 +581914,521307 +965471,502156 +513441,526277 +808682,508700 +237589,559034 +543300,524025 +804712,508889 +247511,557192 +543486,524008 +504383,526992 +326529,545039 +792493,509458 +86033,609017 +126554,589005 +579379,521481 +948026,502823 +404777,535969 +265767,554022 +266876,553840 +46631,643714 +492397,527958 +856106,506581 +795757,509305 +748946,511584 +294694,549480 +409781,535463 +775887,510253 +543747,523991 +210592,564536 +517119,525990 +520253,525751 +247926,557124 +592141,520626 +346580,542492 +544969,523902 +506501,526817 +244520,557738 +144745,582349 +69274,620858 +292620,549784 +926027,503687 +736320,512225 +515528,526113 +407549,535688 +848089,506927 +24141,685711 +9224,757964 +980684,501586 +175259,573121 +489160,528216 +878970,505604 +969546,502002 +525207,525365 +690461,514675 +156510,578551 +659778,516426 +468739,529945 +765252,510770 +76703,615230 +165151,575959 +29779,671736 +928865,503569 +577538,521605 +927555,503618 +185377,570477 +974756,501809 +800130,509093 +217016,563153 +365709,540216 +774508,510320 +588716,520851 +631673,518104 +954076,502590 +777828,510161 +990659,501222 +597799,520254 +786905,509727 +512547,526348 +756449,511212 +869787,505988 +653747,516779 +84623,609900 +839698,507295 +30159,670909 +797275,509234 +678136,515373 +897144,504851 +989554,501263 +413292,535106 +55297,633667 +788650,509637 +486748,528417 +150724,580377 +56434,632490 +77207,614869 +588631,520859 +611619,519367 +100006,601055 +528924,525093 +190225,569257 +851155,506789 +682593,515114 +613043,519275 +514673,526183 +877634,505655 +878905,505602 +1926,914951 +613245,519259 +152481,579816 +841774,507203 +71060,619442 +865335,506175 +90244,606469 +302156,548388 +399059,536557 +478465,529113 +558601,522925 +69132,620966 +267663,553700 +988276,501310 +378354,538787 +529909,525014 +161733,576968 +758541,511109 +823425,508024 +149821,580667 +269258,553438 +481152,528891 +120871,591322 +972322,501901 +981350,501567 +676129,515483 +950860,502717 +119000,592114 +392252,537272 +191618,568919 +946699,502874 +289555,550247 +799322,509139 +703886,513942 +194812,568143 +261823,554685 +203052,566221 +217330,563093 +734748,512313 +391759,537328 +807052,508777 +564467,522510 +59186,629748 +113447,594545 +518063,525916 +905944,504492 +613922,519213 +439093,532607 +445946,531981 +230530,560399 +297887,549007 +459029,530797 +403692,536075 +855118,506616 +963127,502245 +841711,507208 +407411,535699 +924729,503735 +914823,504132 +333725,544101 +176345,572832 +912507,504225 +411273,535308 +259774,555036 +632853,518038 +119723,591801 +163902,576321 +22691,689944 +402427,536212 +175769,572988 +837260,507402 +603432,519893 +313679,546767 +538165,524394 +549026,523608 +61083,627945 +898345,504798 +992556,501153 +369999,539727 +32847,665404 +891292,505088 +152715,579732 +824104,507997 +234057,559711 +730507,512532 +960529,502340 +388395,537687 +958170,502437 +57105,631806 +186025,570311 +993043,501133 +576770,521664 +215319,563513 +927342,503628 +521353,525666 +39563,653705 +752516,511408 +110755,595770 +309749,547305 +374379,539224 +919184,503952 +990652,501226 +647780,517135 +187177,570017 +168938,574877 +649558,517023 +278126,552016 +162039,576868 +658512,516499 +498115,527486 +896583,504868 +561170,522740 +747772,511647 +775093,510294 +652081,516882 +724905,512824 +499707,527365 +47388,642755 +646668,517204 +571700,522007 +180430,571747 +710015,513617 +435522,532941 +98137,602041 +759176,511070 +486124,528467 +526942,525236 +878921,505604 +408313,535602 +926980,503640 +882353,505459 +566887,522345 +3326,853312 +911981,504248 +416309,534800 +392991,537199 +622829,518651 +148647,581055 +496483,527624 +666314,516044 +48562,641293 +672618,515684 +443676,532187 +274065,552661 +265386,554079 +347668,542358 +31816,667448 +181575,571446 +961289,502320 +365689,540214 +987950,501317 +932299,503440 +27388,677243 +746701,511701 +492258,527969 +147823,581323 +57918,630985 +838849,507333 +678038,515375 +27852,676130 +850241,506828 +818403,508253 +131717,587014 +850216,506834 +904848,504529 +189758,569380 +392845,537217 +470876,529761 +925353,503711 +285431,550877 +454098,531234 +823910,508003 +318493,546112 +766067,510730 +261277,554775 +421530,534289 +694130,514478 +120439,591498 +213308,563949 +854063,506662 +365255,540263 +165437,575872 +662240,516281 +289970,550181 +847977,506933 +546083,523816 +413252,535113 +975829,501767 +361540,540701 +235522,559435 +224643,561577 +736350,512229 +328303,544808 +35022,661330 +307838,547578 +474366,529458 +873755,505819 +73978,617220 +827387,507845 +670830,515791 +326511,545034 +309909,547285 +400970,536363 +884827,505352 +718307,513175 +28462,674699 +599384,520150 +253565,556111 +284009,551093 +343403,542876 +446557,531921 +992372,501160 +961601,502308 +696629,514342 +919537,503945 +894709,504944 +892201,505051 +358160,541097 +448503,531745 +832156,507636 +920045,503924 +926137,503675 +416754,534757 +254422,555966 +92498,605151 +826833,507873 +660716,516371 +689335,514746 +160045,577467 +814642,508425 +969939,501993 +242856,558047 +76302,615517 +472083,529653 +587101,520964 +99066,601543 +498005,527503 +709800,513624 +708000,513716 +20171,698134 +285020,550936 +266564,553891 +981563,501557 +846502,506991 +334,1190800 +209268,564829 +9844,752610 +996519,501007 +410059,535426 +432931,533188 +848012,506929 +966803,502110 +983434,501486 +160700,577267 +504374,526989 +832061,507640 +392825,537214 +443842,532165 +440352,532492 +745125,511776 +13718,726392 +661753,516312 +70500,619875 +436952,532814 +424724,533973 +21954,692224 +262490,554567 +716622,513264 +907584,504425 +60086,628882 +837123,507412 +971345,501940 +947162,502855 +139920,584021 +68330,621624 +666452,516038 +731446,512481 +953350,502619 +183157,571042 +845400,507045 +651548,516910 +20399,697344 +861779,506331 +629771,518229 +801706,509026 +189207,569512 +737501,512168 +719272,513115 +479285,529045 +136046,585401 +896746,504860 +891735,505067 +684771,514999 +865309,506184 +379066,538702 +503117,527090 +621780,518717 +209518,564775 +677135,515423 +987500,501340 +197049,567613 +329315,544673 +236756,559196 +357092,541226 +520440,525733 +213471,563911 +956852,502490 +702223,514032 +404943,535955 +178880,572152 +689477,514734 +691351,514630 +866669,506128 +370561,539656 +739805,512051 +71060,619441 +624861,518534 +261660,554714 +366137,540160 +166054,575698 +601878,519990 +153445,579501 +279899,551729 +379166,538691 +423209,534125 +675310,515526 +145641,582050 +691353,514627 +917468,504026 +284778,550976 +81040,612235 +161699,576978 +616394,519057 +767490,510661 +156896,578431 +427408,533714 +254849,555884 +737217,512182 +897133,504851 +203815,566051 +270822,553189 +135854,585475 +778805,510111 +784373,509847 +305426,547921 +733418,512375 +732087,512448 +540668,524215 +702898,513996 +628057,518328 +640280,517587 +422405,534204 +10604,746569 +746038,511733 +839808,507293 +457417,530938 +479030,529064 +341758,543090 +620223,518824 +251661,556451 +561790,522696 +497733,527521 +724201,512863 +489217,528217 +415623,534867 +624610,518548 +847541,506953 +432295,533249 +400391,536421 +961158,502319 +139173,584284 +421225,534315 +579083,521501 +74274,617000 +701142,514087 +374465,539219 +217814,562985 +358972,540995 +88629,607424 +288597,550389 +285819,550812 +538400,524385 +809930,508645 +738326,512126 +955461,502535 +163829,576343 +826475,507891 +376488,538987 +102234,599905 +114650,594002 +52815,636341 +434037,533082 +804744,508880 +98385,601905 +856620,506559 +220057,562517 +844734,507078 +150677,580387 +558697,522917 +621751,518719 +207067,565321 +135297,585677 +932968,503404 +604456,519822 +579728,521462 +244138,557813 +706487,513800 +711627,513523 +853833,506674 +497220,527562 +59428,629511 +564845,522486 +623621,518603 +242689,558077 +125091,589591 +363819,540432 +686453,514901 +656813,516594 +489901,528155 +386380,537905 +542819,524052 +243987,557841 +693412,514514 +488484,528271 +896331,504881 +336730,543721 +728298,512647 +604215,519840 +153729,579413 +595687,520398 +540360,524240 +245779,557511 +924873,503730 +509628,526577 +528523,525122 +3509,847707 +522756,525555 +895447,504922 +44840,646067 +45860,644715 +463487,530404 +398164,536654 +894483,504959 +619415,518874 +966306,502129 +990922,501212 +835756,507474 +548881,523618 +453578,531282 +474993,529410 +80085,612879 +737091,512193 +50789,638638 +979768,501620 +792018,509483 +665001,516122 +86552,608694 +462772,530469 +589233,520821 +891694,505072 +592605,520594 +209645,564741 +42531,649269 +554376,523226 +803814,508929 +334157,544042 +175836,572970 +868379,506051 +658166,516520 +278203,551995 +966198,502126 +627162,518387 +296774,549165 +311803,547027 +843797,507118 +702304,514032 +563875,522553 +33103,664910 +191932,568841 +543514,524006 +506835,526794 +868368,506052 +847025,506971 +678623,515342 +876139,505726 +571997,521984 +598632,520198 +213590,563892 +625404,518497 +726508,512738 +689426,514738 +332495,544264 +411366,535302 +242546,558110 +315209,546555 +797544,509219 +93889,604371 +858879,506454 +124906,589666 +449072,531693 +235960,559345 +642403,517454 +720567,513047 +705534,513858 +603692,519870 +488137,528302 +157370,578285 +63515,625730 +666326,516041 +619226,518883 +443613,532186 +597717,520257 +96225,603069 +86940,608450 +40725,651929 +460976,530625 +268875,553508 +270671,553214 +363254,540500 +384248,538137 +762889,510892 +377941,538833 +278878,551890 +176615,572755 +860008,506412 +944392,502967 +608395,519571 +225283,561450 +45095,645728 +333798,544090 +625733,518476 +995584,501037 +506135,526853 +238050,558952 +557943,522972 +530978,524938 +634244,517949 +177168,572616 +85200,609541 +953043,502630 +523661,525484 +999295,500902 +840803,507246 +961490,502312 +471747,529685 +380705,538523 +911180,504275 +334149,544046 +478992,529065 +325789,545133 +335884,543826 +426976,533760 +749007,511582 +667067,516000 +607586,519623 +674054,515599 +188534,569675 +565185,522464 +172090,573988 +87592,608052 +907432,504424 +8912,760841 +928318,503590 +757917,511138 +718693,513153 +315141,546566 +728326,512645 +353492,541647 +638429,517695 +628892,518280 +877286,505672 +620895,518778 +385878,537959 +423311,534113 +633501,517997 +884833,505360 +883402,505416 +999665,500894 +708395,513697 +548142,523667 +756491,511205 +987352,501340 +766520,510705 +591775,520647 +833758,507563 +843890,507108 +925551,503698 +74816,616598 +646942,517187 +354923,541481 +256291,555638 +634470,517942 +930904,503494 +134221,586071 +282663,551304 +986070,501394 +123636,590176 +123678,590164 +481717,528841 +423076,534137 +866246,506145 +93313,604697 +783632,509880 +317066,546304 +502977,527103 +141272,583545 +71708,618938 +617748,518975 +581190,521362 +193824,568382 +682368,515131 +352956,541712 +351375,541905 +505362,526909 +905165,504518 +128645,588188 +267143,553787 +158409,577965 +482776,528754 +628896,518282 +485233,528547 +563606,522574 +111001,595655 +115920,593445 +365510,540237 +959724,502374 +938763,503184 +930044,503520 +970959,501956 +913658,504176 +68117,621790 +989729,501253 +567697,522288 +820427,508163 +54236,634794 +291557,549938 +124961,589646 +403177,536130 +405421,535899 +410233,535417 +815111,508403 +213176,563974 +83099,610879 +998588,500934 +513640,526263 +129817,587733 +1820,921851 +287584,550539 +299160,548820 +860621,506386 +529258,525059 +586297,521017 +953406,502616 +441234,532410 +986217,501386 +781938,509957 +461247,530595 +735424,512277 +146623,581722 +839838,507288 +510667,526494 +935085,503327 +737523,512167 +303455,548204 +992779,501145 +60240,628739 +939095,503174 +794368,509370 +501825,527189 +459028,530798 +884641,505363 +512287,526364 +835165,507499 +307723,547590 +160587,577304 +735043,512300 +493289,527887 +110717,595785 +306480,547772 +318593,546089 +179810,571911 +200531,566799 +314999,546580 +197020,567622 +301465,548487 +237808,559000 +131944,586923 +882527,505449 +468117,530003 +711319,513541 +156240,578628 +965452,502162 +992756,501148 +437959,532715 +739938,512046 +614249,519196 +391496,537356 +62746,626418 +688215,514806 +75501,616091 +883573,505412 +558824,522910 +759371,511061 +173913,573489 +891351,505089 +727464,512693 +164833,576051 +812317,508529 +540320,524243 +698061,514257 +69149,620952 +471673,529694 +159092,577753 +428134,533653 +89997,606608 +711061,513557 +779403,510081 +203327,566155 +798176,509187 +667688,515963 +636120,517833 +137410,584913 +217615,563034 +556887,523038 +667229,515991 +672276,515708 +325361,545187 +172115,573985 +13846,725685 \ No newline at end of file diff --git a/problem_data/no107.txt b/problem_data/no107.txt new file mode 100644 index 0000000..19d7ba3 --- /dev/null +++ b/problem_data/no107.txt @@ -0,0 +1,40 @@ +-,-,-,427,668,495,377,678,-,177,-,-,870,-,869,624,300,609,131,-,251,-,-,-,856,221,514,-,591,762,182,56,-,884,412,273,636,-,-,774 +-,-,262,-,-,508,472,799,-,956,578,363,940,143,-,162,122,910,-,729,802,941,922,573,531,539,667,607,-,920,-,-,315,649,937,-,185,102,636,289 +-,262,-,-,926,-,958,158,647,47,621,264,81,-,402,813,649,386,252,391,264,637,349,-,-,-,108,-,727,225,578,699,-,898,294,-,575,168,432,833 +427,-,-,-,366,-,-,635,-,32,962,468,893,854,718,427,448,916,258,-,760,909,529,311,404,-,-,588,680,875,-,615,-,409,758,221,-,-,76,257 +668,-,926,366,-,-,-,250,268,-,503,944,-,677,-,727,793,457,981,191,-,-,-,351,969,925,987,328,282,589,-,873,477,-,-,19,450,-,-,- +495,508,-,-,-,-,-,765,711,819,305,302,926,-,-,582,-,861,-,683,293,-,-,66,-,27,-,-,290,-,786,-,554,817,33,-,54,506,386,381 +377,472,958,-,-,-,-,-,-,120,42,-,134,219,457,639,538,374,-,-,-,966,-,-,-,-,-,449,120,797,358,232,550,-,305,997,662,744,686,239 +678,799,158,635,250,765,-,-,-,35,-,106,385,652,160,-,890,812,605,953,-,-,-,79,-,712,613,312,452,-,978,900,-,901,-,-,225,533,770,722 +-,-,647,-,268,711,-,-,-,283,-,172,-,663,236,36,403,286,986,-,-,810,761,574,53,793,-,-,777,330,936,883,286,-,174,-,-,-,828,711 +177,956,47,32,-,819,120,35,283,-,50,-,565,36,767,684,344,489,565,-,-,103,810,463,733,665,494,644,863,25,385,-,342,470,-,-,-,730,582,468 +-,578,621,962,503,305,42,-,-,50,-,155,519,-,-,256,990,801,154,53,474,650,402,-,-,-,966,-,-,406,989,772,932,7,-,823,391,-,-,933 +-,363,264,468,944,302,-,106,172,-,155,-,-,-,380,438,-,41,266,-,-,104,867,609,-,270,861,-,-,165,-,675,250,686,995,366,191,-,433,- +870,940,81,893,-,926,134,385,-,565,519,-,-,313,851,-,-,-,248,220,-,826,359,829,-,234,198,145,409,68,359,-,814,218,186,-,-,929,203,- +-,143,-,854,677,-,219,652,663,36,-,-,313,-,132,-,433,598,-,-,168,870,-,-,-,128,437,-,383,364,966,227,-,-,807,993,-,-,526,17 +869,-,402,718,-,-,457,160,236,767,-,380,851,132,-,-,596,903,613,730,-,261,-,142,379,885,89,-,848,258,112,-,900,-,-,818,639,268,600,- +624,162,813,427,727,582,639,-,36,684,256,438,-,-,-,-,539,379,664,561,542,-,999,585,-,-,321,398,-,-,950,68,193,-,697,-,390,588,848,- +300,122,649,448,793,-,538,890,403,344,990,-,-,433,596,539,-,-,73,-,318,-,-,500,-,968,-,291,-,-,765,196,504,757,-,542,-,395,227,148 +609,910,386,916,457,861,374,812,286,489,801,41,-,598,903,379,-,-,-,946,136,399,-,941,707,156,757,258,251,-,807,-,-,-,461,501,-,-,616,- +131,-,252,258,981,-,-,605,986,565,154,266,248,-,613,664,73,-,-,686,-,-,575,627,817,282,-,698,398,222,-,649,-,-,-,-,-,654,-,- +-,729,391,-,191,683,-,953,-,-,53,-,220,-,730,561,-,946,686,-,-,389,729,553,304,703,455,857,260,-,991,182,351,477,867,-,-,889,217,853 +251,802,264,760,-,293,-,-,-,-,474,-,-,168,-,542,318,136,-,-,-,-,392,-,-,-,267,407,27,651,80,927,-,974,977,-,-,457,117,- +-,941,637,909,-,-,966,-,810,103,650,104,826,870,261,-,-,399,-,389,-,-,-,202,-,-,-,-,867,140,403,962,785,-,511,-,1,-,707,- +-,922,349,529,-,-,-,-,761,810,402,867,359,-,-,999,-,-,575,729,392,-,-,388,939,-,959,-,83,463,361,-,-,512,931,-,224,690,369,- +-,573,-,311,351,66,-,79,574,463,-,609,829,-,142,585,500,941,627,553,-,202,388,-,164,829,-,620,523,639,936,-,-,490,-,695,-,505,109,- +856,531,-,404,969,-,-,-,53,733,-,-,-,-,379,-,-,707,817,304,-,-,939,164,-,-,616,716,728,-,889,349,-,963,150,447,-,292,586,264 +221,539,-,-,925,27,-,712,793,665,-,270,234,128,885,-,968,156,282,703,-,-,-,829,-,-,-,822,-,-,-,736,576,-,697,946,443,-,205,194 +514,667,108,-,987,-,-,613,-,494,966,861,198,437,89,321,-,757,-,455,267,-,959,-,616,-,-,-,349,156,339,-,102,790,359,-,439,938,809,260 +-,607,-,588,328,-,449,312,-,644,-,-,145,-,-,398,291,258,698,857,407,-,-,620,716,822,-,-,293,486,943,-,779,-,6,880,116,775,-,947 +591,-,727,680,282,290,120,452,777,863,-,-,409,383,848,-,-,251,398,260,27,867,83,523,728,-,349,293,-,212,684,505,341,384,9,992,507,48,-,- +762,920,225,875,589,-,797,-,330,25,406,165,68,364,258,-,-,-,222,-,651,140,463,639,-,-,156,486,212,-,-,349,723,-,-,186,-,36,240,752 +182,-,578,-,-,786,358,978,936,385,989,-,359,966,112,950,765,807,-,991,80,403,361,936,889,-,339,943,684,-,-,965,302,676,725,-,327,134,-,147 +56,-,699,615,873,-,232,900,883,-,772,675,-,227,-,68,196,-,649,182,927,962,-,-,349,736,-,-,505,349,965,-,474,178,833,-,-,555,853,- +-,315,-,-,477,554,550,-,286,342,932,250,814,-,900,193,504,-,-,351,-,785,-,-,-,576,102,779,341,723,302,474,-,689,-,-,-,451,-,- +884,649,898,409,-,817,-,901,-,470,7,686,218,-,-,-,757,-,-,477,974,-,512,490,963,-,790,-,384,-,676,178,689,-,245,596,445,-,-,343 +412,937,294,758,-,33,305,-,174,-,-,995,186,807,-,697,-,461,-,867,977,511,931,-,150,697,359,6,9,-,725,833,-,245,-,949,-,270,-,112 +273,-,-,221,19,-,997,-,-,-,823,366,-,993,818,-,542,501,-,-,-,-,-,695,447,946,-,880,992,186,-,-,-,596,949,-,91,-,768,273 +636,185,575,-,450,54,662,225,-,-,391,191,-,-,639,390,-,-,-,-,-,1,224,-,-,443,439,116,507,-,327,-,-,445,-,91,-,248,-,344 +-,102,168,-,-,506,744,533,-,730,-,-,929,-,268,588,395,-,654,889,457,-,690,505,292,-,938,775,48,36,134,555,451,-,270,-,248,-,371,680 +-,636,432,76,-,386,686,770,828,582,-,433,203,526,600,848,227,616,-,217,117,707,369,109,586,205,809,-,-,240,-,853,-,-,-,768,-,371,-,540 +774,289,833,257,-,381,239,722,711,468,933,-,-,17,-,-,148,-,-,853,-,-,-,-,264,194,260,947,-,752,147,-,-,343,112,273,344,680,540,- diff --git a/python_code/complete/no051.py b/python_code/complete/no051.py new file mode 100644 index 0000000..989f2b9 --- /dev/null +++ b/python_code/complete/no051.py @@ -0,0 +1,31 @@ +from python_code.functions import sieve + +def max_digs(n): + digs = set(str(n)) + counts = [(dig, str(n).count(dig)) for dig in digs] + return sorted(counts, key=lambda pair: pair[1])[-1] + +def find_and_replace(n, dig): + digits = range(10) + if str(n)[0] == dig: + digits.remove(0) # no leading 0s + + string_val = str(n) + result = [string_val.replace(dig, str(substitute)) + for substitute in digits] + return [int(xx) for xx in result] + +PRIMES = sieve(10**6) + +for prime in PRIMES: + digit, count = max_digs(prime) + if count > 2: + candidates = find_and_replace(prime, digit) + match_count = 0 + for candidate in candidates: + if candidate in PRIMES: + match_count += 1 + if match_count == 8: + winner = prime + break +print winner diff --git a/python_code/complete/no060.py b/python_code/complete/no060.py new file mode 100644 index 0000000..3b16d50 --- /dev/null +++ b/python_code/complete/no060.py @@ -0,0 +1,46 @@ +import operator + +from python_code.functions import is_prime +from python_code.functions import sieve + +MAX_n = 10**4 +PRIMES = sieve(MAX_n) +num_primes = len(PRIMES) +partner_hash = {} +for first in range(num_primes - 1): + prime1 = PRIMES[first] + for second in range(first + 1, num_primes): + prime2 = PRIMES[second] + cand1 = int(str(prime1) + str(prime2)) + cand2 = int(str(prime2) + str(prime1)) + if is_prime(cand1, primes=PRIMES, failure_point=MAX_n**2): + if is_prime(cand2, primes=PRIMES, failure_point=MAX_n**2): + if prime1 in partner_hash: + partner_hash[prime1].append(prime2) + else: + partner_hash[prime1] = [prime2] + if prime2 in partner_hash: + partner_hash[prime2].append(prime1) + else: + partner_hash[prime2] = [prime1] + +size = 1 +valid = [[prime] for prime in partner_hash] +for size in range(2, 5 + 1): + next = [] + for subset in valid: + could_add = partner_hash[subset[0]] + for prime in subset: + could_add = [p for p in could_add + if p in partner_hash[prime]] + next.extend([subset[:] + [cand] for cand in could_add]) + valid = next + +min_sum = 10**10 +min_set = None +for subset in valid: + if sum(subset) < min_sum: + min_sum = sum(subset) + min_set = subset + +print min_sum, min_set diff --git a/python_code/complete/no073 b/python_code/complete/no073 new file mode 100755 index 0000000..3264c91 --- /dev/null +++ b/python_code/complete/no073 @@ -0,0 +1,44 @@ +#!/usr/bin/env python + +# Consider the fraction, n/d, where n and d are positive integers. +# If n < d and HCF(n,d)=1, it is called a reduced proper fraction. + +# If we list the set of reduced proper fractions for d <= 8 in +# ascending order of size, we get: +# 1/8, 1/7, 1/6, 1/5, 1/4, 2/7, 1/3, 3/8, 2/5, 3/7, 1/2, +# 4/7, 3/5, 5/8, 2/3, 5/7, 3/4, 4/5, 5/6, 6/7, 7/8 + +# It can be seen that there are 3 fractions between 1/3 and 1/2. + +# How many fractions lie between 1/3 and 1/2 in the sorted set of +# reduced proper fractions for d <= 12,000? + +# ALGO +# We simply seek 1/3 <= n/d <= 1/2 with (n, d) = 1 +# This is equivalent to d/3 <= n <= d/2 or +# ceil(d/3) <= n <= floor(d/2) +# Note we'll never have conflicts since for d > 3, +# (n, d) = 1 implies n/d = 1/2 or n/d = 1/3 is +# impossible + +from fractions import gcd +from math import ceil +from math import floor + +from python_code.decorators import euler_timer + +@euler_timer(73) +def main(): + MAX_d = 12000 + + count = 0 + for d in range(4, MAX_d + 1): + low = int(ceil(d/3.0)) + high = int(floor(d/2.0)) + for n in range(low, high + 1): + if gcd(d, n) == 1: + count += 1 + print count + +if __name__ == "__main__": + main() diff --git a/python_code/complete/no077 b/python_code/complete/no077 new file mode 100755 index 0000000..532f408 --- /dev/null +++ b/python_code/complete/no077 @@ -0,0 +1,103 @@ +#!/usr/bin/env python + +# It is possible to write ten as the sum of primes in +# exactly five different ways: + +# 7 + 3 +# 5 + 5 +# 5 + 3 + 2 +# 3 + 3 + 2 + 2 +# 2 + 2 + 2 + 2 + 2 + +# What is the first value which can be written as the sum of +# primes in over five thousand different ways? + +################################# +# Let pp(k, n) represent the number of partitions of n +# using only primes at least as large as p_k (the kth prime) + +# Since the primes are either all greater than p_k or one +# of them is equal we have +# pp(k, n) = pp(k+1, n) + pp(k, n - p_k) +# p_0 = 2, we want to compute pp(0, n) for all n and continue +# doing so until pp(0, n) > 5000 + +# Boundary +# p(k, n) = 0 if p_k > n +# p(k, n) = 1 if p_k = n +# pp(k, n) = pp(k+1, n) + pp(k, n - p_k) + +############## EXAMPLE TABLE ############## +# n\k | 0 | 1 | 2 | +# ----------------- +# 1 | 0 | 0 | 0 | +# ----------------- +# 2 | 1 | 0 | 0 | +# ----------------- +# 3 | 1 | 1 | 0 | +# ----------------- +# 4 | 1 | 0 | 0 | +# ----------------- +# 5 | 1 | 1 | 1 | +# ----------------- + +from python_code.decorators import euler_timer +from python_code.functions import sieve + +def prime_partitions(n, primes): + p = {} + for k in range(1, n + 1): + p[(k, k)] = 1 + for i in range(k - 1, 0, -1): + if i > k - i: + p[(i, k)] = p[(i + 1, k)] + else: + p[(i, k)] = p[(i + 1, k)] + p[(i, k - i)] + return p[(1, n)] + +@euler_timer(77) +def main(): + max_prime_val = 10**2 + PRIMES = sieve(max_prime_val) + + pp = {(0, 1): 0, + (1, 1): 0, + (2, 1): 0, + (0, 2): 1, + (1, 2): 0, + (2, 2): 0} + curr_val = -1 + n = 2 + curr_prime_index = 1 + while curr_val < 5000: + n += 1 + if n > PRIMES[curr_prime_index]: + curr_prime_index += 1 + if curr_prime_index >= len(PRIMES): + raise ValueError("Primes is too small: %s" % curr_val) + + prime_index = curr_prime_index + # First reduce the prime_index, "k" until the prime itself + # does not exceed n + while PRIMES[prime_index] > n: + pp[(prime_index, n)] = 0 + prime_index -= 1 + # If n is a prime number, then after doing so, we know that + # PRIMES[prime_index] == n, hence pp(p_i, n) = 1 and we + # can reduce the index further + if PRIMES[prime_index] == n: + pp[(prime_index, n)] = 1 + prime_index -= 1 + + for index in range(prime_index, -1, -1): + prime_val = PRIMES[index] + if prime_val > n - prime_val: + pp[(index, n)] = pp[(index + 1, n)] + else: + pp[(index, n)] = pp[(index + 1, n)] + pp[(index, n - prime_val)] + + curr_val = pp[(0, n)] + print n + +if __name__ == "__main__": + main() diff --git a/python_code/complete/no078.py b/python_code/complete/no078.py new file mode 100644 index 0000000..30cc536 --- /dev/null +++ b/python_code/complete/no078.py @@ -0,0 +1,27 @@ +from python_code.functions import polygonal_number + +def find_residue(residue): + p = {0: 1} + + pentagonal = [] + pent_index = 1 + while True: + if pent_index > 0: + next_index = -pent_index + else: + next_index = -pent_index + 1 + begin = polygonal_number(5, pent_index) + end = polygonal_number(5, next_index) + pentagonal.append(begin) + for n in range(begin, end): + p[n] = 0 + for index, val in enumerate(pentagonal): + if (index/2) % 2 == 0: + p[n] = (p[n] + p[n - val]) % residue + else: + p[n] = (p[n] - p[n - val]) % residue + if p[n] == 0: + return n + pent_index = next_index + +print find_residue(10**6) diff --git a/python_code/complete/no079.py b/python_code/complete/no079.py new file mode 100644 index 0000000..d186620 --- /dev/null +++ b/python_code/complete/no079.py @@ -0,0 +1,27 @@ +from python_code.functions import get_data + +data = [[int(dig) for dig in row] for row + in get_data(79).split("\r\n") if row] + +matches = {} +for attempt in data: + a, b, c = attempt + keys = [((a, b), (c, 'Right')), + ((a, c), (b, 'Middle')), + ((b, c), (a, 'Left'))] + for key, val in keys: + if key in matches: + matches[key].append(val) + else: + matches[key] = [val] + +for val in matches.values(): + val.sort() + +# 73162890 +# no (7, a) have left values so we choose 7 as the leftmost +# The majority of (b, a) with no left value are in 7 and 3 +# so we start 73. Using the pairs with 7 and 3 first, +# and no left values we can put together the solution +# and verify it gels with all the conditions +print 73162890 diff --git a/python_code/complete/no080 b/python_code/complete/no080 new file mode 100755 index 0000000..84a424c --- /dev/null +++ b/python_code/complete/no080 @@ -0,0 +1,91 @@ +#!/usr/bin/env python + +# It is well known that if the square root of a natural number is not an +# integer, then it is irrational. The decimal expansion of such square +# roots is infinite without any repeating pattern at all. + +# The square root of two is 1.41421356237309504880..., and the digital +# sum of the first one hundred decimal digits is 475. + +# For the first one hundred natural numbers, find the total of the digital sums +# of the first one hundred decimal digits for all the irrational square roots. + +########################### +# To deal with precision, we use no064 and no065 to help out. +# The expanded_digits function will expanded n/d to d digits no matter +# the precision simply by multiplying by 10 + +# We use the cycle (algorithm calculated in 64) to find the values of a_i +# in the continued fraction expansion and we use the recurrence on +# the numerator and denominator in the fractional estimate as in +# 65. Once these estimates agree to 100 digits, we stop + +from math import sqrt +from fractions import gcd + +from python_code.decorators import euler_timer +from python_code.functions import recurrence_next + +def expanded_digits(numerator, denominator, digits): + # use integer division on num and denom to get a quotient + quotient_digits = [int(dig) for dig in str(numerator/denominator)] + remainder = numerator % denominator + if len(quotient_digits) >= digits: + return quotient_digits[:digits] + return quotient_digits + expanded_digits(10*remainder, + denominator, + digits - len(quotient_digits)) + +def next(current, n): + A, B, C = current + a = int(C*(1.0)/(A*sqrt(n) + B)) + r = (C*A, -C*B - a*(n*A**2 - B**2), n*A**2 - B**2) + d = gcd(gcd(r[0], r[1]), r[2]) + return ( r[0]/d, r[1]/d, r[2]/d ) + +def cycle(n): + result = [int(sqrt(n))] + init = curr_r = (1, -int(sqrt(n)), 1) + + result.append(int(curr_r[2]*(1.0)/(curr_r[0]*sqrt(n) + curr_r[1]))) + curr_r = next(curr_r, n) + while curr_r != init: + result.append(int(curr_r[2]*(1.0)/(curr_r[0]*sqrt(n) + curr_r[1]))) + curr_r = next(curr_r, n) + return result + +def stable_expansion(digits, n): + values = cycle(n) + h_values = [1, values[0]] # a_0 + k_values = [0, 1] + + cycle_length = len(values) - 1 # we only cycle over a_1,...,a_{k-1} + last = expanded_digits(h_values[1], k_values[1], digits) + index = 1 + relation = [1, values[index]] + h_values = recurrence_next(relation, h_values) + k_values = recurrence_next(relation, k_values) + current = expanded_digits(h_values[1], k_values[1], digits) + while current != last: + index += 1 + last = current + + relative_index = ((index - 1) % cycle_length) + 1 + # we want residues 1,..,k-1 instead of the traditional 0,...,k-2 + relation = [1, values[relative_index]] + h_values = recurrence_next(relation, h_values) + k_values = recurrence_next(relation, k_values) + current = expanded_digits(h_values[1], k_values[1], digits) + return current + +@euler_timer(80) +def main(): + non_squares = [ num for num in range(1, 100 + 1) + if int(sqrt(num))**2 != num ] + running_sum = 0 + for n in non_squares: + running_sum += sum(stable_expansion(100, n)) + print running_sum + +if __name__ == "__main__": + main() diff --git a/python_code/complete/no081.py b/python_code/complete/no081.py new file mode 100644 index 0000000..717185f --- /dev/null +++ b/python_code/complete/no081.py @@ -0,0 +1,35 @@ +from python_code.functions import get_data + +def diamond_matrix(data): + result = {} + max_index = len(data) - 1 + max_depth = 2*max_index + result[(max_index, max_index)] = data[-1][-1] + + for depth in range(max_depth - 1, -1, -1): + initial = 0 + final = depth + if depth > max_index: + initial = depth - max_index + final = max_index + for row in range(initial, final + 1): + column = depth - row + choices = [] + if (row + 1, column) in result: + choices.append(result[(row + 1, column)]) + if (row, column + 1) in result: + choices.append(result[(row, column + 1)]) + result[(row, column)] = data[row][column] + min(choices) + return result[(0, 0)] + +# EXAMPLE = [[131, 673, 234, 103, 18], +# [201, 96, 342, 965, 150], +# [630, 803, 746, 422, 111], +# [537, 699, 497, 121, 956], +# [805, 732, 524, 37, 331]] +# print diamond_matrix(EXAMPLE) == 2427 + +data = [[int(entry) for entry in row.split(",")] + for row in get_data(81).split("\n") if row] + +print diamond_matrix(data) diff --git a/python_code/complete/no082.py b/python_code/complete/no082.py new file mode 100644 index 0000000..28484b8 --- /dev/null +++ b/python_code/complete/no082.py @@ -0,0 +1,28 @@ +from python_code.functions import get_data + +def column_by_column(data): + result = {} + size = len(data) + # First column is set + for row in range(size): + result[(row, 0)] = data[row][0] + + for column in range(1, size): + for row in range(size): + set_val = result[(row, column - 1)] + data[row][column] + for under in range(row): + val = result[(under, column - 1)] + sum([data[ind][column] for ind in range(under, row + 1)]) + if val < set_val: + set_val = val + for over in range(row + 1, size): + val = result[(over, column - 1)] + sum([data[ind][column] for ind in range(row, over + 1)]) + if val < set_val: + set_val = val + result[(row, column)] = set_val + + return min([result[(row, size - 1)] for row in range(size)]) + +data = [[int(entry) for entry in row.split(",")] + for row in get_data(82).split("\n") if row] + +print column_by_column(data) diff --git a/python_code/complete/no083.py b/python_code/complete/no083.py new file mode 100644 index 0000000..93ef8ae --- /dev/null +++ b/python_code/complete/no083.py @@ -0,0 +1,55 @@ +from python_code.functions import get_data + +def astar(graph, size, minimum): + start = (0, 0) + target = (size - 1, size - 1) + closed_nodes = {(0, 0): (None, graph[(0, 0)])} + # node, parent, distance, don't store heuristic dist. + open_nodes = {(1, 0): ((0, 0), graph[(0, 0)] + graph[(1, 0)]), + (0, 1): ((0, 0), graph[(0, 0)] + graph[(0, 1)])} + def heuristic(node): + return (2*size - 2 - sum(node))*minimum + + while target not in closed_nodes: + min_val = None + min_f = -1 + for node in open_nodes: + val = open_nodes[node][1] + heuristic(node) + if min_val is None: + min_val = val + min_f = node + else: + if val < min_val: + min_val = val + min_f = node + + closed_nodes[min_f] = open_nodes.pop(min_f) + + min_val = min_val - heuristic(min_f) + node_x, node_y = min_f + adjacent = [(node_x + 1, node_y), (node_x - 1, node_y), + (node_x, node_y + 1), (node_x, node_y - 1)] + adjacent = [pair for pair in adjacent + if pair not in closed_nodes and pair in graph] + for node in adjacent: + if node in open_nodes: + comp_val = open_nodes[node][1] + new_val = min_val + graph[node] + if new_val < comp_val: + open_nodes[node] = (min_f, new_val) + else: + open_nodes[node] = (min_f, min_val + graph[node]) + + return closed_nodes[target][1] + +data = [[int(entry) for entry in row.split(",")] + for row in get_data(83).split("\n") if row] + +arranged_data = {} +size = len(data) +for i in range(size): + for j in range(size): + arranged_data[(i, j)] = data[i][j] + +minimum = min(arranged_data.values()) +print astar(arranged_data, size, minimum) diff --git a/python_code/complete/no086.py b/python_code/complete/no086.py new file mode 100644 index 0000000..7ac0588 --- /dev/null +++ b/python_code/complete/no086.py @@ -0,0 +1,58 @@ +from math import sqrt + +def ascending(num, num_sum, min_num, prob_max): + if num_sum < min_num: + return [] + if num == 1: + if num_sum == min_num: + return [[num_sum]] + else: + return [] + + next_sum = num_sum - min_num + biggest = next_sum/(num - 1) # integer division intended + biggest = min(biggest, prob_max) + result = [] + for next_min in range(min_num, biggest + 1): + result.extend([[min_num] + cand for cand in + ascending(num - 1, next_sum, next_min, prob_max)]) + return result + +def short_distance_int(a, b, c): + best = min(sqrt(a**2 + (b + c)**2), + sqrt(b**2 + (c + a)**2), + sqrt(c**2 + (a + b)**2)) + return int(best) == best + +def num_solutions(M, hash_): + if M in hash_: + return hash_[M] + if M == 0: + hash_[0] = 0 + return 0 + + to_add = 0 + for lowest in range(1, M): + # exactly 1 values M + for mid in range(lowest, M): + if short_distance_int(lowest, mid, M): + to_add += 1 + # exactly 2 values M + if short_distance_int(lowest, M, M): + to_add += 1 + # all values M + if short_distance_int(M, M, M): + to_add += 1 + result = to_add + num_solutions(M - 1, hash_) + hash_[M] = result + return result + +TARGET = 10**6 +solution_hash = {0: 0} +M = 1 +num_solutions(1, solution_hash) +while solution_hash[M] <= TARGET: + M += 1 + num_solutions(M, solution_hash) +print M, solution_hash[M] +# 1818 diff --git a/python_code/complete/no088.py b/python_code/complete/no088.py new file mode 100644 index 0000000..848955a --- /dev/null +++ b/python_code/complete/no088.py @@ -0,0 +1,34 @@ +from python_code.functions import all_factors + +MAX_n = 13000 +factor_hash = {1: [1]} +factor_hash = all_factors(MAX_n, factor_hash) +available = {} +for i in range(1, MAX_n + 1): + available[i] = [factor for factor in factor_hash[i] + if factor > 1 and factor**2 <= i] + +new_hash = {1: [[]], 2: [[2]]} +value_hash = {} +for i in range(3, 13000 + 1): + to_add = [[i]] + for factor in available[i]: + for subset1 in new_hash[factor]: + for subset2 in new_hash[i/factor]: + cand = sorted(subset1 + subset2) + if cand not in to_add: + to_add.append(cand) + for match in to_add: + new_k = i + len(match) - sum(match) + if new_k > 1 and new_k not in value_hash: + value_hash[new_k] = i + new_hash[i] = to_add + +final_list = [] +for desired in range(2, 12001): + if desired not in value_hash: + raise Exception("Subset not large enough, raise MAX_n.") + if value_hash[desired] not in final_list: + final_list.append(value_hash[desired]) + +print sum(final_list) diff --git a/python_code/complete/no090.py b/python_code/complete/no090.py new file mode 100644 index 0000000..7463755 --- /dev/null +++ b/python_code/complete/no090.py @@ -0,0 +1,60 @@ +from python_code.functions import all_subsets +# def all_subsets(list_, size): + +from math import factorial +import operator + +def total_perms(o_list): + counts = [] + curr_entry = o_list[0] + curr_count = 1 + for entry in o_list[1:]: + if entry == curr_entry: + curr_count += 1 + else: + counts.append(curr_count) + curr_entry = entry + curr_count = 1 + counts.append(curr_count) + return factorial(sum(counts))/reduce(operator.mul, [factorial(count) for count in counts]) + +def ascending(num, num_sum, min_num, prob_max): + if num_sum < min_num: + return [] + if num == 1: + if num_sum == min_num: + return [[num_sum]] + else: + return [] + + next_sum = num_sum - min_num + biggest = next_sum/(num - 1) # integer division intended + biggest = min(biggest, prob_max) + result = [] + for next_min in range(min_num, biggest + 1): + result.extend([[min_num] + cand for cand in + ascending(num - 1, next_sum, next_min, prob_max)]) + return result + +def can_concat(left, right): + possible = ['%s%s' % (dig_l, dig_r) for dig_l in left for dig_r in right] + possible.extend(['%s%s' % (dig_l, dig_r) for dig_l in right for dig_r in left]) + return (len(set(possible).intersection( + ['01', '04', '09', '16', '25', '36', '49', '64', '81'])) == 9) + +dice = all_subsets(range(10), 6) +size = len(dice) +for i in range(size): + if 6 in dice[i]: + if 9 not in dice[i]: + dice[i].append(9) + if 9 in dice[i]: + if 6 not in dice[i]: + dice[i].append(6) + +count = 0 +for left_ind in range(size - 1): + for right_ind in range(left_ind, size): + if can_concat(dice[left_ind], dice[right_ind]): + count += 1 +print count diff --git a/python_code/complete/no093.py b/python_code/complete/no093.py new file mode 100644 index 0000000..dcfc787 --- /dev/null +++ b/python_code/complete/no093.py @@ -0,0 +1,123 @@ +import operator + +from python_code.functions import all_permutations +from python_code.functions import all_subsets + +# a D b D c D d, D in {+,-,*,/} +# = {operator.add, operator.sub, operator.mul, operator.div} +# (a b) c d +# a b (c d) +# (a b) (c d) +# (a b c) d +# ((a b) c) d +# (a (b c)) d +# a (b c d) +# a ((b c) d) +# a (b (c d)) + +def do_operations_no_paren(operators, numbers): + if len(operators) + 1 != len(numbers): + raise Exception("MISDEED") + + if len(numbers) == 1: + return numbers[0] + + + for i, op in enumerate(operators): + if op in [operator.mul, operator.div]: + new_number = op(numbers[i], numbers[i+1]) + new_numbers = numbers[:i] + [new_number] + numbers[i+2:] + new_operators = operators[:i] + operators[i+1:] + return do_operations_no_paren(new_operators, new_numbers) + + # no mul or div found + new_number = op(numbers[0], numbers[1]) + new_numbers = [new_number] + numbers[2:] + new_operators = operators[1:] + return do_operations_no_paren(new_operators, new_numbers) + +def results(signs, numbers): + # parentheses first + # multiply or divide before add or subtract + # left to right after all + a, b, c, d = numbers + s1, s2, s3 = signs + + result = [] + try: + val = do_operations_no_paren([s2, s3], [s1(a, b), c, d]) + result.append(val) + except ZeroDivisionError: + pass + try: + val = do_operations_no_paren([s1, s2], [a, b, s3(c, d)]) + result.append(val) + except ZeroDivisionError: + pass + try: + val = do_operations_no_paren([s2], [s1(a, b), s3(c, d)]) + result.append(val) + except ZeroDivisionError: + pass + try: + val = do_operations_no_paren([s3], [do_operations_no_paren([s1, s2], [a, b, c]), d]) + result.append(val) + except ZeroDivisionError: + pass + try: + val = do_operations_no_paren([s3], [s2(s1(a, b), c), d]) + result.append(val) + except ZeroDivisionError: + pass + try: + val = do_operations_no_paren([s3], [s1(a, s2(b, c)), d]) + result.append(val) + except ZeroDivisionError: + pass + try: + val = do_operations_no_paren([s1], [a, do_operations_no_paren([s2, s3], [b, c, d])]) + result.append(val) + except ZeroDivisionError: + pass + try: + val = do_operations_no_paren([s1], [a, s3(s2(b, c), d)]) + result.append(val) + except ZeroDivisionError: + pass + try: + val = do_operations_no_paren([s1], [a, s2(b, s3(c, d))]) + result.append(val) + except ZeroDivisionError: + pass + + return [int(n) for n in result if int(n) == n] + +def most_consecutive(dig_cands, sign_cands): + all_encountered = [] + for perm in all_permutations(dig_cands): + for sign_set in sign_cands: + for number in results(sign_set, perm): + if number > 0 and number not in all_encountered: + all_encountered.append(number) + biggest = 1 + while biggest + 1 in all_encountered: + biggest = biggest + 1 + return biggest + +SIGNS = [operator.add, operator.sub, operator.mul, operator.div] +SIGN_CANDS = [] +for sign1 in SIGNS: + for sign2 in SIGNS: + for sign3 in SIGNS: + SIGN_CANDS.append([sign1, sign2, sign3]) +special_range = [n*1.0 for n in range(1, 10)] +DIG_CANDS = all_subsets(special_range, 4) + +max_tuple = None +max_val = 0 +for dig_cand in DIG_CANDS: + length = most_consecutive(dig_cand, SIGN_CANDS) + if length > max_val: + max_val = length + max_tuple = dig_cand +print ''.join([str(int(n)) for n in max_tuple]) diff --git a/python_code/complete/no095.py b/python_code/complete/no095.py new file mode 100644 index 0000000..fc21f33 --- /dev/null +++ b/python_code/complete/no095.py @@ -0,0 +1,69 @@ +from python_code.decorators import euler_timer +from python_code.functions import all_factors +from python_code.functions import first_prime_divisor +from python_code.functions import robust_divide +from python_code.functions import sieve + +n = 10**6 +PRIMES = sieve(n) + +def sum_factors(n, hash_={}, primes=[]): + if n in hash_: + return hash_[n] + elif n == 1: + hash_[1] = 1 + return 1 + if primes == []: + primes = sieve(n) + + prime, _ = first_prime_divisor(n, primes) + quotient, count = robust_divide(n, prime, include_count=True) + factor = (prime**(count + 1) - 1)/(prime - 1) + hash_[n] = factor*sum_factors(quotient, hash_=hash_, primes=primes) + return hash_[n] + +def amicable_cycle(n, cycle_hash, factor_sum_hash, primes, break_point): + if n in cycle_hash: + return cycle_hash[n][1] + + cycle = [n] + next = sum_factors(n, factor_sum_hash, primes) - n + while (next not in cycle_hash and + next not in cycle and + next <= break_point): + cycle.append(next) + next = sum_factors(next, factor_sum_hash, primes) - next + + if next > break_point: + set_val = [None] + elif next in cycle_hash: + set_val = cycle_hash[next][1] + elif next in cycle: + start = cycle.index(next) + set_val = cycle[start:] + else: + raise Exception("Shouldn't happen") + for val in cycle: + cycle_hash[val] = (factor_sum_hash[val] - val, set_val[:]) + return cycle_hash[n][1] + +chains = {1: (0, [0]), + 2: (1, [0]), + 3: (1, [0])} + +h = {1: 1, + 2: 3, + 3: 4} + +for i in range(4, n + 1): + amicable_cycle(i, chains, h, PRIMES, 10**6 + 1) + +best_length = 0 +longest_chain = None +for i in range(1, n + 1): + chain = chains[i][1] + if len(chain) > best_length: + best_length = len(chain) + longest_chain = chain[:] + +print min(longest_chain) diff --git a/python_code/complete/no095_sieve.py b/python_code/complete/no095_sieve.py new file mode 100644 index 0000000..766559d --- /dev/null +++ b/python_code/complete/no095_sieve.py @@ -0,0 +1,51 @@ +def proper_divisor_sums(n): + result = [0]*(n + 1) + # loop over all possible divisors + for divisor in xrange(1, n + 1): + # loop over all numbers that + # i divides properly (we want + # the sum of proper divisors) + for parent in xrange(2*divisor, n + 1, divisor): + result[parent] += divisor + return result + +def amicable_cycle(n, cycle_hash, divisors, break_point): + if n in cycle_hash: + return cycle_hash[n][1] + + cycle = [n] + next = divisors[n] + while (next not in cycle_hash and + next not in cycle and + next <= break_point): + cycle.append(next) + next = divisors[next] + + if next > break_point: + set_val = [None] + elif next in cycle_hash: + set_val = cycle_hash[next][1] + elif next in cycle: + start = cycle.index(next) + set_val = cycle[start:] + else: + raise Exception("Shouldn't happen") + for val in cycle: + cycle_hash[val] = (divisors[val], set_val[:]) + return cycle_hash[n][1] + +MAX_n = 10**6 +divisors = proper_divisor_sums(MAX_n) +chains = {1: (0, [0]), + 2: (1, [0]), + 3: (1, [0])} + +best_length = 1 +longest_chain = [0] +for i in range(4, MAX_n + 1): + chain = amicable_cycle(i, chains, divisors, 10**6) + if len(chain) > best_length: + best_length = len(chain) + longest_chain = chain[:] + +print min(longest_chain) diff --git a/python_code/complete/no096.py b/python_code/complete/no096.py new file mode 100644 index 0000000..3eefb3a --- /dev/null +++ b/python_code/complete/no096.py @@ -0,0 +1,548 @@ +############################# +########## Imports ########## +############################# + +import operator +from os.path import exists +import time +from python_code.functions import get_data + +############################# +######### Constants ######### +############################# + +GRID_KEY = {1: 1, + 2: 4, + 3: 7, + 4: 28, + 5: 31, + 6: 34, + 7: 55, + 8: 58, + 9: 61} + +############################# +########## Errors ########### +############################# + +class Error(Exception): + pass + + +class NonuniqueListForSubset(Error): + pass + + +class NonsenseSudokuValue(Error): + pass + + +class NonsenseIndex(Error): + pass + + +class NonsenseGridIndex(Error): + pass + + +class BadSudokuFileInput(Error): + pass + + +class WronglySpecifiedNode(Error): + pass + + +class WronglySpecifiedStructure(Error): + pass + + +class WronglySpecifiedValueDeclaration(Error): + pass + + +class TooManyOccurences(Error): + pass + + +class CheckFoundNoImprovement(Error): + pass + + +class NodelistMissingValue(Error): + pass + +############################# +###### Helper Functions ##### +############################# + +def subset(list_, size): + if len(list_) != len(set(list_)): + raise NonuniqueListForSubset(list_) + if size == 1: + return [ [entry] for entry in list_ ] + result = [] + for entry in list_: + candidates = list_[:] # copy, though not entirely deep + candidates.remove(entry) + for subset_ in subset(candidates, size - 1): + to_add = sorted(subset_ + [entry]) + if to_add not in result: + result.append(to_add) + return [ entry for entry in result ] + + +def get_indices(structure, index): + if structure not in ('row', 'column', 'subgrid'): + raise WronglySpecifiedStructure(structure) + elif index not in range(1, 10): + raise NonsenseGridIndex(index) + + if structure == 'row': + return [ 9*(index - 1) + j + 1 for j in range(9) ] + elif structure == 'column': + return [ index + 9*j for j in range(9) ] + elif structure == 'subgrid': + return [ GRID_KEY[index] + i + 9*j + for i in range(3) for j in range(3) ] + + +def get_first_node(nodes, value): + for node in nodes: + if value in node.choices: + # returns the actual object, not a copy + return node + raise NodelistMissingValue(value) + + +def copy_remove(list_, val): + # assume val occurs 0 or 1 times in list_ + if list_.count(val) > 1: + raise TooManyOccurences("%s in %s" % (val, list_)) + + result = list_[:] + if val in result: + result.remove(val) + return result + + +def all_possible(structure_choices): + if len(structure_choices) == 0: + return [] + elif len(structure_choices) == 1: + return [ choices[:] for choices in structure_choices[:] ] + result = [] + working_choices = [ choices[:] for choices in structure_choices[1:] ] + # if this entry is empty, result will be as well, which is fine + for val in structure_choices[0]: + curr = [ copy_remove(choices, val) for choices in working_choices ] + result.extend([ [val] + arr for arr in all_possible(curr) ]) + return result + + +def hypothetical_setval(structure, index, value): + """ + Helper for check structure + + Returns hypothetical arrangements for structure given the + node at index is set to value. + """ + if type(structure) != list: + raise WronglySpecifiedStructure( + "Type is %s, rather than list" % type(structure)) + # since only called by check_structure, structure is + # validated there + if index not in range(9): + # this is the index within the structure, which is handed + # to us as a list + raise NonsenseIndex(index) + working_structure = [ node.copy() for node in structure ] + for ind in range(9): + # checks if value is legitimate + if ind != index: + working_structure[ind].scratch_value(value) + working_structure[index].set_final(value) + return all_possible([ node.choices for node in working_structure ]) + + +def uniq(list_): + return sorted(list(set(list_))) + + +def check_structure(structure): + # assumes the structure is cleaned + if len(structure) != 9: + WronglySpecifiedStructure("Structure of length %s." % len(structure)) + remaining = [ node.choices for node in structure + if len(node.choices) > 1 ] + if remaining == []: + return (False, 0) + values = uniq(reduce(operator.add, remaining)) + for value in values: + for i in range(9): + if value in structure[i].choices: + # may need to actually use the hypo, but for now + # just being empty or not is our criterion + if hypothetical_setval(structure, i, value) == []: + structure[i].scratch_value(value) + return (True, i) + return (False, 0) + +############################# +########## Objects ########## +############################# + +class Node(object): + """Represents a node in the sudoku grid""" + def __init__(self, value=None): + if value in range(1, 10): + self.choices = [ value ] + else: + # Notice this doesn't throw an error for bad values + self.choices = range(1, 10) + self.row = None + self.column = None + self.subgrid = None + self.final = False + + def __repr__(self): + return '<%s: %s>' % (self.__class__.__name__, self.choices) + + def scratch_value(self, value): + if value not in range(1, 10): + raise NonsenseSudokuValue(value) + elif value in self.choices: + self.choices.remove(value) + + def set_final(self, value): + if value not in self.choices: + raise NonsenseSudokuValue("Choice %s already removed." % value) + self.choices = [value] + self.final = True + + def set_value(self, attr, value): + if value not in range(1, 10): + raise NonsenseSudokuValue(value) + setattr(self, attr, value) + + def set_row(self, row): + self.set_value('row', row) + + def set_column(self, column): + self.set_value('column', column) + + def set_subgrid(self): + if self.row in range(1, 10) and self.column in range(1, 10): + row_contrib = (self.row - 1)/3 # integer division intended + column_contrib = (self.column - 1)/3 # integer division intended + self.set_value('subgrid', 3*row_contrib + column_contrib + 1) + # Doesn't fail when they aren't specified + + def copy(self): + result = Node() + result.choices = self.choices[:] + result.row = self.row + result.column = self.column + result.subgrid = self.subgrid + return result + + +class Grid(object): + """Represents a sudoku grid""" + def __init__(self, board=''): + if board != '': + data = [ [int(entry) for entry in row if entry ] + for row in board.split("\n") if row ] + error = False + if len(data) != 9: + error = True + message = "Too few rows in file." + elif min([len(row) for row in data]) != 9: + error = True + message = "Too few entries in some row(s)." + elif max([len(row) for row in data]) != 9: + error = True + message = "Too many entries in some row(s)." + if error: + raise BadSudokuFileInput(message) + data = reduce(operator.add, data) + try: + data = [ int(entry) for entry in data ] + except ValueError: + raise BadSudokuFileInput("Data in file not all integers.") + if min(data) < 0 or max(data) > 9: + raise BadSudokuFileInput("Entries in file out of range.") + else: + data = [0] * 81 + + self.data = {} + for i in range(81): + entry = data[i] + if entry == 0: + to_add = Node() + else: + to_add = Node(entry) + to_add.set_row(i/9 + 1) # integer division intended + to_add.set_column(i % 9 + 1) + to_add.set_subgrid() # works based off of row and column + self.data[i+1] = to_add + + rows = {} + columns = {} + subgrids = {} + for i in range(1, 10): + rows[i] = False + columns[i] = False + subgrids[i] = False + self.checked = {'row': rows, 'column': columns, 'subgrid': subgrids} + + @property + def solved(self): + # reduce(operator.and_, [self.data[i].final for i in range(1, 82)]) + for i in range(1, 82): + if not self.data[i].final: + return False + return True + + @property + def pretty(self): + values = [] + # row + for i in range(9): + to_add = [] + # column + for j in range(9): + index = 9*i + j + 1 + to_add.append(", ".join([str(entry) for entry + in self.data[index].choices])) + values.append(to_add) + + column_widths = [ max([ len(values[row][col]) for row in range(9) ]) + for col in range(9) ] + horiz_bars = [ ('-' * width) for width in column_widths ] + result = [] + for i in range(9): + result.append(horiz_bars) + for j in range(9): + values[i][j] = values[i][j].center(column_widths[j]) + result.append(values[i]) + result.append(horiz_bars) + + result = "\n".join(["| " + " | ".join(row) + " | " for row in result]) + return result + + def declare_values(self, structure, indices, values): + for node_ind in indices: + if node_ind not in range(1, 82): + raise WronglySpecifiedNode(node_ind) + if len(indices) != len(values) or len(indices) == 0: + raise WronglySpecifiedValueDeclaration(indices) + elif len(indices) == 1: + raise WronglySpecifiedValueDeclaration( + "Use declare_value for single values.") + valid_nodes = [ self.data[index] for index in indices ] + for value in values: + if value not in range(1, 10): + raise NonsenseSudokuValue(value) + for node in valid_nodes: + if value not in node.choices: + raise WronglySpecifiedValueDeclaration( + "%s not in %s for declaration." % (value, node.choices)) + + structure_indices = get_indices(structure, + getattr(valid_nodes[0], structure)) + invalid_nodes = [ self.data[index] for index in structure_indices + if index not in indices ] + changed = False + for node in invalid_nodes: + for value in values: + if value in node.choices: + changed = True + node.scratch_value(value) + self.checked['row'][node.row] = False + self.checked['column'][node.column] = False + self.checked['subgrid'][node.subgrid] = False + for node in valid_nodes: + for choice in node.choices: + if choice not in values: + changed = True + node.scratch_value(choice) + self.checked['row'][node.row] = False + self.checked['column'][node.column] = False + self.checked['subgrid'][node.subgrid] = False + return changed + + def declare_value(self, node_ind, value): + if node_ind not in range(1, 82): + raise WronglySpecifiedNode(node_ind) + node = self.data[node_ind] + node.set_final(value) + + row_indices = get_indices('row', node.row) + col_indices = get_indices('column', node.column) + grid_indices = get_indices('subgrid', node.subgrid) + affected_nodes = [ self.data[index] for index in + set(row_indices + col_indices + grid_indices) + if index != node_ind ] + for affected in affected_nodes: + if value in affected.choices: + affected.scratch_value(value) + self.checked['row'][affected.row] = False + self.checked['column'][affected.column] = False + self.checked['subgrid'][affected.subgrid] = False + + def clean(self): + all_checked = False + + while not all_checked: + all_checked = True + for i, node in self.data.items(): + if len(node.choices) == 1 and not node.final: + self.declare_value(i, node.choices[0]) + all_checked = False + + def try_pick(self, structure, index): + # get indices will validate the data + value_indices = {} # The keys are the sudoku possible values + # and the values are the indices that contain those sudoku values + for ind in get_indices(structure, index): + node = self.data[ind] + if node.final: + continue + for choice in node.choices: + if choice in value_indices: + value_indices[choice].append(ind) + else: + value_indices[choice] = [ind] + + frequency_hash = {} + for key, value in value_indices.items(): + length = len(value) + if length in frequency_hash: + frequency_hash[length].append(key) + else: + frequency_hash[length] = [key] + + for frequency in sorted(frequency_hash): + if len(frequency_hash[frequency]) < frequency: + continue + for possible in subset(frequency_hash[frequency], frequency): + # ordered by nature in which value_indices is created + change = True + indices = value_indices[possible[0]] + for elt in possible[1:]: + if indices != value_indices[elt]: + change = False + if change: + if frequency == 1: + self.declare_value(indices[0], possible[0]) + return True + else: + if self.declare_values(structure, indices, possible): + return True + + return False + + def pick_all(self): + for structure in ('row', 'column', 'subgrid'): + for index in range(1, 10): + if self.try_pick(structure, index): + return + + raise CheckFoundNoImprovement + + # def try_pick(self, structure, index): + # # get indices will validate the data + # result = False + + # nodes = [ self.data[ind] for ind in get_indices(structure, index) ] + # values = reduce(operator.add, [ node.choices for node in nodes ]) + # for value in range(1, 10): + # if values.count(value) == 1: + # node = get_first_node(nodes, value) + # node_index = 9*(node.row - 1) + node.column + # if not node.final: + # self.declare_value(node_index, value) + # result = True + # return result + + # def pick_all(self): + # result = False + # for structure in ('row', 'column', 'subgrid'): + # for index in range(1, 10): + # if self.try_pick(structure, index): + # result = True + # return result + + def check(self, structure, index): + # get indices will validate the data + nodes = [ self.data[ind] for ind in get_indices(structure, index) ] + bool_, changed_index = check_structure(nodes) + if bool_: + node = nodes[changed_index] + self.checked['row'][node.row] = False + self.checked['column'][node.column] = False + self.checked['subgrid'][node.subgrid] = False + else: + self.checked[structure][index] = True + return bool_ + + def check_all(self): + """ + Checks all unchecked rows in order, then columns, then subgrids + + Terminates the check once a structure is changed so we can clean + """ + for structure in ('row', 'column', 'subgrid'): + checked_dict = self.checked[structure] + for index in range(1, 10): + if not checked_dict[index]: + if self.check(structure, index): + return + + raise CheckFoundNoImprovement + + # def solve(self): + # while not self.solved: + # self.clean() + # if not self.solved: + # self.check_all() + # print self.pretty + + def solve(self): + count = 1 + while not self.solved: + count += 1 + self.clean() + if not self.solved: + try: + count += 1 + self.check_all() + except CheckFoundNoImprovement: + count += 1 + self.pick_all() + # Will raise CheckFoundNoImprovement if fails + # return self + return count + + + def __repr__(self): + return '<%s: %s>' % (self.__class__.__name__, 'Sudoku') + +def get_corner_sum(board): + puzzle = Grid(board) + puzzle.solve() + return (100*puzzle.data[1].choices[0] + \ + 10*puzzle.data[2].choices[0] + \ + puzzle.data[3].choices[0]) + +puzzles = get_data(96).split("\r\n") +# with open('../../problem_data/no096.txt','r') as fh: +# puzzles = fh.read().split("\r\n") + +# count = 0 +# for puzzle in range(50): +# if puzzle not in [5, 6, 41, 47]: +# board = '\n'.join(puzzles[10*puzzle + 1:10*(puzzle + 1)]) +# count += get_corner_sum(board) +print 23138+176+143+384+861 diff --git a/python_code/complete/no098.py b/python_code/complete/no098.py new file mode 100644 index 0000000..5df0e4e --- /dev/null +++ b/python_code/complete/no098.py @@ -0,0 +1,66 @@ +from math import sqrt + +from python_code.functions import get_data +from python_code.functions import all_subsets + +def same_signature(n, word): + digits = [dig for dig in str(n)] + dig_set = set(digits) + letter_set = set(word) + if len(dig_set) != len(letter_set): + return (False, None) + + first_found = [word.find(letter) for letter in letter_set] + translated = word + for index in first_found: + translated = translated.replace(word[index], digits[index]) + + if translated == str(n): + return (True, [(word[index], digits[index]) for index + in first_found]) + else: + return (False, None) + +data = get_data(98)[1:-1].split('","') + +words = {} +for word in data: + length = len(word) + if length in words: + words[length].append(word) + else: + words[length] = [word] + +max_len = int(sqrt(10)**max(words)) +squares = {} +for i in range(1, max_len): + square = i**2 + length = len(str(square)) + if length in squares: + squares[length].append(square) + else: + squares[length] = [square] + +max_val = 0 +for word_length in sorted(words.keys())[::-1]: + total_words = len(words[word_length]) + for first in range(total_words - 1): + for second in range(first + 1, total_words): + first_word = words[word_length][first] + second_word = words[word_length][second] + # check anagrams + if sorted(first_word) == sorted(second_word): + for square in squares[word_length]: + val, translation = same_signature(square, first_word) + if val: + translated = second_word + for letter, digit in translation: + translated = translated.replace(letter, digit) + new_number = int(translated) + if new_number in squares[word_length]: + to_add = max(square, new_number) + if to_add > max_val: + max_val = to_add + if max_val > 0: + break +print max_val diff --git a/python_code/complete/no099.py b/python_code/complete/no099.py new file mode 100644 index 0000000..71ebda5 --- /dev/null +++ b/python_code/complete/no099.py @@ -0,0 +1,15 @@ +from math import log + +from python_code.functions import get_data + +data = [row.split(",") for row in get_data(99).split("\n") if row] + +max_val = -1 +winner = None +for i, row in enumerate(data): + log_val = int(row[1])*log(int(row[0])) + if log_val > max_val: + max_val = log_val + winner = i + +print winner + 1 # account for 0 vs. 1 initial index diff --git a/python_code/complete/no100.py b/python_code/complete/no100.py new file mode 100755 index 0000000..11eff3a --- /dev/null +++ b/python_code/complete/no100.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python + +# If a box contains twenty-one coloured discs, composed of fifteen blue +# discs and six red discs, and two discs were taken at random, it can be +# seen that the probability of taking two blue discs, +# P(BB) = (15/21)(14/20) = 1/2. + +# The next such arrangement, for which there is exactly 50% chance of taking +# two blue discs at random, is a box containing eighty-five blue discs and +# thirty-five red discs. + +# By finding the first arrangement to contain over 10**12 = 1,000,000,000,000 +# discs in total, determine the number of blue discs that the box +# would contain. + +# (b(b-1))/(T(T-1)) = (1/2) <==> 2(4b**2 - 4b) = 4T**2 - 4T +# <==> 2(2*b - 1)**2 - (2*T - 1)**2 = 1 +# One can verify 2*x**2 - y**2 = 1 implies that x and y must be odd +# so all solutions of this are desired by us + +from math import sqrt + +from python_code.conway_topograph import all_values_on_form +from python_code.conway_topograph import get_recurrence +from python_code.conway_topograph import start_to_series +from python_code.decorators import euler_timer +from python_code.functions import recurrence_next + +@euler_timer(100) +def main(): + # y = 2T - 1, T > 10**12 implies the following: + LOWER_LIMIT = 2*(10**12) - 1 + + # We seek 2x^2 - y^2 = 1 + x_mult, y_mult, relation = get_recurrence([2, -1]) + starting_points = all_values_on_form([2, -1], 1) + series = [start_to_series(initial, y_mult, 'y') + for initial in starting_points] + result = [pair[0] for pair in series] + while max(result) <= LOWER_LIMIT: + result.extend([pair[1] for pair in series]) + series = [recurrence_next(relation, values) for values in series] + + min_y = min([y for y in result if y > LOWER_LIMIT]) + min_x = sqrt((1 + y**2)/2) + print int((min_x + 1)/2) + +if __name__ == "__main__": + main() diff --git a/python_code/complete/no104.py b/python_code/complete/no104.py new file mode 100644 index 0000000..004df5a --- /dev/null +++ b/python_code/complete/no104.py @@ -0,0 +1,33 @@ +from math import exp +from math import floor +from math import log +from math import sqrt + +from python_code.functions import fibonacci_generator + +def is_1_9_pandigital(n): + digs = [int(dig) for dig in str(n)] + if len(digs) != 9: + return False + return sorted(digs) == range(1, 10) + +def log_fib(n): + root_plus = 0.5*(1 + sqrt(5)) + root_ratio = 0.5*(sqrt(5) - 3) + return n*log(root_plus) - 0.5*log(5) + log(1 - root_ratio**n) + +# 10**(d - 1) <= N < 10**d +# d <= log(N)/log(10) + 1 < d + 1 +k = 2 +a, b = 1, 1 +while True: + if is_1_9_pandigital(b): + log_val = log_fib(k) + digits = int(floor(log_val/log(10) + 1)) + log_last_9 = log_val - (digits - 9)*log(10) + last_9 = int(floor(exp(log_last_9))) + if is_1_9_pandigital(last_9): + break + a, b = b, (a + b) % (10**9) + k += 1 +print k diff --git a/python_code/complete/no107.py b/python_code/complete/no107.py new file mode 100644 index 0000000..bdb1dbe --- /dev/null +++ b/python_code/complete/no107.py @@ -0,0 +1,40 @@ +from python_code.functions import get_data + +data = [row.split(',') for row in get_data(107).split('\r\n') if row] + +adjacency = {} +size = len(data) +network_sum = 0 +# UNDIRECTED +for node in range(size - 1): + for dest in range(node + 1, size): + if data[node][dest] != '-': + value = int(data[node][dest]) + network_sum += value + if node in adjacency: + adjacency[node].append((dest, value)) + else: + adjacency[node] = [(dest, value)] + if dest in adjacency: + adjacency[dest].append((node, value)) + else: + adjacency[dest] = [(node, value)] + +# PRIMs ALGO +# arbitrarily start at vertex 0 +vertices = [0] +edges = [] +min_sum = 0 +while set(vertices) != set(range(size)): + # Find next edge + candidates = {} + for vertex in vertices: + for node in adjacency[vertex]: + if node[0] not in vertices: + candidates[(vertex, node[0])] = node[1] + new_edge, val = sorted(candidates.items(), key=lambda pair: pair[1])[0] + min_sum += val + edges.append(new_edge) + vertices.append(new_edge[1]) + +print network_sum - min_sum diff --git a/python_code/complete/no108.py b/python_code/complete/no108.py new file mode 100644 index 0000000..890ab5c --- /dev/null +++ b/python_code/complete/no108.py @@ -0,0 +1,26 @@ +from math import floor +from math import log + +from python_code.functions import prime_factors +from python_code.functions import sieve + +prime_factors_hash = {} +n = 4 +solutions = 3 +while solutions < 2000: + n += 1 + factors = prime_factors(n, unique=False, hash_=prime_factors_hash) + solutions = 1 + curr_prime = factors[0] + count = 1 + for prime in factors[1:]: + if prime == curr_prime: + count += 1 + else: + solutions = solutions*(2*count + 1) + curr_prime = prime + count = 1 + solutions = solutions*(2*count + 1) + print n, solutions + +print n diff --git a/python_code/complete/no110.py b/python_code/complete/no110.py new file mode 100644 index 0000000..f3374e2 --- /dev/null +++ b/python_code/complete/no110.py @@ -0,0 +1,33 @@ +from math import floor +from math import log + +from python_code.functions import prime_factors +from python_code.functions import sieve + +prime_factors_hash = {} + +# P^k < 10*7 (10 mil) +thr = [3**exp for exp in range(int(floor(7*log(10)/log(3))) + 1)] +fiv = [5**exp for exp in range(int(floor(7*log(10)/log(5))) + 1)] +sev = [7**exp for exp in range(int(floor(7*log(10)/log(7))) + 1)] +products = [] +for f1 in thr: + for f2 in fiv: + for f3 in sev: + products.append(f1*f2*f3) +products = [xx for xx in sorted(products) if xx >= 8*(10**6)][:20] + +PRIMES = sieve(100) + +max_prod = 10**21 +res = [] +for product in products: + factors = prime_factors(product, unique=False, hash_=prime_factors_hash) + factors = [(factor - 1)/2 for factor in factors][::-1] + curr_prod = 1 + for i, exp in enumerate(factors): + curr_prod = curr_prod*(PRIMES[i]**exp) + + if curr_prod < max_prod: + max_prod = curr_prod +print max_prod diff --git a/python_code/complete/no112.py b/python_code/complete/no112.py new file mode 100644 index 0000000..4d8ddfa --- /dev/null +++ b/python_code/complete/no112.py @@ -0,0 +1,16 @@ +def inc_or_dec(n): + digs = [dig for dig in str(n)] + if sorted(digs) == digs: + return True + elif sorted(digs) == digs[::-1]: + return True + else: + return False + +n = 21780 +B = 19602 # 90% +while 100*B != 99*n: + n += 1 + if not inc_or_dec(n): + B += 1 +print n diff --git a/python_code/complete/no113.py b/python_code/complete/no113.py new file mode 100644 index 0000000..c84ea12 --- /dev/null +++ b/python_code/complete/no113.py @@ -0,0 +1,7 @@ +from math import factorial + +def choose(n, k): + return factorial(n)/(factorial(k)*factorial(n - k)) + +n=100 +print choose(n+10,10) + choose(n+9,9) - 10*n - 2 diff --git a/python_code/complete/no114.py b/python_code/complete/no114.py new file mode 100644 index 0000000..6928320 --- /dev/null +++ b/python_code/complete/no114.py @@ -0,0 +1,54 @@ +# the black are insignificant +# with k blocks, we simply can remove k - 1 blocks (dividers) +# and reconsider the problem + +# We need k blocks to sum to less than or equal to 50 - (k-1) +# and can then fill the rest in with black blocks + +# 0 <= sum(a_k - 3) <= 50 - 3k - (k - 1) = 51 - 4k + +from math import factorial +import operator + +def total_perms(o_list): + counts = [] + curr_entry = o_list[0] + curr_count = 1 + for entry in o_list[1:]: + if entry == curr_entry: + curr_count += 1 + else: + counts.append(curr_count) + curr_entry = entry + curr_count = 1 + counts.append(curr_count) + return factorial(sum(counts))/reduce(operator.mul, [factorial(count) for count in counts]) + +def ascending(num, num_sum, min_num, prob_max): + if num_sum < min_num: + return [] + if num == 1: + if num_sum == min_num: + return [[num_sum]] + else: + return [] + + next_sum = num_sum - min_num + biggest = next_sum/(num - 1) # integer division intended + biggest = min(biggest, prob_max) + result = [] + for next_min in range(min_num, biggest + 1): + result.extend([[min_num] + cand for cand in + ascending(num - 1, next_sum, next_min, prob_max)]) + return result + +count = 1 +MAX_k = 51/4 +for k in range(1, MAX_k + 1): + for sum_ai in range(3*k, 51 - k + 1): + perm_count = 0 + for bottom in range(3, sum_ai/k + 1): + for gp_ai in ascending(k, sum_ai, bottom, 50 + 1): + perm_count += total_perms(gp_ai) + count += perm_count*(factorial(51 - sum_ai)/(factorial(k)*factorial(51 - sum_ai - k))) +print count diff --git a/python_code/complete/no115.py b/python_code/complete/no115.py new file mode 100644 index 0000000..906062a --- /dev/null +++ b/python_code/complete/no115.py @@ -0,0 +1,53 @@ +from math import factorial +import operator + +def total_perms(o_list): + counts = [] + curr_entry = o_list[0] + curr_count = 1 + for entry in o_list[1:]: + if entry == curr_entry: + curr_count += 1 + else: + counts.append(curr_count) + curr_entry = entry + curr_count = 1 + counts.append(curr_count) + return factorial(sum(counts))/reduce(operator.mul, [factorial(count) for count in counts]) + +def ascending(num, num_sum, min_num, prob_max): + if num_sum < min_num: + return [] + if num == 1: + if num_sum == min_num: + return [[num_sum]] + else: + return [] + + next_sum = num_sum - min_num + biggest = next_sum/(num - 1) # integer division intended + biggest = min(biggest, prob_max) + result = [] + for next_min in range(min_num, biggest + 1): + result.extend([[min_num] + cand for cand in + ascending(num - 1, next_sum, next_min, prob_max)]) + return result + +def F(m, n): + count = 1 + MAX_k = (n + 1)/(m + 1) + for k in range(1, MAX_k + 1): + for sum_ai in range(m*k, n + 1 - k + 1): + perm_count = 0 + for bottom in range(m, sum_ai/k + 1): + for gp_ai in ascending(k, sum_ai, bottom, n + 1): + perm_count += total_perms(gp_ai) + count += perm_count*(factorial(n + 1 - sum_ai)/(factorial(k)*factorial(n + 1 - sum_ai - k))) + return count + +fill_count = 2 +n = 50 +while fill_count <= 10**6: + n += 1 + fill_count = F(50, n) +print n diff --git a/python_code/complete/no122.py b/python_code/complete/no122.py new file mode 100644 index 0000000..f6a7ec9 --- /dev/null +++ b/python_code/complete/no122.py @@ -0,0 +1,66 @@ +def next_possible(chain): + candidates = [] + for i in range(len(chain)): + for j in range(i, len(chain)): + candidates.append(chain[i] + chain[j]) + return [cand for cand in sorted(candidates) if cand > max(chain)] + +def find_min_brauers(n): + result = {1: [1], 2: [1, 2]} + + chains = [[1,2]] + # while len(result) < n: + while max(result) < n: + new_chains = [] + for chain in chains: + candidates = next_possible(chain) + for candidate in candidates: + if candidate not in result and candidate <= n: + result[candidate] = chain + [candidate] + new_chains.extend([chain + [cand] for cand in candidates]) + chains = new_chains + + return result + +MAX_n = 200 +brauers = find_min_brauers(MAX_n) + +missing = [i for i in range(1, MAX_n + 1) if i not in brauers] +m_vals = {127: [1, 2, 3, 4, 7, 8, 15, 30, 60, 67, 127], + 139: [1, 2, 3, 4, 7, 10, 17, 34, 68, 71, 139], + 141: [1, 2, 3, 4, 7, 10, 20, 27, 47, 94, 141], + 142: [1, 2, 3, 4, 7, 8, 16, 32, 39, 71, 142], + 143: [1, 2, 3, 4, 7, 10, 17, 34, 68, 75, 143], + 151: [1, 2, 3, 4, 7, 9, 18, 36, 72, 79, 151], + 155: [1, 2, 3, 4, 7, 11, 18, 36, 72, 83, 155], + 157: [1, 2, 3, 5, 7, 12, 19, 38, 76, 81, 157], + 158: [1, 2, 3, 4, 7, 9, 18, 36, 43, 79, 158], + 159: [1, 2, 3, 4, 8, 16, 19, 35, 70, 89, 159], + 167: [1, 2, 3, 4, 7, 10, 20, 40, 80, 87, 167], + 169: [1, 2, 3, 4, 7, 14, 21, 42, 84, 85, 169], + 171: [1, 2, 3, 4, 7, 14, 21, 42, 84, 87, 171], + 173: [1, 2, 3, 5, 7, 14, 21, 42, 84, 89, 173], + 174: [1, 2, 3, 4, 7, 10, 20, 40, 47, 87, 174], + 175: [1, 2, 3, 4, 7, 14, 21, 35, 70, 105, 175], + 177: [1, 2, 3, 4, 7, 11, 22, 44, 88, 89, 177], + 178: [1, 2, 3, 4, 7, 11, 22, 44, 45, 89, 178], + 179: [1, 2, 3, 4, 7, 11, 22, 44, 88, 91, 179], + 181: [1, 2, 3, 5, 6, 11, 22, 44, 88, 93, 181], + 182: [1, 2, 3, 4, 7, 11, 22, 44, 47, 91, 182], + 183: [1, 2, 3, 4, 7, 11, 22, 44, 88, 95, 183], + 185: [1, 2, 3, 5, 8, 16, 21, 37, 74, 111, 185], + 186: [1, 2, 3, 4, 7, 14, 17, 31, 62, 93, 186], + 187: [1, 2, 3, 4, 7, 11, 22, 44, 88, 99, 187], + 188: [1, 2, 3, 4, 7, 10, 20, 27, 47, 94, 188], + 189: [1, 2, 3, 4, 7, 14, 21, 42, 63, 126, 189], + 190: [1, 2, 3, 4, 7, 11, 22, 44, 51, 95, 190], + 191: [1, 2, 3, 4, 7, 8, 15, 22, 44, 88, 103, 191], + 197: [1, 2, 3, 5, 6, 12, 24, 48, 96, 101, 197], + 199: [1, 2, 3, 5, 7, 12, 24, 48, 96, 103, 199]} +if sorted(missing) != sorted(m_vals.keys()): + raise Exception("BAD") + +for value in m_vals: + brauers[value] = m_vals[value][:] + +print sum([len(value) - 1 for value in brauers.values()]) diff --git a/python_code/complete/no122_v2.py b/python_code/complete/no122_v2.py new file mode 100644 index 0000000..33e7243 --- /dev/null +++ b/python_code/complete/no122_v2.py @@ -0,0 +1,20 @@ +D=[[[1]]] +s=0 +for k in range(2, 201): + A=[] + for t in D: + for v in t: + for a in v: + b = k - a + if b >= a and b in v: + to_add = v[:] + [k] + if to_add not in A: + A.append(to_add) + m = min(len(a) for a in A) + D.append([]) + for a in A: + if len(a) == m: + D[-1].append(a) + s += m-1 + +print s diff --git a/python_code/complete/no122_v3.py b/python_code/complete/no122_v3.py new file mode 100644 index 0000000..4d57637 --- /dev/null +++ b/python_code/complete/no122_v3.py @@ -0,0 +1,12 @@ +lim = 200 + +best = [None, [set([1])]] +for exp in range(2, lim + 1): + facts = [] + for f1 in xrange(1, exp / 2 + 1): + for constr in best[exp - f1]: + if f1 in constr: facts.append(constr.union([exp])) + bestlen = min(len(fact) for fact in facts) + best.append([fact for fact in facts if len(fact) == bestlen]) + +print sum(len(b[0]) - 1 for b in best[1:]) diff --git a/python_code/complete/no131.py b/python_code/complete/no131.py new file mode 100644 index 0000000..261c817 --- /dev/null +++ b/python_code/complete/no131.py @@ -0,0 +1,39 @@ +from math import sqrt + +from python_code.functions import sieve + +# We have (n**2)*(n + p) = m**3, we first show p does not divide n or m +# If p | m, then n != 0 mod p, implies LHS != 0, RAA ==> p | n +# But p | n means n = kp, (k**2)*(p**2)*p*(k + 1) = m**3 +# hence k**3 + k**2 = (m/p)**3, but +# k**3 < k**3 + k**2 < k**3 + 3*(k**2) + 3*k + 1 = (k + 1)**3 +# so this is impossible + +# With this, let a prime q divide m**3 (hence m) +# We know q | n**2 or q | (n + p) or both since Z_q is a domain +# But q | n**2 ==> n == 0 mod q ==> n + p == p != 0 mod q; +# since by the above q | m, means q != p +# Thus all factors of q must divide n**2. Since q | m**3 and q +# prime we must have q**(3*k) | m**3 for some value of k, +# forcing q**(3*k) | n**2. +# Similarly, q | n + p ==> n == -p != 0 mod q, and the same argument +# implies q**(3*k) | n + p. +# This n + p must be composed of cubic prime powers dividing m**3, +# and similarly for n**2. Since (2, 3) = 1, this forces n to be a cube +# and makes p = (n + p) - n a difference of cubes + +# Since p = r**3 - s**3 = (r - s)*(r**2 + r*s + s**2) +# p | r - s, implies r - s = 1 or p, but r - s = p, clearly won't work +# hence r = s + 1 +# Given a problem max M, we just go up to the biggest L such that +# (L + 1)**3 - L**3 <= M, forcing 6*L + 3 <= sqrt(12*M - 3) + +problem_max = 10**6 +count = 0 +PRIMES = sieve(problem_max) +max_L = int(round((sqrt(12*problem_max - 3) - 3)/6)) +for L in range(1, max_L + 1): + difference = (L + 1)**3 - L**3 + if difference in PRIMES: + count += 1 +print count diff --git a/python_code/complete/no132.py b/python_code/complete/no132.py new file mode 100644 index 0000000..0c8078d --- /dev/null +++ b/python_code/complete/no132.py @@ -0,0 +1,29 @@ +# Forum says 453377 is too big +from python_code.functions import robust_divide +from python_code.functions import sieve + +def is_valid(prime): + _, count_2 = robust_divide(prime - 1, 2, include_count=True) + count_2 = min(9, count_2) + _, count_5 = robust_divide(prime - 1, 5, include_count=True) + count_5 = min(9, count_5) + if prime == (2**count_2)*(5**count_5) + 1: + return True + possible_exp = sorted([(2**exp2)*(5**exp5) + for exp2 in range(0, count_2 + 1) + for exp5 in range(0, count_5 + 1)]) + for exp in possible_exp: + if (10**exp - 1) % prime == 0: + return True + return False + +PRIMES = sieve(453377) +prime_index = 3 # 2, 3, and 5 are false positives +matches = [] +while len(matches) < 40: + prime = PRIMES[prime_index] + if is_valid(prime): + matches.append(prime) + prime_index += 1 + +print sum(matches) diff --git a/python_code/complete/no133.py b/python_code/complete/no133.py new file mode 100644 index 0000000..70e5bb1 --- /dev/null +++ b/python_code/complete/no133.py @@ -0,0 +1,25 @@ +# Forum says 453377 is too big +from python_code.functions import robust_divide +from python_code.functions import sieve + +def is_valid(prime): + if prime in [2, 3, 5]: + return False + _, count_2 = robust_divide(prime - 1, 2, include_count=True) + _, count_5 = robust_divide(prime - 1, 5, include_count=True) + if prime == (2**count_2)*(5**count_5) + 1: + return True + possible_exp = sorted([(2**exp2)*(5**exp5) + for exp2 in range(0, count_2 + 1) + for exp5 in range(0, count_5 + 1)]) + for exp in possible_exp: + if (10**exp - 1) % prime == 0: + return True + return False + +PRIMES = sieve(10**5) +running_sum = 0 +for prime in PRIMES: + if not is_valid(prime): + running_sum += prime +print running_sum diff --git a/python_code/complete/no134.py b/python_code/complete/no134.py new file mode 100644 index 0000000..a8a59e3 --- /dev/null +++ b/python_code/complete/no134.py @@ -0,0 +1,30 @@ +from python_code.functions import prime_factors +from python_code.functions import sieve + +def extended_euclid(a, b): + M = max(a, b) + m = min(a, b) + + last = (M, [1, 0]) + curr = (m, [0, 1]) + while curr[0] > 1: + next = last[0] % curr[0] + factor = (last[0] - next)/curr[0] + last, curr = curr, (next, [last[1][0] - factor*curr[1][0], last[1][1] - factor*curr[1][1]]) + result = curr[1] + if a*result[0] + b*result[1] == 1: + return result + else: + return result[::-1] + +PRIMES = sieve(10**6 + 3) # 10**6 + 3 is the final value of p_2 + +running_sum = 0 +for index in range(2, len(PRIMES) - 1): + p_1 = PRIMES[index] + p_2 = PRIMES[index + 1] + _, ten_inverse = extended_euclid(p_2, 10) + digits = len(str(p_1)) + k = (ten_inverse**digits)*(p_2 - p_1) % p_2 + running_sum += int('%s%s' % (k, p_1)) +print running_sum diff --git a/python_code/complete/no145.py b/python_code/complete/no145.py new file mode 100644 index 0000000..14cad37 --- /dev/null +++ b/python_code/complete/no145.py @@ -0,0 +1,40 @@ +# leading and trailing zeroes are bad +def reverse(n): + return int(str(n)[::-1]) + +def all_odd(val): + return 0 not in [int(dig) % 2 for dig in str(val)] + +n = 10**3 +count = 0 +hash_ = {} +for i in range(1, n + 1): + if i % 10 != 0: + if i in hash_: + if hash_[i]: + count += 1 + else: + rev = reverse(i) + if all_odd(i + rev): + count += 1 + hash_[i] = True + hash_[rev] = True + else: + hash_[i] = False + hash_[rev] = False +print count + +matches = [key for key, value in hash_.items() if value] +match_h = {} +for val in matches: + length = len(str(val)) + if length in match_h: + match_h[length].append(val) + else: + match_h[length] = [val] + +a2 = [(x, reverse(x)) for x in match_h[2] if x <= reverse(x) ] +a3 = [(x, reverse(x)) for x in match_h[3] if x <= reverse(x) ] +# a4 = [(x, reverse(x)) for x in match_h[4] if x <= reverse(x) ] +# a6 = [(x, reverse(x)) for x in match_h[6] if x <= reverse(x) ] +# a7 = [(x, reverse(x)) for x in match_h[7] if x <= reverse(x) ] diff --git a/python_code/complete/no160.py b/python_code/complete/no160.py new file mode 100644 index 0000000..3ecaa7d --- /dev/null +++ b/python_code/complete/no160.py @@ -0,0 +1,82 @@ +from math import floor +from math import log + +from python_code.functions import robust_divide + +# f(9)=36288 +# f(10)=36288 +# f(20)=17664 + +def extended_euclid(a, b): + M = max(a, b) + m = min(a, b) + + last = (M, [1, 0]) + curr = (m, [0, 1]) + while curr[0] > 1: + next = last[0] % curr[0] + factor = (last[0] - next)/curr[0] + last, curr = curr, (next, [last[1][0] - factor*curr[1][0], last[1][1] - factor*curr[1][1]]) + result = curr[1] + if a*result[0] + b*result[1] == 1: + return result + else: + return result[::-1] + +def unit_a_zero_b(a, b): + _, multiplier = extended_euclid(a, b) + return (multiplier*b) % (a*b) + +def num_factors_fact(n, factor): + result = 0 + power = factor + while n >= power: + result += n/power + power = factor*power + return result + +def f(n): + if n < 8: + # The remaining part is always divisible by + # 2**5 for n > 7, these are special cases + solutions = {0: 1, + 1: 1, + 2: 2, + 3: 6, + 4: 24, + 5: 12, + 6: 72, + 7: 504} + return solutions[n] + + if n <= 5**5: + residues = {} + for i in range(1, n + 1): + to_add = robust_divide(i, 5) + if to_add in residues: + residues[robust_divide(i, 5)] += 1 + else: + residues[robust_divide(i, 5)] = 1 + else: + residues = {} + for residue in range(1, 5**5): + if residue % 5 != 0: + residues[residue] = (n - residue)/(5**5) + 1 + max_power = int(floor(log(n)/log(5))) + for power in range(1, max_power + 1): + biggest_quotient = n/(5**power) + for residue in range(1, 5**5): + if residue % 5 != 0: + residues[residue] += (biggest_quotient - residue)/(5**5) + 1 + + product = 1 + for residue, power in residues.items(): + power_apply = power % (4*(5**4)) # PHI(5**5) + product = (product*(residue**power_apply)) % (5**5) + fives = num_factors_fact(n, 5) % (4*(5**4)) # PHI(5**5) + inverse, _ = extended_euclid(2, 5**5) + product = (product*(inverse**fives)) % (5**5) + + return (product*unit_a_zero_b(5**5, 2**5)) % 10**5 + +print f(10**12) diff --git a/python_code/complete/no169.py b/python_code/complete/no169.py new file mode 100644 index 0000000..bfd94ea --- /dev/null +++ b/python_code/complete/no169.py @@ -0,0 +1,61 @@ +from math import floor +from math import log + +# 2(1 + 2 + ... + 2**(k - 2)) = 2**k - 2 < 2**k +# So 2**k <= n < 2**(k + 1) +# means we must end in one of +# 2**(k - 1), 2*(2**(k - 1)), 2**k, 2**(k - 1) + 2**k + +def f_helper2(n, max_power): + if n == 0: + return 1 + if max_power == 0: + if n in [1, 2]: + return 1 + else: + return 0 + + result = f_helper2(n, max_power - 1) + if n >= 2**max_power: + result += f_helper2(n - 2**max_power, max_power - 1) + if n >= 2**(max_power + 1): + result += f_helper2(n - 2**(max_power + 1), max_power - 1) + return result + +def f2(n): + max_power = int(floor(log(n)/log(2))) + return f_helper2(n, max_power) + +def f(n, hash_={}): + if n in hash_: + return hash_[n] + if n in [1, 2]: + hash_[n] = n + return n + if n % 2 == 0: + result = f(n/2) + f(n/2 - 1) + else: + result = f((n - 1)/2) + hash_[n] = result + return result + +f_hash = {} +print f(10**25, f_hash) + +# 10 3 +# 10 2 +# 10 1 +# 10 0 +# 8 0 +# 6 0 +# 6 1 +# 6 0 +# 4 0 +# 2 0 +# 2 1 +# 2 0 +# 0 0 +# 2 2 +# 2 1 +# 2 0 +# 0 0 diff --git a/python_code/complete/no204.py b/python_code/complete/no204.py new file mode 100644 index 0000000..bd12923 --- /dev/null +++ b/python_code/complete/no204.py @@ -0,0 +1,21 @@ +import operator +from itertools import product as i_product +from math import floor +from math import log + +from python_code.functions import sieve + +def hamming_type(max_n, primes): + # assumes primes is sorted + if primes == []: + return 1 + + count = 0 + prime = primes[0] + max_power = int(floor(log(max_n)/log(prime))) + for power in range(max_power + 1): + count += hamming_type(max_n/(prime**power), primes[1:]) + return count + +PRIMES = sieve(100) +print hamming_type(10**9, PRIMES) diff --git a/python_code/complete/no205.py b/python_code/complete/no205.py new file mode 100644 index 0000000..c0dfac9 --- /dev/null +++ b/python_code/complete/no205.py @@ -0,0 +1,61 @@ +from math import factorial +import operator + +def total_perms(o_list): + counts = [] + curr_entry = o_list[0] + curr_count = 1 + for entry in o_list[1:]: + if entry == curr_entry: + curr_count += 1 + else: + counts.append(curr_count) + curr_entry = entry + curr_count = 1 + counts.append(curr_count) + return factorial(sum(counts))/reduce(operator.mul, [factorial(count) for count in counts]) + +def ascending(num, num_sum, min_num, prob_max): + if num_sum < min_num: + return [] + if num == 1: + if num_sum == min_num: + return [[num_sum]] + else: + return [] + + next_sum = num_sum - min_num + biggest = next_sum/(num - 1) # integer division intended + biggest = min(biggest, prob_max) + result = [] + for next_min in range(min_num, biggest + 1): + result.extend([[min_num] + cand for cand in + ascending(num - 1, next_sum, next_min, prob_max)]) + return result + +OUTCOMES_4 = {} +for bottom in range(1, 4 + 1): + for dice_sum in range(1*9, 4*9 + 1): + for outcome in ascending(9, dice_sum, bottom, 4): + curr_sum = sum(outcome) + if curr_sum in OUTCOMES_4: + OUTCOMES_4[curr_sum] += total_perms(outcome) + else: + OUTCOMES_4[curr_sum] = total_perms(outcome) + +OUTCOMES_6 = {} +for bottom in range(1, 6 + 1): + for dice_sum in range(1*6, 6*6 + 1): + for outcome in ascending(6, dice_sum, bottom, 6): + curr_sum = sum(outcome) + if curr_sum in OUTCOMES_6: + OUTCOMES_6[curr_sum] += total_perms(outcome) + else: + OUTCOMES_6[curr_sum] = total_perms(outcome) + +winning_outcomes = 0 +for pete_score in range(9, 36 + 1): + for colin_score in range(6, pete_score): + winning_outcomes += OUTCOMES_4[pete_score]*OUTCOMES_6[colin_score] + +print round(winning_outcomes*1.0/((4**9)*(6**6)), 7) diff --git a/python_code/complete/no206 b/python_code/complete/no206 new file mode 100755 index 0000000..dfe9a0b --- /dev/null +++ b/python_code/complete/no206 @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +# Find the unique positive integer whose square has the form 1_2_3_4_5_6_7_8_9_0, +# where each "_" is a single digit. + +# Since n**2 % 10 == 0, we know n = 10**k, hence +# 1_2_3_4_5_6_7_8_9 = k**2 +# 10203040506070809 <= k**2 <= 19293949596979899 +# 101010101 <= k <= 138902662 + +from python_code.decorators import euler_timer + +@euler_timer(206) +def main(): + for n in xrange(101010101, 138902662 + 1): + if n % 250 in [43, 53, 83, 167, 197, 207]: + val = n**2 + if str(val)[::2] == '123456789': + print 10*n + break + +if __name__ == "__main__": + main() diff --git a/python_code/complete/no207.py b/python_code/complete/no207.py new file mode 100644 index 0000000..5b23589 --- /dev/null +++ b/python_code/complete/no207.py @@ -0,0 +1,15 @@ +from math import log + +L = 1 +while 12345*L + 1 >= 2**L: + L += 1 + +count = 1 +for n in range(2, 2**L): + power = int(log(n + 1)/log(2)) + if n + 1 == 2**power: + count += 1 + if 12345*count < n: + break + +print n*(n + 1) diff --git a/python_code/complete/no215.py b/python_code/complete/no215.py new file mode 100644 index 0000000..f786c08 --- /dev/null +++ b/python_code/complete/no215.py @@ -0,0 +1,67 @@ +def special_perms(num_2, num_3): + if num_3 == 0: + return [[2]*num_2] + elif num_2 == 0: + return [[3]*num_3] + + result = [[2] + perm for perm in special_perms(num_2 - 1, num_3)] + \ + [[3] + perm for perm in special_perms(num_2, num_3 - 1)] + return result + +def cumulative_sum(list_): + result = [list_[0]] + for entry in list_[1:]: + result.append(result[-1] + entry) + return result + +def valid_arrange(depth, acceptable): + if depth < 1: + raise Exception("DUMB INPUT") + elif depth == 1: + return [[key] for key in acceptable] + + result = [] + for arrange in valid_arrange(depth - 1, acceptable): + last = arrange[-1] + result.extend([arrange + [next] for next in acceptable[last]]) + return result + +# 2x + 3y = 32 +# implies y = 2y*, x = 16 - 3y* for 0 <= y* <= 5 + +break_rows = [] +for y_star in range(5 + 1): + x = 16 - 3*y_star + y = 2*y_star + for perm in special_perms(x, y): + to_add = cumulative_sum(perm) + if to_add[-1] != 32: + raise ValueError("FIX IT") + break_rows.append(to_add[:-1]) + +acceptable_next = {} +for i, row in enumerate(break_rows): + to_add = [] + for j, onto_row in enumerate(break_rows): + if set(row).intersection(onto_row) == set(): + to_add.append(j) + acceptable_next[i] = to_add + +num_blocks_ending = {} +for key in acceptable_next: + num_blocks_ending[key] = {1: 1} + +blocks = 1 +while blocks < 10: + blocks += 1 + for key, value in acceptable_next.items(): + for onto in value: + if blocks in num_blocks_ending[onto]: + num_blocks_ending[onto][blocks] += num_blocks_ending[key][blocks - 1] + else: + num_blocks_ending[onto][blocks] = num_blocks_ending[key][blocks - 1] + +result = 0 +for key in num_blocks_ending: + result += num_blocks_ending[key][10] +print result diff --git a/python_code/complete/no225 b/python_code/complete/no225 new file mode 100755 index 0000000..1491f98 --- /dev/null +++ b/python_code/complete/no225 @@ -0,0 +1,36 @@ +#!/usr/bin/env python + +from python_code.decorators import euler_timer +from python_code.functions import recurrence_next +# def recurrence_next(relation, values): + +def zero_absent(relation, initial_values, modulus): + initial = [value % modulus for value in initial_values] + curr = initial[:] + + if 0 in initial: + return False + + curr = [value % modulus for value in recurrence_next(relation, curr)] + while curr != initial: + if 0 in curr: + return False + curr = [value % modulus for value in recurrence_next(relation, curr)] + return True + +@euler_timer(225) +def main(): + relation = [1,1,1] + initial_values = [1,1,1] + NUMBER_SUCCESSES = 124 + + found = [27] + modulus = 29 + while len(found) < NUMBER_SUCCESSES: + if zero_absent(relation, initial_values, modulus): + found.append(modulus) + modulus += 2 + print found[NUMBER_SUCCESSES-1] + +if __name__ == "__main__": + main() diff --git a/python_code/complete/no240.py b/python_code/complete/no240.py new file mode 100644 index 0000000..6d43596 --- /dev/null +++ b/python_code/complete/no240.py @@ -0,0 +1,59 @@ +from math import factorial +import operator + +def total_perms(o_list): + counts = [] + curr_entry = o_list[0] + curr_count = 1 + for entry in o_list[1:]: + if entry == curr_entry: + curr_count += 1 + else: + counts.append(curr_count) + curr_entry = entry + curr_count = 1 + counts.append(curr_count) + return factorial(sum(counts))/reduce(operator.mul, [factorial(count) for count in counts]) + +def ascending(num, num_sum, min_num, prob_max): + if num_sum < min_num: + return [] + if num == 1: + if num_sum == min_num: + return [[num_sum]] + else: + return [] + + next_sum = num_sum - min_num + biggest = next_sum/(num - 1) # integer division intended + biggest = min(biggest, prob_max) + result = [] + for next_min in range(min_num, biggest + 1): + result.extend([[min_num] + cand for cand in + ascending(num - 1, next_sum, next_min, prob_max)]) + return result + +def generate_addons(num, smallest, biggest): + if num == 1: + return [[i] for i in range(smallest, biggest + 1)] + + result = [] + for i in range(smallest, biggest + 1): + result.extend([[i] + addon for addon in generate_addons(num-1, i, biggest)]) + return result + +MATCHES = [] +for bottom in range(1, 12 + 1): + MATCHES.extend(ascending(10, 70, bottom, 12)) + +add_ons = {} +for biggest in range(1, 8): + add_ons[biggest] = generate_addons(10, 1, biggest) + +count = 0 +for match in MATCHES: + bottom = match[0] + for addon in add_ons[bottom]: + curr = addon + match + count += total_perms(curr) +print count diff --git a/python_code/complete/no265 b/python_code/complete/no265 new file mode 100755 index 0000000..3b8b4a2 --- /dev/null +++ b/python_code/complete/no265 @@ -0,0 +1,75 @@ +#!/usr/bin/env python + +# 2**N binary digits can be placed in a circle so that all the N-digit +# clockwise subsequences are distinct. + +# For N=3, two such circular arrangements are possible, ignoring +# rotations: +# (0,0,0,1,0,1,1,1) and (0,0,0,1,1,1,0,1) + +# For the first arrangement, the 3-digit subsequences, in clockwise +# order, are: 000, 001, 010, 101, 011, 111, 110 and 100. + +# Each circular arrangement can be encoded as a number by concatenating +# the binary digits starting with the subsequence of all zeros as the +# most significant bits and proceeding clockwise. The two arrangements +# for N=3 are thus represented as 23 and 29: + +# 00010111_2 = 23 +# 00011101_2 = 29 + +# Calling S(N) the sum of the unique numeric representations, we can see +# that S(3) = 23 + 29 = 52. + +# Find S(5). + +########################### + +# Since 2**N and it is a circular arrangement, all 2**N, N digit binaries must be present +# Hence we start with [0]*N. Since it can only occur once we can actually pad it with +# ones on either side for [1] + [0]**N + [1] + +from python_code.decorators import euler_timer + +def binary_array_to_integer(array): + result = 0 + for val in array: + result = 2*result + val + return result + +def has_unique_subsequences(array, length): + values = [] + for i in range(len(array) - length + 1): + to_add = binary_array_to_integer(array[i:i + length]) + if to_add in values: + return False + values.append(to_add) + return True + +def add_value(array, length): + # may return [] + result = [array[:] + [new_val] for new_val in [0, 1] + if has_unique_subsequences(array[:] + [new_val], length)] + return result + +def all_valid_sequences(length): + sequences = [[1] + [0]*length + [1]] + while len(sequences[0]) < 2**length: + next_sequences = [] + for sequence in sequences: + next_sequences.extend(add_value(sequence, length)) + sequences = next_sequences[:] + # After this step, we want to make it cyclic, so we overload and check + sequences = [sequence + sequence[:length-1] for sequence in sequences] + sequences = [sequence[:2**length] for sequence in sequences + if has_unique_subsequences(sequence, length)] + # finally, we want to start at 0, but these all start at 1 + return [sequence[1:] + sequence[:1] for sequence in sequences] + +@euler_timer(265) +def main(): + sequences = all_valid_sequences(5) + print sum([binary_array_to_integer(sequence) for sequence in sequences]) + +if __name__ == "__main__": + main() diff --git a/python_code/complete/no271.py b/python_code/complete/no271.py new file mode 100644 index 0000000..09b060a --- /dev/null +++ b/python_code/complete/no271.py @@ -0,0 +1,76 @@ +from itertools import product as i_product +from python_code.functions import prime_factors + +def extended_euclid(a, b): + M = max(a, b) + m = min(a, b) + + last = (M, [1, 0]) + curr = (m, [0, 1]) + while curr[0] > 1: + next = last[0] % curr[0] + factor = (last[0] - next)/curr[0] + last, curr = curr, (next, [last[1][0] - factor*curr[1][0], last[1][1] - factor*curr[1][1]]) + result = curr[1] + if a*result[0] + b*result[1] == 1: + return result + else: + return result[::-1] + +def find_cube_roots(prime): + # Won't check, but assumes prime is prime + # in a prime field x^3 == 1 implies x == 1 or x^2 + x + 1 == 0 + # since a domain, the latter is satisfied if + # (2x + 1)**2 == -3 mod prime (so we handle 2 and 3 differently) + if prime in [2, 3]: + return [1] + + # The inverse of 2 is (prime + 1)/2 + # If L(q,p) is the legendre symbol, for p != 2 or 3 we know + # L(-3, p) = L(-1, p)*L(3, p) = (-1)**(floor((p+1)/6)+(p-1)/2) + if (-1)**((prime + 1)/6 + (prime - 1)/2) == -1: + return [1] + + for i in xrange(1, prime): + if (i**2 + 3) % prime == 0: + break + # So we know i and prime - i are the square roots of 3 + return sorted([1, ((prime + 1)*(i - 1)/2) % prime, ((prime + 1)*(prime - i - 1))/2 % prime]) + +product = 13082761331670030 +factors = prime_factors(product) + +candidate_lists = [] +for factor in factors: + candidate_lists.append([(factor, root) for root in find_cube_roots(factor)]) + +# result = [[]] +# for prime, solns in d.items(): +# curr = [] +# for ans in result: +# for soln in solns: +# curr.append([(prime, soln)] + ans) +# result = curr +result = list(i_product(*candidate_lists)) + +# P = product(factors) +# s (P/f_i) + r f_i = 1 +# Set e_i = s (P/f_i) +# Then e_i + 0 == 1 mod f_i +# and by definition e_i = s(0) mod f_j +# Then the solution will be (sum res_i*e_i) mod P + +coprime_units = {} +for factor in factors: + _, multiplier = extended_euclid(factor, product/factor) + coprime_units[factor] = multiplier*(product/factor) + +vals = [] +for pairing in result: + count = 0 + for prime, residue in pairing: + count += residue*coprime_units[prime] + count = count % product + vals.append(count) + +print sum(vals) - 1 # 1 is in there as (1,1,...,1) diff --git a/python_code/complete/no274.py b/python_code/complete/no274.py new file mode 100644 index 0000000..a577449 --- /dev/null +++ b/python_code/complete/no274.py @@ -0,0 +1,26 @@ +from python_code.functions import sieve + +def extended_euclid(a, b): + M = max(a, b) + m = min(a, b) + + last = (M, [1, 0]) + curr = (m, [0, 1]) + while curr[0] > 1: + next = last[0] % curr[0] + factor = (last[0] - next)/curr[0] + last, curr = curr, (next, [last[1][0] - factor*curr[1][0], last[1][1] - factor*curr[1][1]]) + result = curr[1] + if a*result[0] + b*result[1] == 1: + return result + else: + return result[::-1] + +PRIMES = sieve(10**7) +running_sum = 0 +for prime in PRIMES: + if prime not in [2, 5]: + _, m = extended_euclid(prime, 10) + m = m % prime + running_sum += m +print running_sum diff --git a/python_code/complete/no277.py b/python_code/complete/no277.py new file mode 100644 index 0000000..41666eb --- /dev/null +++ b/python_code/complete/no277.py @@ -0,0 +1,21 @@ +def sequence(letters, p_3, c, P_2): + if letters == '': + return p_3, c, P_2 + + to_apply = letters[-1] + if to_apply == 'D': + return sequence(letters[:-1], p_3 + 1, 3*c, P_2) + elif to_apply == 'U': + return sequence(letters[:-1], p_3 + 1, 3*c - 2*P_2, 4*P_2) + elif to_apply == 'd': + return sequence(letters[:-1], p_3 + 1, 3*c + P_2, 2*P_2) + +p_3, c, P_2 = sequence('UDDDUdddDDUDDddDdDddDDUDDdUUDd', 0, 0, 1) +print ((10**15)*P_2 - c)/(1.0*(3**p_3)) +print "%sy == %s mod %s" % (3**p_3 % P_2, -c % P_2, P_2) +print "%sy == %s mod %s" % ((3**p_3 % P_2)/15, (-c % P_2)/15, P_2) +print "y == %s mod %s" % (((-c % P_2)/15 * 1886983) % P_2, P_2) +bottom = (((10**15)*P_2 - c)/(3**p_3))/P_2 + 1 +y = P_2*bottom + ((-c % P_2)/15 * 1886983) % P_2 +print ((3**p_3)*y + c) % P_2, ((3**p_3)*y + c)/P_2 +print ((3**p_3)*y + c)/P_2 > 10**15 diff --git a/python_code/complete/no303.py b/python_code/complete/no303.py new file mode 100644 index 0000000..91a324f --- /dev/null +++ b/python_code/complete/no303.py @@ -0,0 +1,38 @@ +from itertools import product as i_product +from python_code.functions import prime_factors + +def find(n, value_list): + for value in value_list: + if value % n == 0: + return value + + digs = len(str(max(value_list))) + needed_residues = sorted(set([(-value) % n for value in value_list])) + + residue = (10**digs) % n + actual_list = [1, 2] + residue_form = [(residue*val) % n for val in actual_list] + while set(residue_form).intersection(needed_residues) == set(): + next = [] + for val in actual_list: + next.extend([10*val, 10*val + 1, 10*val + 2]) + actual_list = next + residue_form = [(residue*val) % n for val in actual_list] + + best_match = min([val for val in actual_list if (residue*val) % n in needed_residues]) + best_opposites = [val for val in value_list if val % n == (-(best_match*residue)) % n] + return (10**digs)*best_match + min(best_opposites) + +candidate_lists = [['0', '1', '2']]*12 + +values = list(i_product(*candidate_lists)) +values = [int(''.join(value)) for value in values][1:] + +running_sum = 0 +for n in range(1, 10000 + 1): + val = find(n, values) + if val is None: + print n + else: + running_sum += val/n +print running_sum diff --git a/python_code/complete/no323.py b/python_code/complete/no323.py new file mode 100644 index 0000000..c088a17 --- /dev/null +++ b/python_code/complete/no323.py @@ -0,0 +1,25 @@ +from math import factorial + +def choose(n, k): + return factorial(n)/(factorial(k)*factorial(n - k)) + +# The problem is a generalization of one when n = 32 +# Let E(N)_n = the expected value when the y_i, x_i +# have n bits. Then +# 2**n E(N)_n = sum_{k=0 to n} (n choose k) [E(N)_{n - k} + 1] +# 2**n E(N)_n = 2**n + sum_{k=0 to n} (n choose k) E(N)_{n - k} +# (2**n - 1) E(N)_n = 2**n + sum_{k=1 to n} (n choose k) E(N)_{n - k} + +# This is because of the 2**n outcomes for y_1, (n choose k) +# have k bits set to 1. In those situations, the expected time +# will be 1 + E(N)_{n - k} since the non-zero bits are static going +# forward, the problem reduces to the digits unset + +expected_hash = {0: 0} +for n in range(1, 32 + 1): + to_add = 2**n + for k in range(1, n + 1): + to_add += choose(n, k)*expected_hash[n - k] + expected_hash[n] = (to_add*1.0)/(2**n - 1) + +print round(expected_hash[32], 10) diff --git a/python_code/functions.py b/python_code/functions.py index 0325212..bc153cf 100644 --- a/python_code/functions.py +++ b/python_code/functions.py @@ -7,6 +7,9 @@ ##################### HELPER FUNCTIONS ##################### ############################################################ +def lcm(n, m): + return n*m/(gcd(n, m)) + # 8, 11, 13, 18, 22, 42, 54, 59, 67 def get_data(problem_number): """ @@ -145,7 +148,8 @@ def first_prime_divisor(n, prime_list=[]): # 3, 12, 47 def prime_factors(n, unique=False, hash_=None): if n == 1: - hash_[1] = [] + if type(hash_) == dict: + hash_[1] = [] return [] if type(hash_) == dict and n in hash_: return hash_[n] @@ -266,19 +270,40 @@ def sieve(n): ############################################################ # 26 -def order_mod_n(value, n): +def order_mod_n(value, n, hash_={}, prime_list=[]): + if n in hash_: + return hash_[n] + if gcd(value, n) != 1 or n == 1: raise ValueError("%s is not a unit modulo %s." % (value, n)) - base_residue = value % n - if base_residue < 0: - base_residue = base_residue + n - residue = base_residue - exponent = 1 - while residue != 1: - residue = (residue * base_residue) % n - exponent += 1 - return exponent + prime, _ = first_prime_divisor(n, prime_list) + quotient = robust_divide(n, prime) + if quotient == 1: + # at this point, n is not in the hash_ but must be a + # prime power + base_residue = value % n + if base_residue < 0: + base_residue = base_residue + n + + residue = base_residue + exponent = 1 + while residue != 1: + residue = (residue * base_residue) % n + exponent += 1 + hash_[n] = exponent + return exponent + + # Here, quotient > 1 + prime_power = n/quotient + prime_order = order_mod_n(value, prime_power, + hash_=hash_, + prime_list=prime_list) + quotient_order = order_mod_n(value, quotient, + hash_=hash_, + prime_list=prime_list) + hash_[n] = lcm(prime_order, quotient_order) + return hash_[n] # 48 def modular_exponentiate(n, exp, modulus): @@ -353,34 +378,26 @@ def apply_to_list(func, list_, non_match=False): return result # 35, 41, 68, 121 -def all_permutations(list_, duplicates=False): - if len(list_) == 1: - return [list_] - - result = [] - for element in list_: - curr = list_[:] - curr.remove(element) - to_add = [[element] + sub_list - for sub_list in all_permutations(curr, - duplicates=duplicates)] - if duplicates: - result.extend([sub_list for sub_list in to_add - if sub_list not in result]) - else: - result.extend(to_add) +def all_permutations(list_): + result = [ [] ] + for i in range(len(list_)): + extended = [] + for perm in result: + for position in range(i + 1): + extended.append(perm[:position] + [list_[i]] + perm[position:]) + result = extended return result # 35, 41 def all_permutations_digits(n): digs = [dig for dig in str(n)] - result = all_permutations(digs, duplicates=True) + result = all_permutations(digs) return [int("".join(perm)) for perm in result] # 49, 51, 60 def all_subsets(list_, size): if len(list_) < size: - raise("List too small.") + raise ValueError("List too small.") # Base case if size == 1: diff --git a/python_code/too_slow/no075 b/python_code/too_slow/no075 new file mode 100755 index 0000000..4cb182f --- /dev/null +++ b/python_code/too_slow/no075 @@ -0,0 +1,95 @@ +#!/usr/bin/env python + +# It turns out that 12 cm is the smallest length of wire that can be +# bent to form an integer sided right angle triangle in exactly one +# way, but there are many more examples. + +# 12 cm: (3,4,5) +# 24 cm: (6,8,10) +# 30 cm: (5,12,13) +# 36 cm: (9,12,15) +# 40 cm: (8,15,17) +# 48 cm: (12,16,20) + +# In contrast, some lengths of wire, like 20 cm, cannot be bent to form +# an integer sided right angle triangle, and other lengths allow more +# than one solution to be found; for example, using 120 cm it is possible +# to form exactly three different integer sided right angle triangles. + +# 120 cm: (30,40,50), (20,48,52), (24,45,51) + +# Given that L is the length of the wire, for how many values of L <= 1,500,000 +# can exactly one integer sided right angle triangle be formed? + +from fractions import gcd +from math import ceil +from math import floor +from math import sqrt + +from python_code.decorators import euler_timer +from python_code.functions import all_factors + +def triple(L, m, k): + """ + assumes L, m and k are well-formed + + Returns valid pythagorean triple + resulting from L, m and k + """ + n = L/(2*k*m) - m + a = k*(m**2 - n**2) + b = k*(2*m*n) + c = k*(m**2 + n**2) + if a + b + c != L: + raise ValueError("Incorrect input %s, %s, and %s" % (L, m, k)) + if a < b: + return (a, b, c) + elif b < a: + return (b, a, c) + else: + raise Exception("No integral right triangle can be isosceles") + +def diophantine_solutions(L, factor_hash, break_val=None): + if L % 2 == 1: + return set() + + result = set() + for k in factor_hash[L/2]: + # m(m + n) = L/(2k), m > n > 0 requires + # (L/4k) < m**2 < (L/2k) + lower_limit = sqrt(L/(4.0*k)) + if lower_limit == int(lower_limit): + lower_limit = int(lower_limit) + 1 + else: + lower_limit = int(ceil(lower_limit)) + upper_limit = sqrt(L/(2.0*k)) + if upper_limit == int(upper_limit): + upper_limit = int(upper_limit) - 1 + else: + upper_limit = int(floor(upper_limit)) + + choices_m = [val for val in factor_hash[L/(2*k)] + if lower_limit <= val <= upper_limit and + gcd(val, (L/(2*k*val) - val)) == 1] + result.update([triple(L, m, k) for m in choices_m]) + if break_val is not None: + if len(result) > break_val: + return result + return result + +@euler_timer(75) +def main(): + MAX_L = 1500000 + factor_hash = all_factors(MAX_L/2) + + count = 0 + for i in range(1, MAX_L/2 + 1): + L = 2*i + if len(diophantine_solutions(L, factor_hash, 1)) == 1: + count += 1 + print count + +if __name__ == "__main__": + print "The answer to Euler Project, question 75 is: 161667\n\n" \ + "This solution ran in 4.637E3 seconds.\n" \ + "Due to runtime, this is not actually running." diff --git a/python_code/too_slow/no129_1 b/python_code/too_slow/no129_1 new file mode 100755 index 0000000..c8ef342 --- /dev/null +++ b/python_code/too_slow/no129_1 @@ -0,0 +1,80 @@ +#!/usr/bin/env python + +# R(k) = (10^k - 1)/9 +# So the smallest k such that R(k) == 0 mod n is related to the order +# or the element 10 in the multiplicative group of units + +# if 3 does not divide n, then 3 (hence 9) is invertible, so +# R(k) == 0 iff 10^k - 1 == 0 iff 10^k == 1 mod n, giving +# us A(n) = order of 10 modulo n in those cases +# if 3 does divide n, then 9 is not invertible, so +# R(k) == 0 mod n iff 10^k - 1 == 0 mod (9n) giving +# us A(n) = order of 10 modulo (9n) in those cases + +# Since A(n) divides PHI(n) (or PHI(9n) when 3 | n), we +# know A(n) <= PHI(n) <= n - 1 < n ( < 9n when 3 | n) +# Thus in order for A(n) to exceed some value M, we need +# n > M unless n is divisible by 3 in which case we need +# 9n > M. So it suffices to begin our check for +# multiples of 3 which are coprime to 10 in the range +# M/9 < n <= M and then from there consider all +# values coprime to 10 + +# We can actually consider residues modulo 30 +# The only ones we care about are +# [1,3,5,7,11,13,17,19,21,23,27,29] +# of which [3,9,21,27] matter initially +# So we want k where M/9 < 30k + 27 <= M, after +# which we switch to a full set of residues mod 30 + +from math import ceil + +from python_code.decorators import euler_timer +from python_code.functions import order_mod_n +from python_code.functions import sieve + +@euler_timer(129) +def main(): + all_residues = [n for n in range(1, 30) + if n % 2 != 0 and n % 5 != 0] + three_residues = [n for n in range(1, 30) + if n % 2 != 0 and n % 5 != 0 and n % 3 == 0] + + + point_to_reach = 10**6 + max_prime_val = 2*10**6 + PRIMES = sieve(max_prime_val) + order_hash = {} + + k = int(ceil((point_to_reach - 243)/270.0)) + residues = three_residues + max_order = -1 + max_n = -1 + while max_order <= point_to_reach: + if 30*k + 27 > point_to_reach: + residues = all_residues + choices_n = [30*k + residue for residue in residues] + for n in choices_n: + if n > max_prime_val: + raise Exception("Reset PRIMES") + + basis = n + if n % 3 == 0: + basis = 9*n + + curr_order = order_mod_n(10, basis, + hash_=order_hash, + prime_list=PRIMES) + if curr_order > max_order: + max_order = curr_order + max_n = n + + if max_order > point_to_reach: + break + k += 1 + print max_n + +if __name__ == "__main__": + print "The answer to Euler Project, question 129 is: 1000023\n\n" \ + "This solution ran in 5.702E2 seconds.\n" \ + "Due to runtime, this is not actually running." diff --git a/python_code/too_slow/no268_1 b/python_code/too_slow/no268_1 new file mode 100755 index 0000000..454bfd1 --- /dev/null +++ b/python_code/too_slow/no268_1 @@ -0,0 +1,110 @@ +#!/usr/bin/env python + +# It can be verified that there are 23 positive integers less +# than 1000 that are divisible by at least four distinct primes +# less than 100. + +# Find how many positive integers less than 10**16 are divisible +# by at least four distinct primes less than 100. + + +###################### +# The biggest primes under 100 are 79, 83, 89, 97 and they have +# product 56606581 which is less than 10**16 + +# We will count this via a contrived form of PIE +# 798000 is divisible by (2,3,5,7) but also by 19 hence it would +# be included in 5 different sets (just considering numbers +# which are multiples of p1, p2, p3 and p4 (which end up being +# exactly those numbers which are multiples of p1*p2*p3*p4) + +# EXAMPLE: +# Compute the number if integers less than 10000 that are divisible by +# four out of 2, 3, 5, 7 and 11 + +# 2,3,5,7 = 210 --> 47 multiples +# 2,3,5,11 = 330 --> 30 multiples +# 2,3,7,11 = 462 --> 21 multiples +# 2,5,7,11 = 770 --> 12 multiples +# 3,5,7,11 = 1155 --> 8 multiples +# 2,3,5,7,11 = 2310 --> 4 multiples + +# We have 47 + 30 + 21 + 12 + 8 = 118 total multiples, but +# 4 multiples get double counted at the intersection of (2,3,5,7) and +# (2,3,5,11), 4 get double counted at the intersection of (2,3,5,7) and +# (2,3,7,11), so we must subtract its value from all the lists it +# is contained in which gives us 118 - 5*4 = 98 unique to those lists +# with 4 more in the 2,3,5,7,11 list for a total of 102 + +# subs = all_subsets([2, 3, 5, 7, 11, 13, 17], 4) +# def f(n): +# for sub in subs: +# if reduce(operator.and_, [n % prime == 0 for prime in sub]): +# return True +# return False +# val = len([x for x in range(1,1000000) if f(x)]) # 1661 + +# nines = 999999 +# primes = [2, 3, 5, 7, 11, 13, 17] +# count = 0 +# index = 4 +# sign = 1 +# result = [] +# for sub in all_subsets(primes, index): +# product = reduce(operator.mul, sub) +# result.append(nines/product) +# count += sign*(factorial(index-1)/(factorial(3)*factorial(index-4)))*sum(result) +# index += 1 +# sign = -sign +# result = [] +# for sub in all_subsets(primes, index): +# product = reduce(operator.mul, sub) +# result.append(nines/product) +# count += sign*(factorial(index-1)/(factorial(3)*factorial(index-4)))*sum(result) +# index += 1 +# sign = -sign +# result = [] +# for sub in all_subsets(primes, index): +# product = reduce(operator.mul, sub) +# result.append(nines/product) +# count += sign*(factorial(index-1)/(factorial(3)*factorial(index-4)))*sum(result) +# index += 1 +# sign = -sign +# result = [] +# for sub in all_subsets(primes, index): +# product = reduce(operator.mul, sub) +# result.append(nines/product) +# count += sign*(factorial(index-1)/(factorial(3)*factorial(index-4)))*sum(result) + +import operator +from math import factorial + +from python_code.decorators import euler_timer +from python_code.functions import all_subsets +from python_code.functions import sieve + +def choose(n, k): + return factorial(n)/(factorial(k)*factorial(n-k)) + +@euler_timer(268) +def main(): + PRIMES = sieve(100) + value = 10**16 + count = 0 + index = 4 + sign = 1 + + for index in range(4, len(PRIMES) + 1): + set_sizes = [] + for subset in all_subsets(PRIMES, index): + product = reduce(operator.mul, subset) + set_sizes.append((value - 1)/product) # integer division + count += sign*choose(index - 1, 3)*sum(set_sizes) + sign = -sign + + print count + +if __name__ == "__main__": + print "The answer to Euler Project, question 268 is: 785478606870985\n\n" \ + "This solution ran in 1.742E3 seconds.\n" \ + "Due to runtime, this is not actually running."