northwolves 发表于 2023-6-1 14:20:47

王守恩 发表于 2023-6-1 04:27
主帖想解决这样一个问题。

3条边都是整数(不同)的三角形,已知1条边与周长, 求三角形的最大面积。

8楼代码去掉第一项

王守恩 发表于 2023-6-2 06:37:57

谢谢 northwolves! 公式(1)。
(Total[#] - 2 #[]) (Total[#] - 2 #[]) (Total[#] - 2 #[]) & /@Table, CountDistinct[#] == 3 &], {n, 10,50}]
{0, 21, 48, 35, 64, 105, 96, 135, 192, 189, 240, 315, 320, 385, 480, 495, 576, 693, 720, 819, 960, 1001, 1120, 1287, 1344, 1485, 1680, 1755, 1920, 2145, 2240, 2431, 2688, 2805, 3024, 3315, 3456, 3705, 4032, 4199, 4480}


公式(2)。
Table[(p - 2 Round[(p + 4)/3]) (p - 2 Round) (p - 2 Round[(p - 4)/3]), {p, 10, 50}]
{0, 21, 48, 35, 64, 105, 96, 135, 192, 189, 240, 315, 320, 385, 480, 495, 576, 693, 720, 819, 960, 1001, 1120, 1287, 1344, 1485, 1680, 1755, 1920, 2145, 2240, 2431, 2688, 2805, 3024, 3315, 3456, 3705, 4032, 4199, 4480}


公式(3)。
Table[(Floor[(p - 10)/3] + Mod) (Floor[(p - 2)/3] + Mod) (Floor[(p + 6)/3] + Mod), {p, 10, 50}]
{0, 21, 48, 35, 64, 105, 96, 135, 192, 189, 240, 315, 320, 385, 480, 495, 576, 693, 720, 819, 960, 1001, 1120, 1287, 1344, 1485, 1680, 1755, 1920, 2145, 2240, 2431, 2688, 2805, 3024, 3315, 3456, 3705, 4032, 4199, 4480}


公式(4)。
Table[((n - 8 - 2 ChebyshevU)/3) ((n - 2 ChebyshevU)/3) ((n + 8 - 2 ChebyshevU)/3), {n, 10, 50}]
{0, 21, 48, 35, 64, 105, 96, 135, 192, 189, 240, 315, 320, 385, 480, 495, 576, 693, 720, 819, 960, 1001, 1120, 1287, 1344, 1485, 1680, 1755, 1920, 2145, 2240, 2431, 2688, 2805, 3024, 3315, 3456, 3705, 4032, 4199, 4480}

王守恩 发表于 2023-6-4 17:30:18

还有比这更难的题目吗?!!!

从1到93这93个自然数中任取两两不等的9个数, 把它们相加得到一个和;

这个和的末位整数可能分别是0,1,2,3,...,7,8,9

求,末位整数的这十种不同情况出现的频数各是多少?

注意: 组合数 binomial(93,9)=961,835,834,245 肯定不是平均分配到每个数字上的,否则会有小数.

还有比这更难的题目吗?!!!

northwolves 发表于 2023-6-5 22:38:00

王守恩 发表于 2023-6-4 17:30
还有比这更难的题目吗?!!!

从1到93这93个自然数中任取两两不等的9个数, 把它们相加得到一个和;


n = 25; Tally@Mod, 10] // Sort

{{0,204248},{1,204347},{2,204248},{3,204347},{4,204248},{5,204347},{6,204248},{7,204347},{8,204248},{9,204347}}

northwolves 发表于 2023-6-5 22:42:03

n比较大时,Subsets会很慢很慢,这时需要一个技巧,统计1-n中个位数的个数,相当于计算带限制的不定方程的解的个数

northwolves 发表于 2023-6-5 22:43:47

n = 93;
a = Table, m], {m, 0, 9}];
b = PowersRepresentations;
c = Table], 10], Times @@ Binomial}, {x, Permutations@b[]}], First -> Last, Total], {k, 1, Length}];
d = Normal@Merge // Sort
e = Total@Values

{0->96183567106,1->96183599743,2->96183567106,3->96183599743,4->96183567106,5->96183599743,6->96183567106,7->96183599743,8->96183567106,9->96183599743}
961835834245

northwolves 发表于 2023-6-5 22:45:40

