a,b,c都是素数,并且,a+b=33,b+c=44,c+d=66,d=( )

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/10 06:26:20

a,b,c都是素数,并且,a+b=33,b+c=44,c+d=66,d=( )
a,b,c都是素数,并且,a+b=33,b+c=44,c+d=66,d=( )

a,b,c都是素数,并且,a+b=33,b+c=44,c+d=66,d=( )
ABC都是素数,并且A+B=33,B+C=44,C+D=66,那么D=
a=2
b=31
c=13
d=53

a=2
b=31
c=13
d=53 因为a+b得33,奇加偶得奇,所以a=2 b=31c与d可以推出来

//要求:
//a,b,c都是素数,并且,a+b=33,b+c=44,c+d=66,d=(?)
// 符合要求的只有一组 2 31 13 53
#include
#include
int fun(int n)
{
int i = 2;
for(; n % i; i++)...

全部展开

//要求:
//a,b,c都是素数,并且,a+b=33,b+c=44,c+d=66,d=(?)
// 符合要求的只有一组 2 31 13 53
#include
#include
int fun(int n)
{
int i = 2;
for(; n % i; i++);
if(i == n)
return 1;
return 0;
}
int main()
{
int a, b, c;
for(a = 2; a < 33; a++)
for(b = 2; b < 33; b++)
for(c = 2; c < 44; c++)
{
if(fun(a) && fun(b) && fun(c))
if((a + b) == 33 && (b + c) == 44)
printf("%5d%5d%5d%5d\n", a, b, c, 66 - c);
}
}

收起