白新岭 发表于 2022-10-17 22:49:41

求不定方程x+y+z+u+v+m=36的解数, 其中未知数皆不是5的倍数

这是我发在数学中国上的一个主题,感兴趣可以看一下。
那里的方程更加开放,为x+y+z+u+v+m=N.

mathe 发表于 2022-10-19 09:20:23

限制变量不是5的倍数这个要求比较奇怪,所以大家没有兴趣很正常,不是说明题目有多困难。
这个问题需要对N关于5的余数进行分类,不同的类别采用不同的计算方案。
然后同样我们对x,y,z,u,v,m关于5的余数也进行分类,这时通常会出现不同变量余数相同的情况,可以合并计算,这样分类的数目就不会很多了。
而N除以5的余数分别为0~4时,得到变量关于5的余数分别有16或17类,具体计算结果如下:
T0:
1 1 1 1 2 4    Used 10 Weight 30
1 1 1 1 3 3    Used 10 Weight 15
1 1 1 2 2 3    Used 10 Weight 60
1 1 1 4 4 4    Used 15 Weight 20
1 1 2 2 2 2    Used 10 Weight 15
1 1 2 3 4 4    Used 15 Weight 180
1 1 3 3 3 4    Used 15 Weight 60
1 2 2 2 4 4    Used 15 Weight 60
1 2 2 3 3 4    Used 15 Weight 180
1 2 3 3 3 3    Used 15 Weight 30
1 3 4 4 4 4    Used 20 Weight 30
2 2 2 2 3 4    Used 15 Weight 30
2 2 2 3 3 3    Used 15 Weight 20
2 2 4 4 4 4    Used 20 Weight 15
2 3 3 4 4 4    Used 20 Weight 60
3 3 3 3 4 4    Used 20 Weight 15
Total 16 patterns 820 WeightSum
T1:
1 1 1 1 1 1    Used 6Weight 1
1 1 1 1 3 4    Used 11 Weight 30
1 1 1 2 2 4    Used 11 Weight 60
1 1 1 2 3 3    Used 11 Weight 60
1 1 2 2 2 3    Used 11 Weight 60
1 1 2 4 4 4    Used 16 Weight 60
1 1 3 3 4 4    Used 16 Weight 90
1 2 2 2 2 2    Used 11 Weight 6
1 2 2 3 4 4    Used 16 Weight 180
1 2 3 3 3 4    Used 16 Weight 120
1 3 3 3 3 3    Used 16 Weight 6
1 4 4 4 4 4    Used 21 Weight 6
2 2 2 2 4 4    Used 16 Weight 15
2 2 2 3 3 4    Used 16 Weight 60
2 2 3 3 3 3    Used 16 Weight 15
2 3 4 4 4 4    Used 21 Weight 30
3 3 3 4 4 4    Used 21 Weight 20
Total 17 patterns 819 WeightSum
T2:
1 1 1 1 1 2    Used 7Weight 6
1 1 1 1 4 4    Used 12 Weight 15
1 1 1 2 3 4    Used 12 Weight 120
1 1 1 3 3 3    Used 12 Weight 20
1 1 2 2 2 4    Used 12 Weight 60
1 1 2 2 3 3    Used 12 Weight 90
1 1 3 4 4 4    Used 17 Weight 60
1 2 2 2 2 3    Used 12 Weight 30
1 2 2 4 4 4    Used 17 Weight 60
1 2 3 3 4 4    Used 17 Weight 180
1 3 3 3 3 4    Used 17 Weight 30
2 2 2 2 2 2    Used 12 Weight 1
2 2 2 3 4 4    Used 17 Weight 60
2 2 3 3 3 4    Used 17 Weight 60
2 3 3 3 3 3    Used 17 Weight 6
2 4 4 4 4 4    Used 22 Weight 6
3 3 4 4 4 4    Used 22 Weight 15
Total 17 patterns 819 WeightSum
T3:
1 1 1 1 1 2    Used 7Weight 6
1 1 1 1 4 4    Used 12 Weight 15
1 1 1 2 3 4    Used 12 Weight 120
1 1 1 3 3 3    Used 12 Weight 20
1 1 2 2 2 4    Used 12 Weight 60
1 1 2 2 3 3    Used 12 Weight 90
1 1 3 4 4 4    Used 17 Weight 60
1 2 2 2 2 3    Used 12 Weight 30
1 2 2 4 4 4    Used 17 Weight 60
1 2 3 3 4 4    Used 17 Weight 180
1 3 3 3 3 4    Used 17 Weight 30
2 2 2 2 2 2    Used 12 Weight 1
2 2 2 3 4 4    Used 17 Weight 60
2 2 3 3 3 4    Used 17 Weight 60
2 3 3 3 3 3    Used 17 Weight 6
2 4 4 4 4 4    Used 22 Weight 6
3 3 4 4 4 4    Used 22 Weight 15
Total 17 patterns 819 WeightSum
T4:
1 1 1 1 1 4    Used 9Weight 6
1 1 1 1 2 3    Used 9Weight 30
1 1 1 2 2 2    Used 9Weight 20
1 1 1 3 4 4    Used 14 Weight 60
1 1 2 2 4 4    Used 14 Weight 90
1 1 2 3 3 4    Used 14 Weight 180
1 1 3 3 3 3    Used 14 Weight 15
1 2 2 2 3 4    Used 14 Weight 120
1 2 2 3 3 3    Used 14 Weight 60
1 2 4 4 4 4    Used 19 Weight 30
1 3 3 4 4 4    Used 19 Weight 60
2 2 2 2 2 4    Used 14 Weight 6
2 2 2 2 3 3    Used 14 Weight 15
2 2 3 4 4 4    Used 19 Weight 60
2 3 3 3 4 4    Used 19 Weight 60
3 3 3 3 3 4    Used 19 Weight 6
4 4 4 4 4 4    Used 24 Weight 1
Total 17 patterns 819 WeightSum