计算四位数也是比较快的,如:
n = 7744;
a = Table, m], {m, 0, 9}];
b = PowersRepresentations;
c = Table], 10], Times @@ Binomial}, {x, Permutations@b[]}], First -> Last, Total], {k, 1, Length}];
d = Normal@Merge // Sort
e = Total@Values

{0->27472956328306803884974116824,1->27472956328306803884974116050,2->27472956328306803884974116050,3->27472956328306803884974116050,4->27472956328306803884974116050,5->27472956328306803884974116824,6->27472956328306803884974116050,7->27472956328306803884974116050,8->27472956328306803884974116050,9->27472956328306803884974116050}
274729563283068038849741162048

northwolves 发表于 2023-6-5 23:13:55

n = 999; m = 5;
a = Table, m], {m, 0, 9}];
b = PowersRepresentations;
c = Table], 10], Times @@ Binomial}, {x, Permutations@b[]}], First -> Last, Total], {k, 1, Length}];
d = Normal@Merge // Sort
e = Total@Values

{0->820903967049,1->820903991800,2->820903966950,3->820903991800,4->820903966950,5->820903991900,6->820903966950,7->820903991800,8->820903966950,9->820903991800}
8209039793949

王守恩 发表于 2023-6-6 08:58:57

谢谢 northwolves!!!这是2017年的题目,当时把我吓着了。

从1到93这93个自然数中任取两两不等的9个数, 把它们相加得到一个和;

S(45)=S(801)=1
S(46)=S(800)=1
S(47)=S(799)=2
S(48)=S(798)=3
S(49)=S(797)=5
S(50)=S(796)=7
S(51)=S(795)=11
S(52)=S(794)=15
S(53)=S(793)=22
S(54)=S(792)=30
S(55)=S(791)=41
S(56)=S(790)=54
S(57)=S(789)=73
S(58)=S(788)=94
S(59)=S(787)=123
S(60)=S(786)=157
S(61)=S(785)=201
S(62)=S(784)=252
S(63)=S(783)=318
S(64)=S(782)=393

CoefficientList\(\bigg[\)Series\(\bigg[\)\(\D\prod_{i=1}^{84}\frac{x^{94}-x^i}{x^{i+85/2}-x^{85/2}},(x,0,756)\bigg],x\bigg]\)

