方程X1+X2+X3+X4=20共有——组正整数解?
方程X1+X2+X3+X4=20共有——组正整数解?
公式:方程 x1+x2+x3+x4=n (n ≥ 4) 的正整数解组数 C(n-1,3) = (n-1)(n-2)(n-3)/6 。
自然数解组数 C(n+3,3)=(n+3)(n+2)(n+1)/6 。
本题中,把 n = 20 分别代入,可得 969 和 1771 。
X1+X2+X3+X4=100,X1,X2,X3,X4为正整数解的组合n=?
可以转化为排列组合的问题。
相当于有100个球,在中间隔三块板,将其分成4份,
所以共有C(3,99)=99*98*97/6=156 849种解法
X1+X2+X3+X4=12 求正整数解和自然数解。
x1 x2 x3 x4
1 2 3 6
1 2 4 5
0 1 2 9
0 1 3 8
0 1 4 7
0 1 5 6
0 2 3 7
0 2 4 6
0 3 4 5
不定方程x1+x2+x3=100的正整数解共有几组
将100进行因式分解100=4*25*1=2*2*5*5*1=2*2*25*1=4*5*5*1100=1*100有2个或3个
确定以下方程的整数解数目:x1+x2+x3+x4=32。其中x1,x2≥5,x3,x4≥7。
20*1+19*2+18*3+...+1*20+21
方程X1+X2+X3+X4=30有多少满足x1≥1,x2≥0,x3≥-4,x4≥6的整数解? 急求,多谢!
解:只有-4最小,所以其它只能最大30+4=34
有4060个。
用basic程式解的。清单如下:
CLS
k = 0
FOR x1 = 1 TO 34
FOR x2 = 0 TO 34
FOR x3 = -4 TO 34
FOR x4 = 6 TO 34
m = x1 + x2 + x3 + x4
IF m = 30 THEN k = k + 1
NEXT
NEXT
NEXT
NEXT
PRINT k
END
数学解法:(悲剧了,发现x4>=6忘记了,你重新自己修改下吧。 )
x1=1, x2=0, x3,x4 有x3+x4=29,x3=-4 x4=33,x3大1,x4小1,则有29+4=33种解。
x1=1, x2=1,同上 x3+x4=28, 有 28+4=32种
...
x2=33,x3=-4,x4=0 1种,
x1=1 ,共有33+32+31+...+1=561种
x1=2, x2=0, x3+x4=28 ,32种,同上共有32+31+..+1=528种
....
x1=33,x2=0,x3+x4=-3,2种
x1=34, 1种
数列为(34个元素):561,528,496....a(n+1)=an-34+n.(n=1,2,......32,33)
总数为:561+528+...=1+2+4+7+11+16+22....+528+561
反过解好了,从X1=34 算到X1=1,就是1+2+4+....+528+561
a(n+1)=an+n-1,这个就好算了。略去具体。
悲剧,发现x4>=6忘记了,晕,实在不想重新来过。你自己重新修改下吧。
参考公式:
a1=1,a2=2,a3=4,a4=7....
a2-a1=1
a3-a2=2
a4-a3=3
...
an-a(n-1)=n-1
以上各式相加得:an-a1=1+2+...+(n-1)=n(n-1)/2
故an=n(n-1)/2+1=n^2/2-n/2+1
S=(1^2+..+n^2)/2-(1+2+...+n)/2+n
=n(n+1)(2n+1)/12-(1+n)n/4+n
=(n^3+5n)/6
求不定方程X1+X2+X3+3X4+3X5+5X6=21的正整数解的组数
解:因为是正整数解
所以:1<=x<=8
正整数解如下:
x1=1, x2=1, x3=2,x4 =1,x5=3,x6=1
x1=1, x2=1, x3=2,x4 =2,x5=2,x6=1
x1=1, x2=1, x3=2,x4 =3,x5=1,x6=1
x1=1, x2=1, x3=3,x4 =1,x5=1,x6=2
x1=1, x2=1, x3=5,x4 =1,x5=2,x6=1
x1=1, x2=1, x3=5,x4 =2,x5=1,x6=1
x1=1, x2=1, x3=8,x4 =1,x5=1,x6=1
x1=1, x2=2, x3=1,x4 =1,x5=3,x6=1
x1=1, x2=2, x3=1,x4 =2,x5=2,x6=1
x1=1, x2=2, x3=1,x4 =3,x5=1,x6=1
x1=1, x2=2, x3=2,x4 =1,x5=1,x6=2
x1=1, x2=2, x3=4,x4 =1,x5=2,x6=1
x1=1, x2=2, x3=4,x4 =2,x5=1,x6=1
x1=1, x2=2, x3=7,x4 =1,x5=1,x6=1
x1=1, x2=3, x3=1,x4 =1,x5=1,x6=2
x1=1, x2=3, x3=3,x4 =1,x5=2,x6=1
x1=1, x2=3, x3=3,x4 =2,x5=1,x6=1
x1=1, x2=3, x3=6,x4 =1,x5=1,x6=1
x1=1, x2=4, x3=2,x4 =1,x5=2,x6=1
x1=1, x2=4, x3=2,x4 =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,x5=1,x6=1
x1=3, x2=2, x3=5,x4 =1,x5=1,x6=1
x1=3, x2=3, x3=1,x4 =1,x5=2,x6=1
x1=3, x2=3, x3=1,x4 =2,x5=1,x6=1
x1=3, x2=3, x3=4,x4 =1,x5=1,x6=1
x1=3, x2=4, x3=3,x4 =1,x5=1,x6=1
x1=3, x2=5, x3=2,x4 =1,x5=1,x6=1
x1=3, x2=6, x3=1,x4 =1,x5=1,x6=1
x1=4, x2=1, x3=2,x4 =1,x5=2,x6=1
x1=4, x2=1, x3=2,x4 =2,x5=1,x6=1
x1=4, x2=1, x3=5,x4 =1,x5=1,x6=1
x1=4, x2=2, x3=1,x4 =1,x5=2,x6=1
x1=4, x2=2, x3=1,x4 =2,x5=1,x6=1
x1=4, x2=2, x3=4,x4 =1,x5=1,x6=1
x1=4, x2=3, x3=3,x4 =1,x5=1,x6=1
x1=4, x2=4, x3=2,x4 =1,x5=1,x6=1
x1=4, x2=5, x3=1,x4 =1,x5=1,x6=1
x1=5, x2=1, x3=1,x4 =1,x5=2,x6=1
x1=5, x2=1, x3=1,x4 =2,x5=1,x6=1
x1=5, x2=1, x3=4,x4 =1,x5=1,x6=1
x1=5, x2=2, x3=3,x4 =1,x5=1,x6=1
x1=5, x2=3, x3=2,x4 =1,x5=1,x6=1
x1=5, x2=4, x3=1,x4 =1,x5=1,x6=1
x1=6, x2=1, x3=3,x4 =1,x5=1,x6=1
x1=6, x2=2, x3=2,x4 =1,x5=1,x6=1
x1=6, x2=3, x3=1,x4 =1,x5=1,x6=1
x1=7, x2=1, x3=2,x4 =1,x5=1,x6=1
x1=7, x2=2, x3=1,x4 =1,x5=1,x6=1
x1=8, x2=1, x3=1,x4 =1,x5=1,x6=1
符合条件的解有:81组
程式如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
int k = 0;
for (int x1 = 1; x1 <= 8; x1 ++)
{
for (int x2 = 1; x2 <=8; x2++)
{
for (int x3 = 1; x3 <=8; x3++)
{
for (int x4 = 1; x4 <=8; x4++)
{
for (int x5 = 1; x5 <=8; x5++)
{
for (int x6 = 1; x6 <= 8; x6++)
{
if(x1+x2+x3+3*x4+3*x5+5*x6==21)
{
System.Console.WriteLine("x1={0}, x2={1}, x3={2},x4 ={3},x5={4},x6={5}",x1, x2, x3,x4,x5,x6);
k++;
}
}
}
}
}
}
}
System.Console.WriteLine("符合条件的解有:{0}组",k);
System.Console.ReadKey();
}
}
}
求方程x1+x2+x3+x4=12正数解组数
正数解有无穷多组。
如果是正整数解才有讨论价值
采用隔板法解决
画出12个小球,共有11个空位,在这些空位中间插入3个隔板,将小球分为4部分,分别表示x1,x2,x3,x4的值,于是共有C(11,3)=165种插法
故有165组解。
不定方程x1+x2+x3+.+x10=100的正整数解有多少组
把这个问题转换成100个球放入10个盒子中,每个盒子至少一个球。放入的球个数分别为x1、x2、x3、……、x10。
将此100个球排一行,在其中插入9块隔板将它们分成10份,每份至少一个球。因此这9块隔板不能相邻,也不能在两端。于是在100个球的中间99个空内放入隔板,共有放法C(99,9)种(其中C是组合数)。即是此不定方程的正整数解的组数,这个数超过了1.73×10^12。