mathe 发表于 2022-10-19 09:32:00

后面计算就不难了,但是对于N除以5的余数需要分类,我们现在可以以N除以5的余数为1举例,比如N=36,其中有17个分类,每个分类都要类似处理,比如其中第二个分类
1 1 1 1 3 4    Used 11 Weight 30
由于6个余数已经使用了11,所以余下还有(36-11)/5=5个5的倍数可以自由分配到6个变量,每个变量可以最少分配到0个5的倍数,最多5个5的倍数。使用隔板法可以知道这种分配方案共$C_{5+6-1}^5=252$种。由于这个类别中通过交换变量位置又有30种不同的选择,所以共252*30=7560种。
依次处理所有的17个类别累加就可以得到结果了。
而上面的计算过程也说明对于通常情况,只要N充分大(不小于24),我们就可以把结果写成5个N的5次多项式(N除以5的每个余数使用一个)
比如可以得到$N -= h (mod 5)$而且$N \ge 20$时,数目为 $f_h(N)$,其中
$f_0(x)=\frac{27500x-2125x^3+41x^5}{18750}$
$f_1(x)=\frac{- 139048+ 145090x + 7495x^2- 13795x^3- 15x^4 +273x^5 }{125000}$
$f_2(x)=\frac{-86136+82390x+4685x^2-13255x^3-5x^4+273x^5}{125000}$
$f_3(x)=\frac{86136+82390x-4685x^2-13255x^3+5x^4+273x^5}{125000}$
$f_4(x)=\frac{139048+145090x-7495x^2-13795x^3+15x^4+273x^5}{125000}$

另外$f_1(36)=126826$,所以N=36时应该126826组解(交换不同变量的值代表不同解)

王守恩 发表于 2022-10-19 12:57:17

mathe 发表于 2022-10-19 09:32
后面计算就不难了,但是对于N除以5的余数需要分类,我们现在可以以N除以5的余数为1举例,比如N=36,其中有17 ...
把5串数串起来!

Table[(41 n^5 - 2125 n^3 + 27500 n)/18750*Floor[(n + 5)/5 - Floor[(n + 4)/5]]

+ (273 n^5 - 15n^4 - 13795 n^3 + 7495 n^2+145090 n-139048)/125000*Floor[(n + 4)/5 - Floor[(n + 3)/5]]

+ (273 n^5 - 5 n^4 - 13255 n^3 + 4685 n^2 + 82390 n - 86136)/125000*Floor[(n + 3)/5 - Floor[(n + 2)/5]]

+ (273 n^5+ 5 n^4 - 13255 n^3 - 4685 n^2 + 82390 n + 86136)/125000*Floor[(n + 2)/5 - Floor[(n + 1)/5]]

+ (273 n^5+15n^4 - 13795 n^3 - 7495 n^2+145090 n +139048)/125000*Floor[(n + 1)/5 - Floor], {n, 1, 36}]