{1, 1, 2, 3, 5, 7, 11, 15, 22, 30, 41, 54, 73, 94, 123, 157, 201, 252, 318, 393, 488, 598, 732, 887, 1076,1291, 1549, 1845, 2194, 2592, 3060, 3589, 4206, 4904, 5708, 6615, 7657, 8824,
10156, 11648, 13338, 15224, 17354, 19720, 22380, 25331, 28629, 32278, 36347, 40831, 45812, 51294, 57358,64015, 71362, 79403, 88252, 97922, 108527, 120092, 132751, 146520,
161554, 177884, 195666, 214944, 235899, 258569, 283161, 309729, 338484, 369499, 403016, 439100, 478025, 519880, 564945, 613331, 665355, 721125, 780997, 845105, 913815,
987292, 1065947, 1149940, 1239730, 1335513, 1437762, 1546707, 1662875, 1786498, 1918159, 2058130, 2207014, 2365128, 2533138, 2711363, 2900536, 3101027, 3313594, 3538657,
3777049, 4029199, 4296017, 4577988, 4876054, 5190763, 5523142, 5873748, 6243698, 6633618, 7044663, 7477526, 7933460, 8413176, 8918027, 9448798, 10006888,10593163,
11209130, 11855672, 12534410, 13246314, 13993056, 14775691, 15596013,16455101,17354873, 18296499, 19281955, 20312509, 21390268, 22516522, 23693514, 24922637, 26206195,
27545681, 28943542, 30401298, 31921540, 33505891, 35157009, 36876627,38667552,40531537, 42471543, 44489436, 46588241, 48769932, 51037692, 53393516, 55840744, 58381479,
61019126, 63755901, 66595368, 69539751, 72592776, 75756778, 79035540, 82431501, 85948605, 89589293, 93357667, 97256267, 101289245, 105459243, 109770567, 114225838,
118829517, 123584320, 128494739, 133563574, 138795465, 144193176, 149761487, 155503235, 161423215, 167524336, 173811523, 180287616, 186957668, 193824577, 200893381,
208167022, 215650651, 223347116, 231261670, 239397187, 247758877, 256349637, 265174762, 274237010, 283541755, 293091757, 302892307, 312946148, 323258630, 333832322,
344672617, 355782044, 367165875, 378826593, 390769489, 402996819, 415513886,428322873, 441428912, 454834092, 468543531, 482559047, 496885726, 511525264, 526482531,
541759093, 557359760,573285767, 589541854, 606129097, 623051964, 640311348, 657911619, 675853292, 694140619, 712773902, 731757073, 751090214, 770777110, 790817402,
811214719, 831968452, 853081852, 874554037, 896388074, 918582594, 941140461, 964060005, 987343667, 1010989469, 1034999623,1059371606,1084107393,1109204129,1134663313,
1160481737, 1186660641, 1213196234, 1240089481, 1267336216, 1294936893, 1322886970, 1351186608, 1379830634, 1408818914, 1438145884, 1467810859, 1497807868, 1528135918,
1558788388, 1589763966, 1621055615, 1652661456, 1684574041, 1716791167, 1749304709, 1782112145, 1815204938, 1848579981, 1882228317, 1916146522, 1950324966, 1984759905,
2019441296, 2054364816, 2089520024, 2124902287, 2160500490, 2196309704, 2232318431, 2268521171, 2304906043, 2341467270, 2378192329, 2415075170, 2452102912, 2489268968,
2526560123, 2563969544, 2601483400, 2639094636, 2676789120, 2714559293, 2752390731, 2790275688, 2828199183, 2866153296, 2904122796, 2942099318, 2980067414, 3018018588,
3055936887, 3093813715, 3131632951, 3169385612, 3207055425, 3244633357, 3282102714, 3319454433, 3356671724, 3393745219, 3430658073, 3467400943, 3503956636, 3540315872,
3576461465, 3612383904, 3648066032, 3683498462, 3718663790, 3753552777, 3788148113, 3822440426, 3856412545, 3890055309, 3923351387, 3956291870, 3988859635, 4021045724,
4052833246, 4084213559, 4115169723, 4145693438, 4175768064, 4205385354, 4234529015, 4263191205, 4291355669, 4319015011, 4346153390, 4372763545, 4398830071, 4424346213,
4449296711, 4473675337, 4497467330, 4520666691, 4543259199, 4565239437, 4586593406, 4607316307, 4627394737, 4646824193, 4665591885, 4683693975, 4701117983, 4717860750,
4733910457, 4749264314, 4763911196, 4777849031, 4791067057, 4803563947, 4815329672, 4826363315, 4836655586, 4846206342, 4855006717, 4863057344, 4870350125, 4876886147,
4882658102, 4887667871, 4891908593, 4895382960, 4898084917, 4900017619, 4901175813, 4901563471, 4901175813, 4900017619, 4898084917, 4895382960, 4891908593, 4887667871,
4882658102, 4876886147, 4870350125, 4863057344, 4855006717, 4846206342, 4836655586, 4826363315, 4815329672, 4803563947, 4791067057, 4777849031, 4763911196, 4749264314,
4733910457, 4717860750, 4701117983, 4683693975, 4665591885, 4646824193, 4627394737, 4607316307, 4586593406, 4565239437, 4543259199, 4520666691, 4497467330, 4473675337,
4449296711, 4424346213, 4398830071, 4372763545, 4346153390, 4319015011, 4291355669, 4263191205, 4234529015, 4205385354, 4175768064, 4145693438, 4115169723, 4084213559,
4052833246, 4021045724, 3988859635, 3956291870, 3923351387, 3890055309, 3856412545, 3822440426, 3788148113, 3753552777, 3718663790, 3683498462, 3648066032, 3612383904,
3576461465, 3540315872, 3503956636, 3467400943, 3430658073, 3393745219, 3356671724, 3319454433, 3282102714, 3244633357, 3207055425, 3169385612, 3131632951, 3093813715,
3055936887, 3018018588, 2980067414, 2942099318, 2904122796, 2866153296, 2828199183, 2790275688, 2752390731, 2714559293, 2676789120, 2639094636, 2601483400, 2563969544,
2526560123, 2489268968, 2452102912, 2415075170, 2378192329, 2341467270, 2304906043, 2268521171, 2232318431, 2196309704, 2160500490, 2124902287, 2089520024, 2054364816,
2019441296, 1984759905, 1950324966, 1916146522, 1882228317, 1848579981, 1815204938, 1782112145, 1749304709, 1716791167, 1684574041, 1652661456, 1621055615, 1589763966,
1558788388, 1528135918, 1497807868, 1467810859, 1438145884, 1408818914, 1379830634, 1351186608, 1322886970, 1294936893, 1267336216, 1240089481, 1213196234, 1186660641,
1160481737, 1134663313, 1109204129, 1084107393, 1059371606, 1034999623, 1010989469,987343667,   964060005,   941140461,918582594, 896388074, 874554037, 853081852,
831968452, 811214719, 790817402, 770777110, 751090214, 731757073, 712773902, 694140619, 675853292, 657911619, 640311348, 623051964,606129097, 589541854, 573285767,
557359760, 541759093, 526482531, 511525264, 496885726,482559047, 468543531, 454834092, 441428912, 428322873, 415513886, 402996819, 390769489, 378826593, 367165875,
355782044, 344672617, 333832322, 323258630, 312946148, 302892307,293091757, 283541755, 274237010, 265174762, 256349637, 247758877, 239397187, 231261670,223347116,
215650651, 208167022, 200893381, 193824577, 186957668, 180287616, 173811523,167524336, 161423215, 155503235, 149761487, 144193176, 138795465, 133563574, 128494739,
123584320, 118829517, 114225838, 109770567, 105459243, 101289245, 97256267, 93357667, 89589293, 85948605, 82431501, 79035540, 75756778, 72592776, 69539751, 66595368,
63755901,61019126, 58381479, 55840744, 53393516, 51037692,48769932,46588241, 44489436, 42471543, 40531537, 38667552, 36876627, 35157009, 33505891, 31921540, 30401298,
28943542, 27545681,26206195, 24922637, 23693514, 22516522, 21390268, 20312509,19281955, 18296499, 17354873, 16455101, 15596013, 14775691, 13993056, 13246314, 12534410,
11855672, 11209130, 10593163,10006888, 9448798, 8918027, 8413176,7933460, 7477526, 7044663, 6633618, 6243698,5873748,5523142,5190763,4876054,4577988, 4296017,4029199,
3777049, 3538657, 3313594, 3101027, 2900536, 2711363, 2533138, 2365128, 2207014, 2058130, 1918159, 1786498, 1662875, 1546707,1437762, 1335513, 1239730, 1149940, 1065947,
987292, 913815, 845105,780997,721125,665355,613331, 564945, 519880, 478025, 439100, 403016, 369499,338484, 309729, 283161, 258569, 235899, 214944, 195666, 177884, 161554,
146520, 132751, 120092, 108527, 97922, 88252, 79403, 71362, 64015, 57358, 51294, 45812, 40831, 36347, 32278,28629,25331, 22380, 19720,17354, 15224, 13338,11648, 10156, 8824,
7657, 6615, 5708, 4904, 4206, 3589, 3060, 2592, 2194, 1845, 1549, 1291, 1076, 887, 732, 598, 488, 393, 318, 252, 201, 157, 123, 94, 73, 54, 41, 30, 22, 15, 11, 7, 5, 3, 2, 1, 1}

王守恩 发表于 2023-6-6 11:08:54

从1到93这93个自然数中任取两两不等的9个数, 把它们相加得到一个和;

这个和的末位整数可能分别是0,1,2,3,...,7,8,9

求,末位整数的这十种不同情况出现的频数各是多少?

注意: 组合数 binomial(93,9)=961,835,834,245 肯定不是平均分配到每个数字上的,否则会有小数.

挑战一一下!!!!

从1到365这365个自然数中任取两两不等的12个数, 把它们相加得到一个和;

这个和的末位整数可能分别是0,1,2,3,...,7,8,9

求,末位整数的这十种不同情况出现的频数各是多少?

注意: 组合数 binomial(365,12)=9,723,205,992,282,927,449,305 肯定不是平均分配到每个数字上的,否则会有小数.

还有比这更难的题目吗?!!!
页: 1 [2] 3 4
查看完整版本: 通项公式