{0, 0, 0, 0, 0, 1, 6, 21, 56, 120, 222, 372, 582, 882, 1300, 1863, 2598, 3513, 4668, 6120, 7924, 10149, 12774,

15899, 19620, 24024, 29274, 35274, 42174, 50120, 59220, 69825, 81690, 95025, 110040, 126826}

王守恩 发表于 2022-10-20 07:47:08

王守恩 发表于 2022-10-19 12:57
把5串数串起来!

Table[(41 n^5 - 2125 n^3 + 27500 n)/18750*Floor[(n + 5)/5 - Floor[(n + 4)/5]]
...

独立的 5 串数,可以有统一的递推公式。(若 5 换一换,是否有启发)

\(a(n) == 6 a(n - 1) - 15 a(n - 2) + 20 a(n - 3)- 15 a(n - 4) + 6 a(n - 5) - a(n - 6)\)

LinearRecurrence[{6, -15, 20, -15, 6, -1}, {-56, 0, 0, 1, 222, 1863}, 15]

{-56, 0, 0, 1, 222, 1863, 7924, 24024, 59220, 126826, 245232, 438723, 738298, 1182489, 1818180}

LinearRecurrence[{6, -15, 20, -15, 6, -1}, {-21, 0, 0, 6, 372, 2598}, 15]

{-21, 0, 0, 6, 372, 2598, 10149, 29274, 69825, 146076, 277542, 489798, 815298, 1294194, 1975155}

LinearRecurrence[{6, -15, 20, -15, 6, -1}, {-6, 0, 0, 21, 582, 3513}, 15]

{-6, 0, 0, 21, 582, 3513, 12774, 35274, 81690, 167286, 312732, 544923, 897798, 1413159, 2141490}

LinearRecurrence[{6, -15, 20, -15, 6, -1}, {-1, 0, 0, 56, 882, 4668}, 15]

{-1, 0, 0, 56, 882, 4668, 15899, 42174, 95025, 190736, 351162, 604548, 986348, 1540044, 2317965}

LinearRecurrence[{6, -15, 20, -15, 6, -1}, {0, 0, 0, 120, 1300, 6120}, 15]

{0, 0, 0, 120,1300,6120, 19620, 50120,110040,216720, 393240, 669240,1081740,1675960, 2506140}

王守恩 发表于 2022-10-20 19:00:41

x+y+z+u+v+m=N的解组数,限制条件未知数取数不能取4的倍数

   N是4的倍数余数是0,LinearRecurrence[{6, -15, 20, -15, 6, -1}, {-21,0, 0, 0,21, 267}, 15]

{-21,0, 0, 0,21, 267, 1308, 4263, 10983, 24234, 47880, 87066, 148401, 240141, 372372, 557193, 808899, 1144164}

   N是4的倍数余数是1,LinearRecurrence[{6, -15, 20, -15, 6, -1}, {-6, 0, 0, 0, 50, 426}, 15]

{-6, 0, 0, 0, 50, 426, 1812, 5482, 13482, 28812, 55608, 99324, 166914, 267014, 410124, 608790, 877786, 1234296}

   N是4的倍数余数是2,LinearRecurrence[{6, -15, 20, -15, 6, -1}, {-1, 0, 0, 1, 96, 651}, 15]

{-1, 0, 0, 1, 96, 651, 2487, 7062, 16653, 34538, 65178,114399, 189574, 299805, 456105, 671580, 961611, 1344036}

   N是4的倍数余数是3,LinearRecurrence[{6, -15, 20, -15, 6, -1}, {0, 0, 0, 6, 162, 932}, 15]

{0, 0, 0, 6,162, 932, 3282, 8862, 20188, 40824, 75564, 130614, 213774, 334620, 504686, 737646,1049496,1458736}

白新岭 发表于 2022-10-20 19:36:18

模5矩阵        0.2        0.4        0.6        0.8
0.2        0.4        0.6        0.8        1
0.4        0.6        0.8        1        1.2
0.6        0.8        1        1.2        1.4
0.8        1        1.2        1.4        1.6
5的剩余类        统计2
0.4        1
0.6        2
0.8        3
1        4
1.2        3
1.4        2
1.6        1
合计        16

白新岭 发表于 2022-10-20 19:37:07

5的剩余类        0.4        0.6        0.8        1        1.2        1.4        1.6
0.4        0.8        1        1.2        1.4        1.6        1.8        2
0.6        1        1.2        1.4        1.6        1.8        2        2.2
0.8        1.2        1.4        1.6        1.8        2        2.2        2.4
1        1.4        1.6        1.8        2        2.2        2.4        2.6
1.2        1.6        1.8        2        2.2        2.4        2.6        2.8
1.4        1.8        2        2.2        2.4        2.6        2.8        3
1.6        2        2.2        2.4        2.6        2.8        3        3.2

统计2        1        2        3        4        3        2        1
1        1        2        3        4        3        2        1
2        2        4        6        8        6        4        2
3        3        6        9        12        9        6        3
4        4        8        12        16        12        8        4
3        3        6        9        12        9        6        3
2        2        4        6        8        6        4        2
1        1        2        3        4        3        2        1

分值        统计4
0.8        1
1        4
1.2        10
1.4        20
1.6        31
1.8        40
2        44
2.2        40
2.4        31
2.6        20
2.8        10
3        4
3.2        1
合计        256

白新岭 发表于 2022-10-20 19:38:13

5的剩余类        0.4        0.6        0.8        1        1.2        1.4        1.6
0.8        1.2        1.4        1.6        1.8        2        2.2        2.4
1        1.4        1.6        1.8        2        2.2        2.4        2.6
1.2        1.6        1.8        2        2.2        2.4        2.6        2.8
1.4        1.8        2        2.2        2.4        2.6        2.8        3
1.6        2        2.2        2.4        2.6        2.8        3        3.2
1.8        2.2        2.4        2.6        2.8        3        3.2        3.4
2        2.4        2.6        2.8        3        3.2        3.4        3.6
2.2        2.6        2.8        3        3.2        3.4        3.6        3.8
2.4        2.8        3        3.2        3.4        3.6        3.8        4
2.6        3        3.2        3.4        3.6        3.8        4        4.2
2.8        3.2        3.4        3.6        3.8        4        4.2        4.4
3        3.4        3.6        3.8        4        4.2        4.4        4.6
3.2        3.6        3.8        4        4.2        4.4        4.6        4.8

统计2        1        2        3        4        3        2        1
1        1        2        3        4        3        2        1
4        4        8        12        16        12        8        4
10        10        20        30        40        30        20        10
20        20        40        60        80        60        40        20
31        31        62        93        124        93        62        31
40        40        80        120        160        120        80        40
44        44        88        132        176        132        88        44
40        40        80        120        160        120        80        40
31        31        62        93        124        93        62        31
20        20        40        60        80        60        40        20
10        10        20        30        40        30        20        10
4        4        8        12        16        12        8        4
1        1        2        3        4        3        2        1

分值        统计6
1.2        1
1.4        6
1.6        21
1.8        56
2        120
2.2        216
2.4        336
2.6        456
2.8        546
3        580
3.2        546
3.4        456
3.6        336
3.8        216
4        120
4.2        56
4.4        21
4.6        6
4.8        1
合计        4096

白新岭 发表于 2022-10-20 19:46:02

以上三楼是“单位矩阵”算法,只考虑模5的剩余类的合成(把变量看成带分数)。
剩下的事情好办,在用同样的方法,计算周期,36/5=7.2,考虑8个周期合成即可。
最后用单位矩阵与周期矩阵耦合算法,可得到答案。
对5种不同余数用5个式子表示,把N换成周期,小数部分去掉。
这种算法在Excel中可以轻松实现。
页: [1] 2 3 4 5 6 7 8 9 10
查看完整版本: 求不定方程x+y+z+u+v+m=36的解数, 其中未知数皆不是5的倍数